Almost there, don't use this yet
This commit is contained in:
@@ -310,20 +310,20 @@ class WODebugController(CementBaseController):
|
||||
nc.savef('/etc/nginx/conf.d/upstream.conf')
|
||||
|
||||
# Enable xdebug
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
|
||||
"xdebug.ini",
|
||||
";zend_extension",
|
||||
"zend_extension")
|
||||
|
||||
# Fix slow log is not enabled default in PHP5.6
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
|
||||
config['debug']['slowlog'] = '/var/log/php/7.0/slow.log'
|
||||
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
|
||||
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log'
|
||||
config['debug']['request_slowlog_timeout'] = '10s'
|
||||
with open('/etc/php/7.0/fpm/pool.d/debug.conf',
|
||||
with open('/etc/php/7.2/fpm/pool.d/debug.conf',
|
||||
encoding='utf-8', mode='w') as confifile:
|
||||
Log.debug(self, "Writting debug.conf configuration into "
|
||||
"/etc/php/7.0/fpm/pool.d/debug.conf")
|
||||
"/etc/php/7.2/fpm/pool.d/debug.conf")
|
||||
config.write(confifile)
|
||||
|
||||
self.trigger_php = True
|
||||
@@ -331,7 +331,7 @@ class WODebugController(CementBaseController):
|
||||
else:
|
||||
Log.info(self, "PHP debug is already enabled")
|
||||
|
||||
self.msg = self.msg + ['/var/log/php/7.0/slow.log']
|
||||
self.msg = self.msg + ['/var/log/php/7.2/slow.log']
|
||||
|
||||
# PHP global debug stop
|
||||
elif (self.app.pargs.php7 == 'off' and not self.app.pargs.site_name):
|
||||
@@ -349,7 +349,7 @@ class WODebugController(CementBaseController):
|
||||
nc.savef('/etc/nginx/conf.d/upstream.conf')
|
||||
|
||||
# Disable xdebug
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
|
||||
"xdebug.ini",
|
||||
"zend_extension",
|
||||
";zend_extension")
|
||||
@@ -365,38 +365,38 @@ class WODebugController(CementBaseController):
|
||||
# PHP5-FPM start global debug
|
||||
if (self.app.pargs.fpm7 == 'on' and not self.app.pargs.site_name):
|
||||
if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" "
|
||||
"/etc/php/7.0/fpm/php-fpm.conf"):
|
||||
"/etc/php/7.2/fpm/php-fpm.conf"):
|
||||
Log.info(self, "Setting up PHP7.0-FPM log_level = debug")
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.0/fpm/php-fpm.conf')
|
||||
config.read('/etc/php/7.2/fpm/php-fpm.conf')
|
||||
config.remove_option('global', 'include')
|
||||
config['global']['log_level'] = 'debug'
|
||||
config['global']['include'] = '/etc/php/7.0/fpm/pool.d/*.conf'
|
||||
with open('/etc/php/7.0/fpm/php-fpm.conf',
|
||||
config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf'
|
||||
with open('/etc/php/7.2/fpm/php-fpm.conf',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "Writting php7.0-FPM configuration into "
|
||||
"/etc/php/7.0/fpm/php-fpm.conf")
|
||||
"/etc/php/7.2/fpm/php-fpm.conf")
|
||||
config.write(configfile)
|
||||
self.trigger_php = True
|
||||
else:
|
||||
Log.info(self, "PHP7.0-FPM log_level = debug already setup")
|
||||
|
||||
self.msg = self.msg + ['/var/log/php/7.0/fpm.log']
|
||||
self.msg = self.msg + ['/var/log/php/7.2/fpm.log']
|
||||
|
||||
# PHP5-FPM stop global debug
|
||||
elif (self.app.pargs.fpm7 == 'off' and not self.app.pargs.site_name):
|
||||
if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" "
|
||||
"/etc/php/7.0/fpm/php-fpm.conf"):
|
||||
"/etc/php/7.2/fpm/php-fpm.conf"):
|
||||
Log.info(self, "Disabling PHP7.0-FPM log_level = debug")
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.0/fpm/php-fpm.conf')
|
||||
config.read('/etc/php/7.2/fpm/php-fpm.conf')
|
||||
config.remove_option('global', 'include')
|
||||
config['global']['log_level'] = 'notice'
|
||||
config['global']['include'] = '/etc/php/7.0/fpm/pool.d/*.conf'
|
||||
with open('/etc/php/7.0/fpm/php-fpm.conf',
|
||||
config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf'
|
||||
with open('/etc/php/7.2/fpm/php-fpm.conf',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "writting php7.0 configuration into "
|
||||
"/etc/php/7.0/fpm/php-fpm.conf")
|
||||
"/etc/php/7.2/fpm/php-fpm.conf")
|
||||
config.write(configfile)
|
||||
self.trigger_php = True
|
||||
else:
|
||||
|
||||
@@ -30,7 +30,7 @@ class WOInfoController(CementBaseController):
|
||||
dict(help='Get PHP configuration information',
|
||||
action='store_true')),
|
||||
(['--php7'],
|
||||
dict(help='Get PHP 7.0 configuration information',
|
||||
dict(help='Get PHP 7.2 configuration information',
|
||||
action='store_true')),
|
||||
(['--nginx'],
|
||||
dict(help='Get Nginx configuration information',
|
||||
@@ -143,14 +143,14 @@ class WOInfoController(CementBaseController):
|
||||
version = os.popen("php7.0 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.0/fpm/php.ini')
|
||||
config.read('/etc/php/7.2/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
config.read('/etc/php/7.0/fpm/pool.d/www.conf')
|
||||
config.read('/etc/php/7.2/fpm/pool.d/www.conf')
|
||||
www_listen = config['www']['listen']
|
||||
www_ping_path = config['www']['ping.path']
|
||||
www_pm_status_path = config['www']['pm.status_path']
|
||||
@@ -168,7 +168,7 @@ class WOInfoController(CementBaseController):
|
||||
except Exception as e:
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
|
||||
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
|
||||
@@ -1017,38 +1017,38 @@ class WOStackController(CementBaseController):
|
||||
#PHP7.0 configuration for debian
|
||||
if (WOVariables.wo_platform_codename == 'jessie' ) and set(WOVariables.wo_php7_0).issubset(set(apt_packages)):
|
||||
# Create log directories
|
||||
if not os.path.exists('/var/log/php/7.0/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/7.0/')
|
||||
os.makedirs('/var/log/php/7.0/')
|
||||
if not os.path.exists('/var/log/php/7.2/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/7.2/')
|
||||
os.makedirs('/var/log/php/7.2/')
|
||||
|
||||
# Parse etc/php/7.0/fpm/php.ini
|
||||
# Parse etc/php/7.2/fpm/php.ini
|
||||
config = configparser.ConfigParser()
|
||||
Log.debug(self, "configuring php file /etc/php/7.0/fpm/php.ini")
|
||||
config.read('/etc/php/7.0/fpm/php.ini')
|
||||
Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini")
|
||||
config.read('/etc/php/7.2/fpm/php.ini')
|
||||
config['PHP']['expose_php'] = 'Off'
|
||||
config['PHP']['post_max_size'] = '100M'
|
||||
config['PHP']['upload_max_filesize'] = '100M'
|
||||
config['PHP']['max_execution_time'] = '300'
|
||||
config['PHP']['date.timezone'] = WOVariables.wo_timezone
|
||||
with open('/etc/php/7.0/fpm/php.ini',
|
||||
with open('/etc/php/7.2/fpm/php.ini',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "Writting php configuration into "
|
||||
"/etc/php/7.0/fpm/php.ini")
|
||||
"/etc/php/7.2/fpm/php.ini")
|
||||
config.write(configfile)
|
||||
|
||||
# Parse /etc/php/7.0/fpm/php-fpm.conf
|
||||
# Parse /etc/php/7.2/fpm/php-fpm.conf
|
||||
data = dict(pid="/run/php/php7.0-fpm.pid", error_log="/var/log/php7.0-fpm.log",
|
||||
include="/etc/php/7.0/fpm/pool.d/*.conf")
|
||||
include="/etc/php/7.2/fpm/pool.d/*.conf")
|
||||
Log.debug(self, "writting php 7.0 configuration into "
|
||||
"/etc/php/7.0/fpm/php-fpm.conf")
|
||||
wo_php_fpm = open('/etc/php/7.0/fpm/php-fpm.conf',
|
||||
"/etc/php/7.2/fpm/php-fpm.conf")
|
||||
wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf',
|
||||
encoding='utf-8', mode='w')
|
||||
self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm)
|
||||
wo_php_fpm.close()
|
||||
|
||||
# Parse /etc/php/7.0/fpm/pool.d/www.conf
|
||||
# Parse /etc/php/7.2/fpm/pool.d/www.conf
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
|
||||
config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
|
||||
"r", "utf8"))
|
||||
config['www']['ping.path'] = '/ping'
|
||||
config['www']['pm.status_path'] = '/status'
|
||||
@@ -1060,30 +1060,30 @@ class WOStackController(CementBaseController):
|
||||
config['www']['request_terminate_timeout'] = '300'
|
||||
config['www']['pm'] = 'ondemand'
|
||||
config['www']['listen'] = '127.0.0.1:9070'
|
||||
with codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
|
||||
with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "writting PHP5 configuration into "
|
||||
"/etc/php/7.0/fpm/pool.d/www.conf")
|
||||
"/etc/php/7.2/fpm/pool.d/www.conf")
|
||||
config.write(configfile)
|
||||
|
||||
# Generate /etc/php/7.0/fpm/pool.d/debug.conf
|
||||
WOFileUtils.copyfile(self, "/etc/php/7.0/fpm/pool.d/www.conf",
|
||||
"/etc/php/7.0/fpm/pool.d/debug.conf")
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.0/fpm/pool.d/"
|
||||
# Generate /etc/php/7.2/fpm/pool.d/debug.conf
|
||||
WOFileUtils.copyfile(self, "/etc/php/7.2/fpm/pool.d/www.conf",
|
||||
"/etc/php/7.2/fpm/pool.d/debug.conf")
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.2/fpm/pool.d/"
|
||||
"debug.conf", "[www]", "[debug]")
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
|
||||
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
|
||||
config['debug']['listen'] = '127.0.0.1:9170'
|
||||
config['debug']['rlimit_core'] = 'unlimited'
|
||||
config['debug']['slowlog'] = '/var/log/php/7.0/slow.log'
|
||||
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log'
|
||||
config['debug']['request_slowlog_timeout'] = '10s'
|
||||
with open('/etc/php/7.0/fpm/pool.d/debug.conf',
|
||||
with open('/etc/php/7.2/fpm/pool.d/debug.conf',
|
||||
encoding='utf-8', mode='w') as confifile:
|
||||
Log.debug(self, "writting PHP5 configuration into "
|
||||
"/etc/php/7.0/fpm/pool.d/debug.conf")
|
||||
"/etc/php/7.2/fpm/pool.d/debug.conf")
|
||||
config.write(confifile)
|
||||
|
||||
with open("/etc/php/7.0/fpm/pool.d/debug.conf",
|
||||
with open("/etc/php/7.2/fpm/pool.d/debug.conf",
|
||||
encoding='utf-8', mode='a') as myfile:
|
||||
myfile.write("php_admin_value[xdebug.profiler_output_dir] "
|
||||
"= /tmp/ \nphp_admin_value[xdebug.profiler_"
|
||||
@@ -1093,8 +1093,8 @@ class WOStackController(CementBaseController):
|
||||
"profiler_enable] = off\n")
|
||||
|
||||
# Disable xdebug
|
||||
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.0/mods-available/xdebug.ini"):
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
|
||||
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"):
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
|
||||
"xdebug.ini",
|
||||
"zend_extension",
|
||||
";zend_extension")
|
||||
@@ -1139,38 +1139,38 @@ class WOStackController(CementBaseController):
|
||||
#preconfiguration for php7.0
|
||||
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php7_0).issubset(set(apt_packages)):
|
||||
# Create log directories
|
||||
if not os.path.exists('/var/log/php/7.0/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/7.0/')
|
||||
os.makedirs('/var/log/php/7.0/')
|
||||
if not os.path.exists('/var/log/php/7.2/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/7.2/')
|
||||
os.makedirs('/var/log/php/7.2/')
|
||||
|
||||
# Parse etc/php/7.0/fpm/php.ini
|
||||
# Parse etc/php/7.2/fpm/php.ini
|
||||
config = configparser.ConfigParser()
|
||||
Log.debug(self, "configuring php file /etc/php/7.0/fpm/php.ini")
|
||||
config.read('/etc/php/7.0/fpm/php.ini')
|
||||
Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini")
|
||||
config.read('/etc/php/7.2/fpm/php.ini')
|
||||
config['PHP']['expose_php'] = 'Off'
|
||||
config['PHP']['post_max_size'] = '100M'
|
||||
config['PHP']['upload_max_filesize'] = '100M'
|
||||
config['PHP']['max_execution_time'] = '300'
|
||||
config['PHP']['date.timezone'] = WOVariables.wo_timezone
|
||||
with open('/etc/php/7.0/fpm/php.ini',
|
||||
with open('/etc/php/7.2/fpm/php.ini',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "Writting php configuration into "
|
||||
"/etc/php/7.0/fpm/php.ini")
|
||||
"/etc/php/7.2/fpm/php.ini")
|
||||
config.write(configfile)
|
||||
|
||||
# Parse /etc/php/7.0/fpm/php-fpm.conf
|
||||
data = dict(pid="/run/php/php7.0-fpm.pid", error_log="/var/log/php/7.0/fpm.log",
|
||||
include="/etc/php/7.0/fpm/pool.d/*.conf")
|
||||
# Parse /etc/php/7.2/fpm/php-fpm.conf
|
||||
data = dict(pid="/run/php/php7.0-fpm.pid", error_log="/var/log/php/7.2/fpm.log",
|
||||
include="/etc/php/7.2/fpm/pool.d/*.conf")
|
||||
Log.debug(self, "writting php 7.0 configuration into "
|
||||
"/etc/php/7.0/fpm/php-fpm.conf")
|
||||
wo_php_fpm = open('/etc/php/7.0/fpm/php-fpm.conf',
|
||||
"/etc/php/7.2/fpm/php-fpm.conf")
|
||||
wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf',
|
||||
encoding='utf-8', mode='w')
|
||||
self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm)
|
||||
wo_php_fpm.close()
|
||||
|
||||
# Parse /etc/php/7.0/fpm/pool.d/www.conf
|
||||
# Parse /etc/php/7.2/fpm/pool.d/www.conf
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
|
||||
config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
|
||||
"r", "utf8"))
|
||||
config['www']['ping.path'] = '/ping'
|
||||
config['www']['pm.status_path'] = '/status'
|
||||
@@ -1182,30 +1182,30 @@ class WOStackController(CementBaseController):
|
||||
config['www']['request_terminate_timeout'] = '300'
|
||||
config['www']['pm'] = 'ondemand'
|
||||
config['www']['listen'] = '127.0.0.1:9070'
|
||||
with codecs.open('/etc/php/7.0/fpm/pool.d/www.conf',
|
||||
with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "writting PHP5 configuration into "
|
||||
"/etc/php/7.0/fpm/pool.d/www.conf")
|
||||
"/etc/php/7.2/fpm/pool.d/www.conf")
|
||||
config.write(configfile)
|
||||
|
||||
# Generate /etc/php/7.0/fpm/pool.d/debug.conf
|
||||
WOFileUtils.copyfile(self, "/etc/php/7.0/fpm/pool.d/www.conf",
|
||||
"/etc/php/7.0/fpm/pool.d/debug.conf")
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.0/fpm/pool.d/"
|
||||
# Generate /etc/php/7.2/fpm/pool.d/debug.conf
|
||||
WOFileUtils.copyfile(self, "/etc/php/7.2/fpm/pool.d/www.conf",
|
||||
"/etc/php/7.2/fpm/pool.d/debug.conf")
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.2/fpm/pool.d/"
|
||||
"debug.conf", "[www]", "[debug]")
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.0/fpm/pool.d/debug.conf')
|
||||
config.read('/etc/php/7.2/fpm/pool.d/debug.conf')
|
||||
config['debug']['listen'] = '127.0.0.1:9170'
|
||||
config['debug']['rlimit_core'] = 'unlimited'
|
||||
config['debug']['slowlog'] = '/var/log/php/7.0/slow.log'
|
||||
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log'
|
||||
config['debug']['request_slowlog_timeout'] = '10s'
|
||||
with open('/etc/php/7.0/fpm/pool.d/debug.conf',
|
||||
with open('/etc/php/7.2/fpm/pool.d/debug.conf',
|
||||
encoding='utf-8', mode='w') as confifile:
|
||||
Log.debug(self, "writting PHP5 configuration into "
|
||||
"/etc/php/7.0/fpm/pool.d/debug.conf")
|
||||
"/etc/php/7.2/fpm/pool.d/debug.conf")
|
||||
config.write(confifile)
|
||||
|
||||
with open("/etc/php/7.0/fpm/pool.d/debug.conf",
|
||||
with open("/etc/php/7.2/fpm/pool.d/debug.conf",
|
||||
encoding='utf-8', mode='a') as myfile:
|
||||
myfile.write("php_admin_value[xdebug.profiler_output_dir] "
|
||||
"= /tmp/ \nphp_admin_value[xdebug.profiler_"
|
||||
@@ -1215,8 +1215,8 @@ class WOStackController(CementBaseController):
|
||||
"profiler_enable] = off\n")
|
||||
|
||||
# Disable xdebug
|
||||
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.0/mods-available/xdebug.ini"):
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.0/mods-available/"
|
||||
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"):
|
||||
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/"
|
||||
"xdebug.ini",
|
||||
"zend_extension",
|
||||
";zend_extension")
|
||||
@@ -2044,4 +2044,4 @@ def load(app):
|
||||
handler.register(WOStackUpgradeController)
|
||||
|
||||
# register a hook (function) to run after arguments are parsed.
|
||||
hook.register('post_argument_parsing', wo_stack_hook)
|
||||
hook.register('post_argument_parsing', wo_stack_hook)
|
||||
@@ -40,9 +40,6 @@ class WOStackUpgradeController(CementBaseController):
|
||||
dict(help='Upgrade WPCLI', action='store_true')),
|
||||
(['--redis'],
|
||||
dict(help='Upgrade Redis', action='store_true')),
|
||||
(['--php56'],
|
||||
dict(help="Upgrade to PHP5.6 from PHP5.5",
|
||||
action='store_true')),
|
||||
(['--no-prompt'],
|
||||
dict(help="Upgrade Packages without any prompt",
|
||||
action='store_true')),
|
||||
@@ -72,162 +69,123 @@ class WOStackUpgradeController(CementBaseController):
|
||||
if WOVariables.wo_platform_distro == "ubuntu":
|
||||
WORepo.remove(self, ppa="ppa:ondrej/php5")
|
||||
WORepo.add(self, ppa=WOVariables.wo_php_repo)
|
||||
else:
|
||||
WOAptGet.remove(self, ["php5-xdebug"])
|
||||
WOFileUtils.searchreplace(self, WOVariables.wo_repo_file_path,
|
||||
"php55", "php56")
|
||||
|
||||
Log.info(self, "Updating apt-cache, please wait...")
|
||||
WOAptGet.update(self)
|
||||
Log.info(self, "Installing packages, please wait ...")
|
||||
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
|
||||
WOAptGet.install(self, WOVariables.wo_php5_6 + WOVariables.wo_php_extra)
|
||||
WOAptGet.install(self, WOVariables.wo_php + WOVariables.wo_php_extra)
|
||||
else:
|
||||
WOAptGet.install(self, WOVariables.wo_php)
|
||||
|
||||
if WOVariables.wo_platform_distro == "debian":
|
||||
WOShellExec.cmd_exec(self, "pecl install xdebug")
|
||||
|
||||
with open("/etc/php5/mods-available/xdebug.ini",
|
||||
encoding='utf-8', mode='a') as myfile:
|
||||
myfile.write(";zend_extension=/usr/lib/php5/20131226/"
|
||||
"xdebug.so\n")
|
||||
|
||||
WOFileUtils.create_symlink(self, ["/etc/php5/mods-available/"
|
||||
"xdebug.ini", "/etc/php5/fpm/conf.d"
|
||||
"/20-xedbug.ini"])
|
||||
|
||||
Log.info(self, "Successfully upgraded from PHP 5.5 to PHP 5.6")
|
||||
|
||||
@expose(hide=True)
|
||||
def default(self):
|
||||
# All package update
|
||||
if ((not self.app.pargs.php56)):
|
||||
apt_packages = []
|
||||
packages = []
|
||||
|
||||
apt_packages = []
|
||||
packages = []
|
||||
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and
|
||||
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
|
||||
(not self.app.pargs.hhvm) and (not self.app.pargs.all) and
|
||||
(not self.app.pargs.wpcli) and (not self.app.pargs.redis) and
|
||||
(not self.app.pargs.nginxmainline)):
|
||||
self.app.pargs.web = True
|
||||
|
||||
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and
|
||||
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
|
||||
(not self.app.pargs.hhvm) and (not self.app.pargs.all) and
|
||||
(not self.app.pargs.wpcli) and (not self.app.pargs.redis) and
|
||||
(not self.app.pargs.nginxmainline)):
|
||||
self.app.pargs.web = True
|
||||
if self.app.pargs.all:
|
||||
self.app.pargs.web = True
|
||||
|
||||
if self.app.pargs.all:
|
||||
self.app.pargs.web = True
|
||||
if self.app.pargs.web:
|
||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||
self.app.pargs.nginx = True
|
||||
else:
|
||||
Log.info(self, "Nginx is not already installed")
|
||||
self.app.pargs.php = True
|
||||
self.app.pargs.mysql = True
|
||||
self.app.pargs.wpcli = True
|
||||
|
||||
if self.app.pargs.web:
|
||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||
self.app.pargs.nginx = True
|
||||
else:
|
||||
Log.info(self, "Nginx is not already installed")
|
||||
self.app.pargs.php = True
|
||||
self.app.pargs.mysql = True
|
||||
self.app.pargs.wpcli = True
|
||||
if self.app.pargs.nginx :
|
||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
||||
else:
|
||||
Log.info(self, "Nginx Stable is not already installed")
|
||||
|
||||
if self.app.pargs.nginx :
|
||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||
apt_packages = apt_packages + WOVariables.wo_nginx
|
||||
else:
|
||||
Log.info(self, "Nginx Stable is not already installed")
|
||||
if self.app.pargs.php:
|
||||
if WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
|
||||
else:
|
||||
Log.info(self, "PHP 7.2 is not installed")
|
||||
|
||||
if self.app.pargs.php:
|
||||
if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'):
|
||||
if WOAptGet.is_installed(self, 'php5-fpm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_php
|
||||
else:
|
||||
Log.info(self, "PHP is not installed")
|
||||
if WOAptGet.is_installed(self, 'php7.0-fpm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_php7_0
|
||||
else:
|
||||
if WOAptGet.is_installed(self, 'php5.6-fpm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_php5_6 + WOVariables.wo_php_extra
|
||||
else:
|
||||
Log.info(self, "PHP 5.6 is not installed")
|
||||
if WOAptGet.is_installed(self, 'php7.0-fpm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_php7_0 + WOVariables.wo_php_extra
|
||||
else:
|
||||
Log.info(self, "PHP 7.0 is not installed")
|
||||
if self.app.pargs.hhvm:
|
||||
if WOAptGet.is_installed(self, 'hhvm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_hhvm
|
||||
else:
|
||||
Log.info(self, "HHVM is not installed")
|
||||
|
||||
if self.app.pargs.hhvm:
|
||||
if WOAptGet.is_installed(self, 'hhvm'):
|
||||
apt_packages = apt_packages + WOVariables.wo_hhvm
|
||||
else:
|
||||
Log.info(self, "HHVM is not installed")
|
||||
if self.app.pargs.mysql:
|
||||
if WOAptGet.is_installed(self, 'mariadb-server'):
|
||||
apt_packages = apt_packages + WOVariables.wo_mysql
|
||||
else:
|
||||
Log.info(self, "MariaDB is not installed")
|
||||
|
||||
if self.app.pargs.mysql:
|
||||
if WOAptGet.is_installed(self, 'mariadb-server'):
|
||||
apt_packages = apt_packages + WOVariables.wo_mysql
|
||||
else:
|
||||
Log.info(self, "MariaDB is not installed")
|
||||
if self.app.pargs.redis:
|
||||
if WOAptGet.is_installed(self, 'redis-server'):
|
||||
apt_packages = apt_packages + WOVariables.wo_redis
|
||||
else:
|
||||
Log.info(self, "Redis is not installed")
|
||||
|
||||
if self.app.pargs.redis:
|
||||
if WOAptGet.is_installed(self, 'redis-server'):
|
||||
apt_packages = apt_packages + WOVariables.wo_redis
|
||||
else:
|
||||
Log.info(self, "Redis is not installed")
|
||||
if self.app.pargs.wpcli:
|
||||
if os.path.isfile('/usr/bin/wp'):
|
||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
||||
"releases/download/v{0}/"
|
||||
"wp-cli-{0}.phar"
|
||||
"".format(WOVariables.wo_wp_cli),
|
||||
"/usr/bin/wp",
|
||||
"WP-CLI"]]
|
||||
else:
|
||||
Log.info(self, "WPCLI is not installed with WordOps")
|
||||
|
||||
if self.app.pargs.wpcli:
|
||||
if os.path.isfile('/usr/bin/wp'):
|
||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
||||
"releases/download/v{0}/"
|
||||
"wp-cli-{0}.phar"
|
||||
"".format(WOVariables.wo_wp_cli),
|
||||
"/usr/bin/wp",
|
||||
"WP-CLI"]]
|
||||
else:
|
||||
Log.info(self, "WPCLI is not installed with WordOps")
|
||||
if len(packages) or len(apt_packages):
|
||||
|
||||
if len(packages) or len(apt_packages):
|
||||
Log.info(self, "During package update process non nginx-cached"
|
||||
" parts of your site may remain down")
|
||||
# Check prompt
|
||||
if (not self.app.pargs.no_prompt):
|
||||
start_upgrade = input("Do you want to continue:[y/N]")
|
||||
if start_upgrade != "Y" and start_upgrade != "y":
|
||||
Log.error(self, "Not starting package update")
|
||||
|
||||
Log.info(self, "During package update process non nginx-cached"
|
||||
" parts of your site may remain down")
|
||||
# Check prompt
|
||||
if (not self.app.pargs.no_prompt):
|
||||
start_upgrade = input("Do you want to continue:[y/N]")
|
||||
if start_upgrade != "Y" and start_upgrade != "y":
|
||||
Log.error(self, "Not starting package update")
|
||||
Log.info(self, "Updating packages, please wait...")
|
||||
if len(apt_packages):
|
||||
# apt-get update
|
||||
WOAptGet.update(self)
|
||||
# Update packages
|
||||
WOAptGet.install(self, apt_packages)
|
||||
|
||||
Log.info(self, "Updating packages, please wait...")
|
||||
if len(apt_packages):
|
||||
# apt-get update
|
||||
WOAptGet.update(self)
|
||||
# Update packages
|
||||
WOAptGet.install(self, apt_packages)
|
||||
# Post Actions after package updates
|
||||
if (set(WOVariables.wo_nginx).issubset(set(apt_packages))):
|
||||
WOService.restart_service(self, 'nginx')
|
||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'php7.2-fpm')
|
||||
if set(WOVariables.wo_hhvm).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'hhvm')
|
||||
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'mysql')
|
||||
if set(WOVariables.wo_redis).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'redis-server')
|
||||
|
||||
# Post Actions after package updates
|
||||
if (set(WOVariables.wo_nginx).issubset(set(apt_packages))):
|
||||
WOService.restart_service(self, 'nginx')
|
||||
if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'):
|
||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'php5-fpm')
|
||||
else:
|
||||
if set(WOVariables.wo_php5_6).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'php5.6-fpm')
|
||||
if set(WOVariables.wo_php7_0).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'php7.0-fpm')
|
||||
if set(WOVariables.wo_hhvm).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'hhvm')
|
||||
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'mysql')
|
||||
if set(WOVariables.wo_redis).issubset(set(apt_packages)):
|
||||
WOService.restart_service(self, 'redis-server')
|
||||
if len(packages):
|
||||
if self.app.pargs.wpcli:
|
||||
WOFileUtils.remove(self,['/usr/bin/wp'])
|
||||
|
||||
if len(packages):
|
||||
if self.app.pargs.wpcli:
|
||||
WOFileUtils.remove(self,['/usr/bin/wp'])
|
||||
Log.debug(self, "Downloading following: {0}".format(packages))
|
||||
WODownload.download(self, packages)
|
||||
|
||||
Log.debug(self, "Downloading following: {0}".format(packages))
|
||||
WODownload.download(self, packages)
|
||||
if self.app.pargs.wpcli:
|
||||
WOFileUtils.chmod(self, "/usr/bin/wp", 0o775)
|
||||
|
||||
if self.app.pargs.wpcli:
|
||||
WOFileUtils.chmod(self, "/usr/bin/wp", 0o775)
|
||||
|
||||
Log.info(self, "Successfully updated packages")
|
||||
|
||||
# PHP 5.6 to 5.6
|
||||
elif (self.app.pargs.php56):
|
||||
self.upgrade_php56()
|
||||
Log.info(self, "Successfully updated packages")
|
||||
else:
|
||||
self.app.args.print_help()
|
||||
|
||||
@@ -12,7 +12,7 @@ class WOVariables():
|
||||
"""Intialization of core variables"""
|
||||
|
||||
# WordOps version
|
||||
wo_version = "3.9.0"
|
||||
wo_version = "3.8.5"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.0.1"
|
||||
wo_adminer = "4.6.3"
|
||||
@@ -81,9 +81,6 @@ class WOVariables():
|
||||
|
||||
# WordOps stack installation variables
|
||||
# Nginx repo and packages
|
||||
if wo_platform_codename == 'precise':
|
||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||
"/rtCamp:/EasyEngine/xUbuntu_12.04/ /")
|
||||
elif wo_platform_codename == 'trusty':
|
||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||
"/rtCamp:/EasyEngine/xUbuntu_14.04/ /")
|
||||
@@ -93,69 +90,36 @@ class WOVariables():
|
||||
elif wo_platform_codename == 'bionic':
|
||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||
"/rtCamp:/EasyEngine/xUbuntu_18.04/ /")
|
||||
elif wo_platform_codename == 'whwozy':
|
||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||
"/rtCamp:/EasyEngine/Debian_7.0/ /")
|
||||
elif wo_platform_codename == 'jessie':
|
||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||
"/rtCamp:/EasyEngine/Debian_8.0/ /")
|
||||
|
||||
elif wo_platform_codename == 'stretch':
|
||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||
"/rtCamp:/EasyEngine/Debian_8.0/ /")
|
||||
|
||||
wo_nginx = ["nginx-custom", "nginx-ee"]
|
||||
wo_nginx_key = '3050AC3CD2AE6F03'
|
||||
|
||||
# PHP repo and packages
|
||||
if wo_platform_distro == 'ubuntu':
|
||||
if wo_platform_codename == 'precise':
|
||||
wo_php_repo = "ppa:ondrej/php5-5.6"
|
||||
wo_php = ["php5-fpm", "php5-curl", "php5-gd", "php5-imap",
|
||||
"php5-mcrypt", "php5-common", "php5-readline",
|
||||
"php5-mysql", "php5-cli", "php5-memcache", "php5-imagick",
|
||||
"memcached", "graphviz", "php-pear"]
|
||||
elif (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'):
|
||||
if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'):
|
||||
wo_php_repo = "ppa:ondrej/php"
|
||||
# PHP5.6 for those who like to live on the dangerous side
|
||||
wo_php5_6 = ["php5.6-fpm", "php5.6-curl", "php5.6-gd", "php5.6-imap",
|
||||
"php5.6-mcrypt", "php5.6-readline", "php5.6-common", "php5.6-recode",
|
||||
"php5.6-mysql", "php5.6-cli", "php5.6-curl", "php5.6-mbstring",
|
||||
"php5.6-bcmath", "php5.6-mysql", "php5.6-opcache", "php5.6-zip", "php5.6-xml", "php5.6-soap"]
|
||||
# PHP7.0 going EOL soon
|
||||
wo_php7_0 = ["php7.0-fpm", "php7.0-curl", "php7.0-gd", "php7.0-imap",
|
||||
"php7.0-mcrypt", "php7.0-readline", "php7.0-common", "php7.0-recode",
|
||||
"php7.0-cli", "php7.0-mbstring",
|
||||
"php7.0-bcmath", "php7.0-mysql", "php7.0-opcache", "php7.0-zip", "php7.0-xml", "php7.0-soap"]
|
||||
wo_php7_2 = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
||||
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
||||
"php7.2-readline", "php7.2-common", "php7.2-recode",
|
||||
"php7.2-cli", "php7.2-mbstring",
|
||||
"php7.2-bcmath", "php7.2-mysql", "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-soap"]
|
||||
wo_php_extra = ["php-memcached", "php-imagick", "php-memcache", "memcached",
|
||||
"graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"]
|
||||
elif wo_platform_distro == 'debian':
|
||||
if wo_platform_codename == 'wheezy':
|
||||
wo_php_repo = ("deb http://packages.dotdeb.org {codename}-php56 all"
|
||||
.format(codename=wo_platform_codename))
|
||||
else :
|
||||
wo_php_repo = ("deb http://packages.dotdeb.org {codename} all".format(codename=wo_platform_codename))
|
||||
|
||||
wo_php = ["php5-fpm", "php5-curl", "php5-gd", "php5-imap",
|
||||
"php5-mcrypt", "php5-common", "php5-readline",
|
||||
"php5-mysqlnd", "php5-cli", "php5-memcache", "php5-imagick",
|
||||
"memcached", "graphviz", "php-pear"]
|
||||
|
||||
wo_php7_0 = ["php7.0-fpm", "php7.0-curl", "php7.0-gd", "php7.0-imap",
|
||||
"php7.0-mcrypt", "php7.0-common", "php7.0-readline", "php7.0-redis",
|
||||
"php7.0-mysql", "php7.0-cli", "php7.0-memcache", "php7.0-imagick",
|
||||
"php7.0-mbstring", "php7.0-recode", "php7.0-bcmath", "php7.0-opcache", "php7.0-zip", "php7.0-xml",
|
||||
"php7.0-soap", "php7.0-msgpack",
|
||||
"memcached", "graphviz", "php-pear", "php7.0-xdebug"]
|
||||
wo_php_repo = ("deb http://packages.dotdeb.org {codename} all".format(codename=wo_platform_codename))
|
||||
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
||||
"php7.2-mcrypt", "php7.2-common", "php7.2-readline", "php7.2-redis",
|
||||
"php7.2-mysql", "php7.2-cli", "php7.2-memcache", "php7.2-imagick",
|
||||
"php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml",
|
||||
"php7.2-soap", "php7.2-msgpack",
|
||||
"memcached", "graphviz", "php-pear", "php7.2-xdebug"]
|
||||
wo_php_extra = []
|
||||
|
||||
if wo_platform_codename == 'wheezy':
|
||||
wo_php = wo_php + ["php5-dev"]
|
||||
|
||||
if wo_platform_codename == 'precise' or wo_platform_codename == 'jessie':
|
||||
wo_php = wo_php + ["php5-xdebug"]
|
||||
|
||||
# MySQL repo and packages
|
||||
if wo_platform_distro == 'ubuntu':
|
||||
wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
||||
@@ -170,11 +134,7 @@ class WOVariables():
|
||||
|
||||
# HHVM repo details
|
||||
if wo_platform_distro == 'ubuntu':
|
||||
if wo_platform_codename == "precise":
|
||||
wo_boost_repo = ("ppa:mapnik/boost")
|
||||
wo_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main"
|
||||
.format(codename=wo_platform_codename))
|
||||
elif wo_platform_codename == "trusty" or wo_platform_codename == "xenial" or wo_platform_codename == "bionic":
|
||||
if wo_platform_codename == "trusty" or wo_platform_codename == "xenial" or wo_platform_codename == "bionic":
|
||||
wo_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main"
|
||||
.format(codename=wo_platform_codename))
|
||||
else:
|
||||
@@ -192,9 +152,7 @@ class WOVariables():
|
||||
.format(codename=wo_platform_codename))
|
||||
|
||||
if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'):
|
||||
wo_redis = ['redis-server', 'php-redis']
|
||||
else:
|
||||
wo_redis = ['redis-server', 'php5-redis']
|
||||
wo_redis = ['redis-server', 'php7.2-redis']
|
||||
|
||||
# Repo path
|
||||
wo_repo_file = "wo-repo.list"
|
||||
|
||||
Reference in New Issue
Block a user