Skip to content

Commit 4415d4c

Browse files
authored
Merge pull request #1034 from seth-reeser/develop-catapult
RedHat: Adding support for WordPress 6 and PHP 7.3.
2 parents bb7be16 + 665df84 commit 4415d4c

File tree

6 files changed

+59
-24
lines changed

6 files changed

+59
-24
lines changed

VERSION.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
version: 4.5.0
2+
version: 4.5.1
33
major:
44
description: "Catapult uses Semantic Versioning. During a MAJOR increment, incompatable API changes are made which require a manual upgrade path. Please follow these directions:"
55
notice: "NEW MAJOR VERSION OF CATAPULT AVAILABLE"

provisioners/redhat/installers/software/wordpress6/wp-config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
77
$_SERVER['REMOTE_ADDR'] = $ip[0];
88
}
9+
910
/**
1011
* The base configuration for WordPress
1112
*

provisioners/redhat/modules/mysql_database_restore.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,14 @@ if ([ ! -z "${software}" ]); then
130130
echo -e "\t- replacing URLs in the database to align with the environment..."
131131
wp-cli-php71 --allow-root --path="/var/www/repositories/apache/${domain}/${webroot}" search-replace ":\/\/(www\.)?(dev\.|test\.|qc\.)?(${domain_url_replace})" "://\$1${domain_url}" --regex | sed "s/^/\t\t/"
132132
fi
133-
if ([ "${software}" = "wordpress5" ] || [ "${software}" = "wordpress6" ]); then
133+
if ([ "${software}" = "wordpress5" ]); then
134134
echo -e "\t- replacing URLs in the database to align with the environment..."
135135
wp-cli-php72 --allow-root --path="/var/www/repositories/apache/${domain}/${webroot}" search-replace ":\/\/(www\.)?(dev\.|test\.|qc\.)?(${domain_url_replace})" "://\$1${domain_url}" --regex | sed "s/^/\t\t/"
136136
fi
137+
if ([ "${software}" = "wordpress6" ]); then
138+
echo -e "\t- replacing URLs in the database to align with the environment..."
139+
wp-cli-php73 --allow-root --path="/var/www/repositories/apache/${domain}/${webroot}" search-replace ":\/\/(www\.)?(dev\.|test\.|qc\.)?(${domain_url_replace})" "://\$1${domain_url}" --regex | sed "s/^/\t\t/"
140+
fi
137141
fi
138142
fi
139143
fi

provisioners/redhat/modules/software_config.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,36 @@ elif [ "${software}" = "wordpress5" ]; then
447447
/catapult/provisioners/redhat/installers/software/${software}/wp-config.php > "${file}"
448448
sudo chmod 0444 "${file}"
449449

450+
elif [ "${software}" = "wordpress6" ]; then
451+
452+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin is-installed w3-total-cache
453+
if [ $? -eq 0 ]; then
454+
cache="true"
455+
else
456+
cache="false"
457+
fi
458+
if ([ "$1" = "dev" ] || [ "$1" = "test" ]); then
459+
debug="true"
460+
else
461+
debug="false"
462+
fi
463+
file="/var/www/repositories/apache/${domain}/${webroot}${softwareroot}${database_config_file}"
464+
if [ -f "${file}" ]; then
465+
sudo chmod 0777 "${file}"
466+
else
467+
mkdir --parents $(dirname "${file}")
468+
fi
469+
sed --expression="s/database_name_here/${1}_${domain_valid_db_name}/g" \
470+
--expression="s/username_here/${mysql_user}/g" \
471+
--expression="s/password_here/${mysql_user_password}/g" \
472+
--expression="s/localhost/${redhat_mysql_ip}/g" \
473+
--expression="s/'wp_'/'${software_dbprefix}'/g" \
474+
--expression="s/'put your unique phrase here'/'${unique_hash}'/g" \
475+
--expression="s/'debug_here'/${debug}/g" \
476+
--expression="s/'cache_here'/${cache}/g" \
477+
/catapult/provisioners/redhat/installers/software/${software}/wp-config.php > "${file}"
478+
sudo chmod 0444 "${file}"
479+
450480
elif [ "${software}" = "xenforo1" ]; then
451481

452482
file="/var/www/repositories/apache/${domain}/${webroot}${softwareroot}${database_config_file}"

provisioners/redhat/modules/software_operations_file.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,14 @@ if hash composer 2>/dev/null && hash drush 2>/dev/null && hash wp-cli 2>/dev/nul
379379
echo -e "\nSUPPORTED SOFTWARE VERSION DETECTED: ${version}\n"
380380

381381
if [ "${software_auto_update}" = "true" ]; then
382-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root theme update --all
383-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin update --all
384-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root core update
385-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin update --all
386-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root theme update --all
387-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin install w3-total-cache
388-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin activate w3-total-cache
389-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache fix_environment apache
382+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root theme update --all
383+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin update --all
384+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root core update
385+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin update --all
386+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root theme update --all
387+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin install w3-total-cache
388+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin activate w3-total-cache
389+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache fix_environment apache
390390
else
391391
sed -i "/\/\*\* Enable W3 Total Cache \*\//d" "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}/wp-config.php"
392392
sed -i "/define( 'WP_CACHE' , true ); \/\/ Added by W3 Total Cache/d" "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}/wp-config.php"

provisioners/redhat/modules/software_operations_meta.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ elif [ "${software}" = "wordpress6" ]; then
196196
VALUES ('1', 'admin', MD5('$(catapult environments.${1}.software.wordpress.admin_password)'), 'admin', '$(catapult company.email)', '0', 'admin')
197197
ON DUPLICATE KEY UPDATE user_login='admin', user_pass=MD5('$(catapult environments.${1}.software.wordpress.admin_password)'), user_nicename='admin', user_email='$(catapult company.email)', user_status='0', display_name='admin';
198198
"
199-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root user add-role 1 administrator
199+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root user add-role 1 administrator
200200

201201
elif [ "${software}" = "xenforo2" ]; then
202202

@@ -476,25 +476,25 @@ elif [ "${software}" = "wordpress5" ]; then
476476

477477
elif [ "${software}" = "wordpress6" ]; then
478478

479-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root core update-db
480-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root cache flush
481-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root yoast index --reindex --skip-confirmation
482-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache flush all
479+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root core update-db
480+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root cache flush
481+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root yoast index --reindex --skip-confirmation
482+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache flush all
483483

484484
# caching is always disabled in dev while page cache is enabled in all other environments
485485
if [ "$1" = "dev" ]; then
486-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set pgcache.enabled false --type=boolean
487-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set dbcache.enabled false --type=boolean
488-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set objectcache.enabled false --type=boolean
489-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set browsercache.enabled false --type=boolean
486+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set pgcache.enabled false --type=boolean
487+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set dbcache.enabled false --type=boolean
488+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set objectcache.enabled false --type=boolean
489+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set browsercache.enabled false --type=boolean
490490
sed -i "/\/\*\* Enable W3 Total Cache \*\//d" "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}/wp-config.php"
491491
sed -i "/define( 'WP_CACHE' , true ); \/\/ Added by W3 Total Cache/d" "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}/wp-config.php"
492492
else
493-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set pgcache.enabled true --type=boolean
494-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set dbcache.enabled false --type=boolean
495-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set objectcache.enabled false --type=boolean
496-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache option set browsercache.enabled false --type=boolean
497-
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache fix_environment apache
493+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set pgcache.enabled true --type=boolean
494+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set dbcache.enabled false --type=boolean
495+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set objectcache.enabled false --type=boolean
496+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache option set browsercache.enabled false --type=boolean
497+
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache fix_environment apache
498498
fi
499499

500500
elif [ "${software}" = "xenforo1" ]; then

0 commit comments

Comments
 (0)