Skip to content

Commit

Permalink
Merge pull request #1034 from seth-reeser/develop-catapult
Browse files Browse the repository at this point in the history
RedHat: Adding support for WordPress 6 and PHP 7.3.
  • Loading branch information
seth-reeser authored Aug 7, 2022
2 parents bb7be16 + 665df84 commit 4415d4c
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 24 deletions.
2 changes: 1 addition & 1 deletion VERSION.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 4.5.0
version: 4.5.1
major:
description: "Catapult uses Semantic Versioning. During a MAJOR increment, incompatable API changes are made which require a manual upgrade path. Please follow these directions:"
notice: "NEW MAJOR VERSION OF CATAPULT AVAILABLE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $ip[0];
}

/**
* The base configuration for WordPress
*
Expand Down
6 changes: 5 additions & 1 deletion provisioners/redhat/modules/mysql_database_restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,14 @@ if ([ ! -z "${software}" ]); then
echo -e "\t- replacing URLs in the database to align with the environment..."
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/"
fi
if ([ "${software}" = "wordpress5" ] || [ "${software}" = "wordpress6" ]); then
if ([ "${software}" = "wordpress5" ]); then
echo -e "\t- replacing URLs in the database to align with the environment..."
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/"
fi
if ([ "${software}" = "wordpress6" ]); then
echo -e "\t- replacing URLs in the database to align with the environment..."
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/"
fi
fi
fi
fi
Expand Down
30 changes: 30 additions & 0 deletions provisioners/redhat/modules/software_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,36 @@ elif [ "${software}" = "wordpress5" ]; then
/catapult/provisioners/redhat/installers/software/${software}/wp-config.php > "${file}"
sudo chmod 0444 "${file}"

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

cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin is-installed w3-total-cache
if [ $? -eq 0 ]; then
cache="true"
else
cache="false"
fi
if ([ "$1" = "dev" ] || [ "$1" = "test" ]); then
debug="true"
else
debug="false"
fi
file="/var/www/repositories/apache/${domain}/${webroot}${softwareroot}${database_config_file}"
if [ -f "${file}" ]; then
sudo chmod 0777 "${file}"
else
mkdir --parents $(dirname "${file}")
fi
sed --expression="s/database_name_here/${1}_${domain_valid_db_name}/g" \
--expression="s/username_here/${mysql_user}/g" \
--expression="s/password_here/${mysql_user_password}/g" \
--expression="s/localhost/${redhat_mysql_ip}/g" \
--expression="s/'wp_'/'${software_dbprefix}'/g" \
--expression="s/'put your unique phrase here'/'${unique_hash}'/g" \
--expression="s/'debug_here'/${debug}/g" \
--expression="s/'cache_here'/${cache}/g" \
/catapult/provisioners/redhat/installers/software/${software}/wp-config.php > "${file}"
sudo chmod 0444 "${file}"

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

file="/var/www/repositories/apache/${domain}/${webroot}${softwareroot}${database_config_file}"
Expand Down
16 changes: 8 additions & 8 deletions provisioners/redhat/modules/software_operations_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,14 @@ if hash composer 2>/dev/null && hash drush 2>/dev/null && hash wp-cli 2>/dev/nul
echo -e "\nSUPPORTED SOFTWARE VERSION DETECTED: ${version}\n"

if [ "${software_auto_update}" = "true" ]; then
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root theme update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root core update
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root theme update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin install w3-total-cache
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root plugin activate w3-total-cache
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root w3-total-cache fix_environment apache
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root theme update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root core update
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root theme update --all
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin install w3-total-cache
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root plugin activate w3-total-cache
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root w3-total-cache fix_environment apache
else
sed -i "/\/\*\* Enable W3 Total Cache \*\//d" "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}/wp-config.php"
sed -i "/define( 'WP_CACHE' , true ); \/\/ Added by W3 Total Cache/d" "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}/wp-config.php"
Expand Down
28 changes: 14 additions & 14 deletions provisioners/redhat/modules/software_operations_meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ elif [ "${software}" = "wordpress6" ]; then
VALUES ('1', 'admin', MD5('$(catapult environments.${1}.software.wordpress.admin_password)'), 'admin', '$(catapult company.email)', '0', 'admin')
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';
"
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php72 --allow-root user add-role 1 administrator
cd "/var/www/repositories/apache/${domain}/${webroot}${softwareroot}" && wp-cli-php73 --allow-root user add-role 1 administrator

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

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

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

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

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

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

0 comments on commit 4415d4c

Please sign in to comment.