Merge pull request #85 from WordOps/updating-configuration

Updating configuration
This commit is contained in:
VirtuBox
2019-06-16 19:47:24 +02:00
committed by GitHub
4 changed files with 34 additions and 22 deletions

View File

@@ -54,4 +54,4 @@ script:
- sudo wp --allow-root --info
- sudo wo info || sudo tail -n50 /var/log/wo/wordops.log
- sudo tree -L 2 /etc/nginx
- sudo tree -L 3 /var/www/22222/htdocs/
- sudo cat /var/www/wpredis.net/wp-config.php

View File

@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.6 - [Unreleased]
#### Fixed
- WP_CACHE_KEY_SALT set twice
### v3.9.5.1 - 2019-05-10
#### Fixed

View File

@@ -100,7 +100,8 @@ class WODebugController(CementBaseController):
for ip_addr in debug_address:
if not ("debug_connection "+ip_addr in open('/etc/nginx/'
'nginx.conf', encoding='utf-8').read()):
'nginx.conf',
encoding='utf-8').read()):
Log.info(self, "Setting up Nginx debug connection"
" for "+ip_addr)
WOShellExec.cmd_exec(self, "sed -i \"/events {{/a\\ \\ \\ "

View File

@@ -296,7 +296,7 @@ def setupwordpress(self, data):
Log.debug(self, "Generating wp-config for WordPress Single site")
Log.debug(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"core config " +
"config create " +
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbuser=\'{2}\' "
"--dbhost=\'{3}\' "
.format(data['wo_db_name'], wo_wp_prefix,
@@ -308,7 +308,7 @@ def setupwordpress(self, data):
try:
if WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root"
.format(WOVariables.wo_wpcli_path) +
" core config " +
" config create " +
"--dbname=\'{0}\' --dbprefix=\'{1}\' "
"--dbuser=\'{2}\' --dbhost=\'{3}\' "
.format(data['wo_db_name'], wo_wp_prefix,
@@ -317,12 +317,9 @@ def setupwordpress(self, data):
) +
"--dbpass=\'{0}\' "
"--extra-php<<PHP \n"
"{1} {redissalt}\nPHP\""
"\n{1}\nPHP\""
.format(data['wo_db_pass'],
"\n\ndefine(\'WP_DEBUG\', false);",
redissalt="\n\ndefine( \'WP_CACHE_KEY_SALT\', \'{0}:\' );"
.format(wo_domain_name) if data['wpredis']
else ''),
"\ndefine(\'WP_DEBUG\', false);"),
log=False
):
pass
@@ -330,11 +327,17 @@ def setupwordpress(self, data):
raise SiteError("generate wp-config failed for wp single site")
except CommandExecutionError as e:
raise SiteError("generate wp-config failed for wp single site")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_CACHE_KEY_SALT "
"\'{0}:\'\"".format(wo_domain_name))
else:
Log.debug(self, "Generating wp-config for WordPress multisite")
Log.debug(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"core config " +
"config create " +
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
.format(data['wo_db_name'], wo_wp_prefix, data['wo_db_host']) +
"--dbuser=\'{0}\' --dbpass=\'{1}\' "
@@ -348,21 +351,19 @@ def setupwordpress(self, data):
try:
if WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root"
.format(WOVariables.wo_wpcli_path) +
" core config " +
" config create " +
"--dbname=\'{0}\' --dbprefix=\'{1}\' "
"--dbhost=\'{2}\' "
.format(data['wo_db_name'], wo_wp_prefix,
data['wo_db_host']) +
"--dbuser=\'{0}\' --dbpass=\'{1}\' "
"--extra-php<<PHP \n {2} {3} {redissalt}\nPHP\""
"--extra-php<<PHP \n "
"\n{2} {3}\nPHP\""
.format(data['wo_db_user'],
data['wo_db_pass'],
"\ndefine(\'WPMU_ACCEL_REDIRECT\',"
" true);",
"\n\ndefine(\'WP_DEBUG\', false);",
redissalt="\n\ndefine( \'WP_CACHE_KEY_SALT\', \'{0}:\' );"
.format(wo_domain_name) if data['wpredis']
else ''),
"\ndefine(\'WP_DEBUG\', false);"),
log=False
):
pass
@@ -371,6 +372,11 @@ def setupwordpress(self, data):
except CommandExecutionError as e:
raise SiteError("generate wp-config failed for wp multi site")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_CACHE_KEY_SALT "
"\'{0}:\'\"".format(wo_domain_name))
# WOFileUtils.mvfile(self, os.getcwd()+'/wp-config.php',
# os.path.abspath(os.path.join(os.getcwd(), os.pardir)))
@@ -1279,7 +1285,7 @@ def setupLetsEncrypt(self, wo_domain_name):
"'/etc/letsencrypt/config' "
"--issue "
"-d {0} -d www.{0} -w /var/www/html "
"-k ec-384 --force"
"-k ec-384 -f"
.format(wo_domain_name))
else:
Log.info(self, "Issuing SSL cert with acme.sh")
@@ -1288,7 +1294,7 @@ def setupLetsEncrypt(self, wo_domain_name):
"'/etc/letsencrypt/config' "
"--issue "
"-d {0} -d www.{0} -w /var/www/html "
"-k ec-384"
"-k ec-384 -f"
.format(wo_domain_name))
if ssl:
@@ -1308,7 +1314,8 @@ def setupLetsEncrypt(self, wo_domain_name):
"{0}/{1}/fullchain.pem "
"--ca-file {0}/{1}/ca.pem "
"--reloadcmd "
"\"service nginx restart\" "
"\"nginx -t && "
"service nginx restart\" "
.format(WOVariables.wo_ssl_live,
wo_domain_name))
Log.info(
@@ -1363,7 +1370,7 @@ def setupLetsEncryptSubdomain(self, wo_domain_name):
"'/etc/letsencrypt/config' "
"--issue "
"-d {0} -w /var/www/html "
"-k ec-384 --force"
"-k ec-384 -f"
.format(wo_domain_name))
else:
Log.info(self, "Issuing SSL cert with acme.sh")
@@ -1372,7 +1379,7 @@ def setupLetsEncryptSubdomain(self, wo_domain_name):
"'/etc/letsencrypt/config' "
"--issue "
"-d {0} -w /var/www/html "
"-k ec-384"
"-k ec-384 -f"
.format(wo_domain_name))
if ssl:
@@ -1391,7 +1398,7 @@ def setupLetsEncryptSubdomain(self, wo_domain_name):
"{0}/{1}/fullchain.pem "
"--ca-file {0}/{1}/ca.pem "
"--reloadcmd "
"\"service nginx restart\" "
"\"nginx -t && service nginx restart\" "
.format(WOVariables.wo_ssl_live,
wo_domain_name))