Almost there, don't use this yet

This commit is contained in:
jeroenlaylo
2018-11-30 19:33:29 +01:00
parent 56fe3433db
commit 6aab6373b5
7 changed files with 122 additions and 129 deletions

View File

@@ -29,7 +29,7 @@ _wo_complete()
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE # IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
"debug") "debug")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --nginx --php --php7 --fpm --fpm7 --mysql -i --interactive --all --import-slow-log --import-slow-log-interval= --nginx=off --php=off --php7=off --fpm=off --fpm7=off --mysql=off --all=off " \ -W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --nginx --php --php72 --fpm --fpm7 --mysql -i --interactive --all --import-slow-log --import-slow-log-interval= --nginx=off --php=off --php72=off --fpm=off --fpm7=off --mysql=off --all=off " \
-- $cur) ) -- $cur) )
;; ;;
@@ -53,7 +53,7 @@ _wo_complete()
"info") "info")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--mysql --php --php7 --nginx" \ -W "--mysql --php --php72 --nginx" \
-- $cur) ) -- $cur) )
;; ;;
@@ -74,17 +74,17 @@ _wo_complete()
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE # HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE
"install" | "purge" | "remove" ) "install" | "purge" | "remove" )
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--web --admin --nginx --php --php7 --mysql --wpcli --phpmyadmin --adminer --utils --all --hhvm --redis --phpredisadmin" \ -W "--web --admin --nginx --php --php72 --mysql --wpcli --phpmyadmin --adminer --utils --all --hhvm --redis --phpredisadmin" \
-- $cur) ) -- $cur) )
;; ;;
"upgrade" ) "upgrade" )
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--web --nginx --php --php7 --mysql --all --hhvm --php56 --no-prompt --wpcli" \ -W "--web --nginx --php --php72 --mysql --all --hhvm --php56 --no-prompt --wpcli" \
-- $cur) ) -- $cur) )
;; ;;
"start" | "stop" | "reload" | "restart" | "status") "start" | "stop" | "reload" | "restart" | "status")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--nginx --php --php7 --mysql --memcache --redis" \ -W "--nginx --php --php72 --mysql --memcache --redis" \
-- $cur) ) -- $cur) )
;; ;;
"migrate") "migrate")
@@ -136,7 +136,7 @@ _wo_complete()
;; ;;
esac esac
if [ ${COMP_WORDS[1]} == "debug" ] && ([ "$prev" != "--start" ] && [ "$prev" != "--nginx" ] && [ "$prev" != "--php" ] && [ "$prev" != "--php7" ] && [ "$prev" != "--fpm" ] && [ "$prev" != "--fpm7" ] && [ "$prev" != "--mysql" ] && [ "$prev" != "-i" ] && [ "$prev" != "--interactive" ] && [ "$prev" != "--import-slow-log" ] && [ "$prev" != "--stop" ]); then if [ ${COMP_WORDS[1]} == "debug" ] && ([ "$prev" != "--start" ] && [ "$prev" != "--nginx" ] && [ "$prev" != "--php" ] && [ "$prev" != "--php72" ] && [ "$prev" != "--fpm" ] && [ "$prev" != "--fpm7" ] && [ "$prev" != "--mysql" ] && [ "$prev" != "-i" ] && [ "$prev" != "--interactive" ] && [ "$prev" != "--import-slow-log" ] && [ "$prev" != "--stop" ]); then
retlist="--all --wp --rewrite -i --all=off --wp=off --rewrite=off" retlist="--all --wp --rewrite -i --all=off --wp=off --rewrite=off"
ret="${retlist[@]/$prev}" ret="${retlist[@]/$prev}"
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
@@ -159,13 +159,13 @@ _wo_complete()
"create") "create")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--user --pass --email --html --php --php7 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --proxy= --wpredis --letsencrypt -le" \ -W "--user --pass --email --html --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --proxy= --wpredis --letsencrypt -le" \
-- $cur) ) -- $cur) )
;; ;;
"update") "update")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--password --php --php7 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" \ -W "--password --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" \
-- $cur) ) -- $cur) )
;; ;;
"delete") "delete")
@@ -211,9 +211,9 @@ _wo_complete()
"--wp") "--wp")
if [ ${COMP_WORDS[1]} != "debug" ]; then if [ ${COMP_WORDS[1]} != "debug" ]; then
if [ ${COMP_WORDS[2]} == "create" ]; then if [ ${COMP_WORDS[2]} == "create" ]; then
retlist="--wp --wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php7" retlist="--wp --wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php72"
elif [ ${COMP_WORDS[2]} == "update" ]; then elif [ ${COMP_WORDS[2]} == "update" ]; then
retlist="--wp --wpfc --wpsc --php7 --php7=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" retlist="--wp --wpfc --wpsc --php72 --php72=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew"
else else
retlist="" retlist=""
fi fi
@@ -230,9 +230,9 @@ _wo_complete()
"--wpsubdir" | "--wpsubdomain") "--wpsubdir" | "--wpsubdomain")
if [ ${COMP_WORDS[1]} != "debug" ]; then if [ ${COMP_WORDS[1]} != "debug" ]; then
if [ ${COMP_WORDS[2]} == "create" ]; then if [ ${COMP_WORDS[2]} == "create" ]; then
retlist="--wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php7" retlist="--wpsc --wpfc --hhvm --user --email --pass --wpredis --letsencrypt --php72"
elif [ ${COMP_WORDS[2]} == "update" ]; then elif [ ${COMP_WORDS[2]} == "update" ]; then
retlist="--wpfc --wpsc --php7 --php7=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" retlist="--wpfc --wpsc --php72 --php72=off --hhvm --hhvm=off --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew"
else else
retlist="" retlist=""
fi fi
@@ -248,7 +248,7 @@ _wo_complete()
"--hhvm" | "--wpredis" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp") "--hhvm" | "--wpredis" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp")
if [ ${COMP_WORDS[2]} == "create" ]; then if [ ${COMP_WORDS[2]} == "create" ]; then
retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --experimenal --wpredis --php7 --letsencrypt " retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --experimenal --wpredis --php72 --letsencrypt "
else else
retlist="" retlist=""
fi fi
@@ -261,7 +261,7 @@ _wo_complete()
"--hhvm" | "--wpredis" | "--wpfc") "--hhvm" | "--wpredis" | "--wpfc")
if [ ${COMP_WORDS[2]} == "update" ]; then if [ ${COMP_WORDS[2]} == "update" ]; then
retlist="--password --php --php7 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --experimenal --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew" retlist="--password --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --hhvm=off --experimenal --wpredis --letsencrypt --letsencrypt=off --letsencrypt=renew"
else else
retlist="" retlist=""
fi fi
@@ -272,15 +272,15 @@ _wo_complete()
-- $cur) ) -- $cur) )
;; ;;
"--web" | "--admin" | "--nginx" | "--php" | "--php7" | "--mysql" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--redis | --phpredisadmin") "--web" | "--admin" | "--nginx" | "--php" | "--php72" | "--mysql" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--redis | --phpredisadmin")
if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then
retlist="--web --admin --nginx --php --php7 --mysql--wpcli --phpmyadmin --adminer --utils --memcache --redis --phpredisadmin" retlist="--web --admin --nginx --php --php72 --mysql--wpcli --phpmyadmin --adminer --utils --memcache --redis --phpredisadmin"
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then
retlist="--nginx --php --php7 --mysql --memcache --redis" retlist="--nginx --php --php72 --mysql --memcache --redis"
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then elif [[ ${COMP_WORDS[1]} == "debug" ]]; then
retlist="--start --nginx --php --php7 --fpm --fpm7 --mysql -i --interactive -stop --import-slow-log --import-slow-log-interval= -" retlist="--start --nginx --php --php72 --fpm --fpm7 --mysql -i --interactive -stop --import-slow-log --import-slow-log-interval= -"
if [[ $prev == '--mysql' ]]; then if [[ $prev == '--mysql' ]]; then
retlist="--start --nginx --php --php7 --fpm --fpm7 --mysql -i --interactive --stop --import-slow-log" retlist="--start --nginx --php --php72 --fpm --fpm7 --mysql -i --interactive --stop --import-slow-log"
fi fi
elif [[ ${COMP_WORDS[1]} == "log" ]]; then elif [[ ${COMP_WORDS[1]} == "log" ]]; then
if [ ${COMP_WORDS[2]} == "show" ]; then if [ ${COMP_WORDS[2]} == "show" ]; then
@@ -363,7 +363,7 @@ _wo_complete()
case "$mprev" in case "$mprev" in
"--user" | "--email" | "--pass") "--user" | "--email" | "--pass")
if [ ${COMP_WORDS[2]} == "create" ]; then if [ ${COMP_WORDS[2]} == "create" ]; then
retlist="--user --pass --email --html --php --php7 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --wpredis --letsencrypt" retlist="--user --pass --email --html --php --php72 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --hhvm --wpredis --letsencrypt"
fi fi
ret="${retlist[@]/$prev}" ret="${retlist[@]/$prev}"
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \

View File

@@ -5,15 +5,15 @@
.SH SYNOPSIS .SH SYNOPSIS
wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync] wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync]
.TP .TP
wo stack [ install | remove | purge | migrate | upgrade] [ --web | --mail | --all | --nginx | --php | --php7 | --mysql | --admin | --postfix | --mailscanner | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ] wo stack [ install | remove | purge | migrate | upgrade] [ --web | --mail | --all | --nginx | --php | --php72 | --mysql | --admin | --postfix | --mailscanner | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ]
.TP .TP
wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php7 |--mysql | --devcot | --web | --postfix | --memcache | --redis] wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php72 |--mysql | --devcot | --web | --postfix | --memcache | --redis]
.TP .TP
wo site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ] wo site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ]
.TP .TP
wo site create example.com [ --html | --php | --php7 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --letsencrypt/-le]] wo site create example.com [ --html | --php | --php72 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --letsencrypt/-le]]
.TP .TP
wo site update example.com [ --php | --php7 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password] [--letsencrypt=on/off/renew]] wo site update example.com [ --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password] [--letsencrypt=on/off/renew]]
.TP .TP
wo site delete example.com [--db | --files | --all | --no-prompt | --force/-f ] wo site delete example.com [--db | --files | --all | --no-prompt | --force/-f ]
.TP .TP
@@ -46,19 +46,19 @@ Display WordOps (wo) help.
.TP .TP
.B stack .B stack
.TP .TP
.B install [ --all | --web | --mail | --nginx | --php | --php7 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .B install [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ]
.br .br
Install Nginx PHP5 MySQL Postfix stack Packages if not used with Install Nginx PHP5 MySQL Postfix stack Packages if not used with
.br .br
any options.Installs specific package if used with option. any options.Installs specific package if used with option.
.TP .TP
.B remove [ --all | --web | --mail | --nginx | --php | --php7 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .B remove [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ]
.br .br
Remove Nginx PHP5 MySQL Postfix stack Packages if not used with Remove Nginx PHP5 MySQL Postfix stack Packages if not used with
.br .br
any options. Remove specific package if used with option. any options. Remove specific package if used with option.
.TP .TP
.B purge [ --all | --web | --mail | --nginx | --php | --php7 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .B purge [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ]
.br .br
Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any
.br .br
@@ -129,13 +129,13 @@ Disable site by Destroying softlink with site file in
.br .br
Edit NGINX configuration of site. Edit NGINX configuration of site.
.TP .TP
.B create [ example.com ] [ --html | --php | --php7 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ]] .B create [ example.com ] [ --html | --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ]]
.br .br
Create new site according to given options. If no options provided Create new site according to given options. If no options provided
.br .br
create static site with html only. create static site with html only.
.TP .TP
.B update [ example.com ] [ --html | --php | --php7 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password]] .B update [ example.com ] [ --html | --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password]]
.br .br
Update site configuration according to specified options. Update site configuration according to specified options.
.TP .TP
@@ -143,7 +143,7 @@ Update site configuration according to specified options.
.br .br
Delete site i.e webroot, database, ad configuration permanently. Delete site i.e webroot, database, ad configuration permanently.
.TP .TP
.B debug [ -i | --nginx=on/off | --php=on/off | --php7=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off | --fpm7=on/off ] .B debug [ -i | --nginx=on/off | --php=on/off | --php72=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off | --fpm7=on/off ]
.br .br
Starts server level debugging. If this is used without arguments it will start debugging Starts server level debugging. If this is used without arguments it will start debugging
.br .br
@@ -182,9 +182,9 @@ used with wo debug command. used to start or stop nginx debugging.
.br .br
used with wo debug command. used to start or stop php debugging. used with wo debug command. used to start or stop php debugging.
.TP .TP
.B --php7=on/off .B --php72=on/off
.br .br
used with wo debug command. used to start or stop php7 debugging. used with wo debug command. used to start or stop php72 debugging.
.TP .TP
.B --mysql=on/off .B --mysql=on/off
.br .br

View File

@@ -29,7 +29,7 @@ class WOInfoController(CementBaseController):
(['--php'], (['--php'],
dict(help='Get PHP configuration information', dict(help='Get PHP configuration information',
action='store_true')), action='store_true')),
(['--php7'], (['--php72'],
dict(help='Get PHP 7.2 configuration information', dict(help='Get PHP 7.2 configuration information',
action='store_true')), action='store_true')),
(['--nginx'], (['--nginx'],
@@ -138,7 +138,7 @@ class WOInfoController(CementBaseController):
self.app.render((data), 'info_php.mustache') self.app.render((data), 'info_php.mustache')
@expose(hide=True) @expose(hide=True)
def info_php7(self): def info_php72(self):
"""Display PHP information""" """Display PHP information"""
version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |"
" cut -d'+' -f1 | tr -d '\n'").read " cut -d'+' -f1 | tr -d '\n'").read
@@ -243,7 +243,7 @@ class WOInfoController(CementBaseController):
def default(self): def default(self):
"""default function for info""" """default function for info"""
if (not self.app.pargs.nginx and not self.app.pargs.php if (not self.app.pargs.nginx and not self.app.pargs.php
and not self.app.pargs.mysql and not self.app.pargs.php7): and not self.app.pargs.mysql and not self.app.pargs.php72):
self.app.pargs.nginx = True self.app.pargs.nginx = True
self.app.pargs.php = True self.app.pargs.php = True
self.app.pargs.mysql = True self.app.pargs.mysql = True
@@ -268,9 +268,9 @@ class WOInfoController(CementBaseController):
else: else:
Log.error(self, "PHP5.6 is not installed") Log.error(self, "PHP5.6 is not installed")
if self.app.pargs.php7: if self.app.pargs.php72:
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.2-fpm'):
self.info_php7() self.info_php72()
else: else:
Log.error(self, "PHP 7.2 is not installed") Log.error(self, "PHP 7.2 is not installed")

View File

@@ -309,8 +309,8 @@ class WOSiteCreateController(CementBaseController):
dict(help="create html site", action='store_true')), dict(help="create html site", action='store_true')),
(['--php'], (['--php'],
dict(help="create php site", action='store_true')), dict(help="create php site", action='store_true')),
(['--php7'], (['--php72'],
dict(help="create php 7.0 site", action='store_true')), dict(help="create php 7.2 site", action='store_true')),
(['--mysql'], (['--mysql'],
dict(help="create mysql site", action='store_true')), dict(help="create mysql site", action='store_true')),
(['--wp'], (['--wp'],
@@ -410,16 +410,16 @@ class WOSiteCreateController(CementBaseController):
data['port'] = port data['port'] = port
wo_site_webroot = "" wo_site_webroot = ""
if self.app.pargs.php7: if self.app.pargs.php72:
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=False, php7=True, wp=False, static=False, basic=False, php72=True, wp=False,
wpfc=False, wpsc=False, multisite=False, wpfc=False, wpsc=False, multisite=False,
wpsubdir=False, webroot=wo_site_webroot) wpsubdir=False, webroot=wo_site_webroot)
data['basic'] = True data['basic'] = True
if stype in ['html', 'php' ]: if stype in ['html', 'php' ]:
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
static=True, basic=False, php7=False, wp=False, static=True, basic=False, php72=False, wp=False,
wpfc=False, wpsc=False, multisite=False, wpfc=False, wpsc=False, multisite=False,
wpsubdir=False, webroot=wo_site_webroot) wpsubdir=False, webroot=wo_site_webroot)
@@ -453,27 +453,27 @@ class WOSiteCreateController(CementBaseController):
if stype == "html" and self.app.pargs.hhvm: if stype == "html" and self.app.pargs.hhvm:
Log.error(self, "Can not create HTML site with HHVM") Log.error(self, "Can not create HTML site with HHVM")
if data and self.app.pargs.php7: if data and self.app.pargs.php72:
if (not self.app.pargs.experimental): if (not self.app.pargs.experimental):
Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain))
# Check prompt # Check prompt
check_prompt = input("Type \"y\" to continue [n]:") check_prompt = input("Type \"y\" to continue [n]:")
if check_prompt != "Y" and check_prompt != "y": if check_prompt != "Y" and check_prompt != "y":
Log.info(self, "Not using PHP 7.0 for site.") Log.info(self, "Not using PHP 7.2 for site.")
data['php7'] = False data['php72'] = False
data['basic'] = True data['basic'] = True
php7 = 0 php72 = 0
self.app.pargs.php7 = False self.app.pargs.php72 = False
else: else:
data['php7'] = True data['php72'] = True
php7 = 1 php72 = 1
else: else:
data['php7'] = True data['php72'] = True
php7 = 1 php72 = 1
elif data: elif data:
data['php7'] = False data['php72'] = False
php7 = 0 php72 = 0
if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm): if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm):
data['basic'] = True data['basic'] = True
@@ -563,7 +563,7 @@ class WOSiteCreateController(CementBaseController):
" http://{0}".format(wo_domain)) " http://{0}".format(wo_domain))
return return
if data['php7']: if data['php72']:
php_version = "7.2" php_version = "7.2"
else: else:
php_version = "7.2" php_version = "7.2"
@@ -775,7 +775,7 @@ class WOSiteUpdateController(CementBaseController):
dict(help="update to html site", action='store_true')), dict(help="update to html site", action='store_true')),
(['--php'], (['--php'],
dict(help="update to php site", action='store_true')), dict(help="update to php site", action='store_true')),
(['--php7'], (['--php72'],
dict(help="update to php7 site", dict(help="update to php7 site",
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')), choices=('on', 'off'), const='on', nargs='?')),
@@ -822,7 +822,7 @@ class WOSiteUpdateController(CementBaseController):
if pargs.html: if pargs.html:
Log.error(self, "No site can be updated to html") Log.error(self, "No site can be updated to html")
if not (pargs.php or pargs.php7 or if not (pargs.php or pargs.php72 or
pargs.mysql or pargs.wp or pargs.wpsubdir or pargs.mysql or pargs.wp or pargs.wpsubdir or
pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or
pargs.hhvm or pargs.wpredis or pargs.letsencrypt): pargs.hhvm or pargs.wpredis or pargs.letsencrypt):
@@ -850,7 +850,7 @@ class WOSiteUpdateController(CementBaseController):
def doupdatesite(self, pargs): def doupdatesite(self, pargs):
hhvm = None hhvm = None
letsencrypt = False letsencrypt = False
php7 = None php72 = None
data = dict() data = dict()
@@ -899,13 +899,13 @@ class WOSiteUpdateController(CementBaseController):
check_ssl = check_site.is_ssl check_ssl = check_site.is_ssl
check_php_version = check_site.php_version check_php_version = check_site.php_version
if check_php_version == "7.0": if check_php_version == "7.2":
old_php7 = True old_php72 = True
else: else:
old_php7 = False old_php72 = False
if (pargs.password and not (pargs.html or if (pargs.password and not (pargs.html or
pargs.php or pargs.php7 or pargs.mysql or pargs.php or pargs.php72 or pargs.mysql or
pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wpsubdir or pargs.wpsubdomain)): pargs.wpsubdir or pargs.wpsubdomain)):
try: try:
@@ -925,16 +925,16 @@ class WOSiteUpdateController(CementBaseController):
Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") Log.info(self, Log.FAIL + "Can not update HTML site to HHVM")
return 1 return 1
if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php7']) or if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php72']) or
# (stype == 'php7' and oldsitetype not in ['html', 'mysql', 'php', 'php7', 'wp', 'wpsubdir', 'wpsubdomain', ]) or # (stype == 'php72' and oldsitetype not in ['html', 'mysql', 'php', 'php72', 'wp', 'wpsubdir', 'wpsubdomain', ]) or
(stype == 'mysql' and oldsitetype not in ['html', 'php', (stype == 'mysql' and oldsitetype not in ['html', 'php',
'proxy','php7']) or 'proxy','php72']) or
(stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql',
'proxy', 'wp', 'php7']) or 'proxy', 'wp', 'php72']) or
(stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or
(stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
(stype == oldsitetype and cache == oldcachetype) and (stype == oldsitetype and cache == oldcachetype) and
not pargs.php7): not pargs.php72):
Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}".
format(oldsitetype, oldcachetype, stype, cache)) format(oldsitetype, oldcachetype, stype, cache))
return 1 return 1
@@ -976,7 +976,7 @@ class WOSiteUpdateController(CementBaseController):
if stype == 'wpsubdir': if stype == 'wpsubdir':
data['wpsubdir'] = True data['wpsubdir'] = True
if pargs.hhvm or pargs.php7: if pargs.hhvm or pargs.php72:
if not data: if not data:
data = dict(site_name=wo_domain, www_domain=wo_www_domain, data = dict(site_name=wo_domain, www_domain=wo_www_domain,
currsitetype=oldsitetype, currsitetype=oldsitetype,
@@ -1038,24 +1038,24 @@ class WOSiteUpdateController(CementBaseController):
data['hhvm'] = False data['hhvm'] = False
hhvm = False hhvm = False
if pargs.php7 == 'on' : if pargs.php72 == 'on' :
data['php7'] = True data['php72'] = True
php7 = True php72 = True
check_php_version= '7.0' check_php_version= '7.2'
elif pargs.php7 == 'off': elif pargs.php72 == 'off':
data['php7'] = False data['php72'] = False
php7 = False php72 = False
check_php_version = '5.6' check_php_version = '5.6'
if pargs.php7: if pargs.php72:
if php7 is old_php7: if php72 is old_php72:
if php7 is False: if php72 is False:
Log.info(self, "PHP 7.0 is already disabled for given " Log.info(self, "PHP 7.2 is already disabled for given "
"site") "site")
elif php7 is True: elif php72 is True:
Log.info(self, "PHP 7.0 is already enabled for given " Log.info(self, "PHP 7.2 is already enabled for given "
"site") "site")
pargs.php7 = False pargs.php72 = False
#--letsencrypt=renew code goes here #--letsencrypt=renew code goes here
if pargs.letsencrypt == "renew" and not pargs.all: if pargs.letsencrypt == "renew" and not pargs.all:
@@ -1154,33 +1154,30 @@ class WOSiteUpdateController(CementBaseController):
data['hhvm'] = False data['hhvm'] = False
hhvm = False hhvm = False
if data and (not pargs.php7): if data and (not pargs.php72):
if old_php7 is True: if old_php72 is True:
data['php7'] = True data['php72'] = True
php7 = True php72 = True
else: else:
data['php7'] = False data['php72'] = False
php7 = False php72 = False
if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php7=="on": if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php72=="on":
if pargs.php7 == "on": if pargs.php72 == "on":
if (not pargs.experimental): if (not pargs.experimental):
Log.info(self, "PHP7.0 is experimental feature and it may not" Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain))
" work with all plugins of your site.\nYou can "
"disable it by passing --php7=off later.\nDo you wish"
" to enable PHP now for {0}?".format(wo_domain))
check_prompt = input("Type \"y\" to continue [n]:") check_prompt = input("Type \"y\" to continue [n]:")
if check_prompt != "Y" and check_prompt != "y": if check_prompt != "Y" and check_prompt != "y":
Log.info(self, "Not using PHP 7.0 for site") Log.info(self, "Not using PHP 7.2 for site")
data['php7'] = False data['php72'] = False
php7 = False php72 = False
else: else:
data['php7'] = True data['php72'] = True
php7 = True php72 = True
else: else:
data['php7'] = True data['php72'] = True
php7 = True php72 = True
if pargs.hhvm == "on": if pargs.hhvm == "on":
if (not pargs.experimental): if (not pargs.experimental):
@@ -1242,7 +1239,7 @@ class WOSiteUpdateController(CementBaseController):
data['basic'] = True data['basic'] = True
cache = 'basic' cache = 'basic'
if ((hhvm is old_hhvm) and (php7 is old_php7) and if ((hhvm is old_hhvm) and (php72 is old_php72) and
(stype == oldsitetype and cache == oldcachetype)): (stype == oldsitetype and cache == oldcachetype)):
return 1 return 1

View File

@@ -72,7 +72,7 @@ def setupdomain(self, data):
wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}' wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}'
.format(wo_domain_name), encoding='utf-8', .format(wo_domain_name), encoding='utf-8',
mode='w') mode='w')
if not data['php7']: if not data['php72']:
self.app.render((data), 'virtualconf.mustache', self.app.render((data), 'virtualconf.mustache',
out=wo_site_nginx_conf) out=wo_site_nginx_conf)
else: else:
@@ -623,7 +623,7 @@ def sitebackup(self, data):
.format(data['site_name']), backup_path) .format(data['site_name']), backup_path)
if data['currsitetype'] in ['html', 'php', 'proxy', 'mysql']: if data['currsitetype'] in ['html', 'php', 'proxy', 'mysql']:
if data['php7'] is True and not data['wp']: if data['php72'] is True and not data['wp']:
Log.info(self, "Backing up Webroot \t\t", end='') Log.info(self, "Backing up Webroot \t\t", end='')
WOFileUtils.copyfiles(self, wo_site_webroot + '/htdocs', backup_path + '/htdocs') WOFileUtils.copyfiles(self, wo_site_webroot + '/htdocs', backup_path + '/htdocs')
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
@@ -663,7 +663,7 @@ def sitebackup(self, data):
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
# move wp-config.php/wo-config.php to backup # move wp-config.php/wo-config.php to backup
if data['currsitetype'] in ['mysql', 'proxy']: if data['currsitetype'] in ['mysql', 'proxy']:
if data['php7'] is True and not data['wp']: if data['php72'] is True and not data['wp']:
WOFileUtils.copyfile(self, configfiles[0], backup_path) WOFileUtils.copyfile(self, configfiles[0], backup_path)
else: else:
WOFileUtils.mvfile(self, configfiles[0], backup_path) WOFileUtils.mvfile(self, configfiles[0], backup_path)
@@ -677,7 +677,7 @@ def site_package_check(self, stype):
stack = WOStackController() stack = WOStackController()
stack.app = self.app stack.app = self.app
if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain', 'php7']: 'wpsubdomain', 'php72']:
Log.debug(self, "Setting apt_packages variable for Nginx") Log.debug(self, "Setting apt_packages variable for Nginx")
# Check if server has nginx-custom package # Check if server has nginx-custom package
@@ -708,14 +708,14 @@ def site_package_check(self, stype):
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n') '\t$request_filename;\n')
if self.app.pargs.php and self.app.pargs.php7: if self.app.pargs.php and self.app.pargs.php72:
Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site")
if not self.app.pargs.php7 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if not self.app.pargs.php72 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP") Log.debug(self, "Setting apt_packages variable for PHP")
apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra
if self.app.pargs.php7 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if self.app.pargs.php72 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
Log.debug(self, "Setting apt_packages variable for PHP 7.2") Log.debug(self, "Setting apt_packages variable for PHP 7.2")
if not WOAptGet.is_installed(self, 'php7.2-fpm'): if not WOAptGet.is_installed(self, 'php7.2-fpm'):
@@ -830,7 +830,7 @@ def site_package_check(self, stype):
hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n" hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n"
"server 127.0.0.1:9000 backup;\n}\n") "server 127.0.0.1:9000 backup;\n}\n")
if self.app.pargs.php7: if self.app.pargs.php72:
if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'):
Log.error(self,"PHP 7.0 is not supported in your Platform") Log.error(self,"PHP 7.0 is not supported in your Platform")
@@ -894,7 +894,7 @@ def site_package_check(self, stype):
if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
"php7"): "php72"):
with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file:
php_file.write("upstream php7 {\nserver 127.0.0.1:9070;\n}\n" php_file.write("upstream php7 {\nserver 127.0.0.1:9070;\n}\n"
"upstream debug7 {\nserver 127.0.0.1:9170;\n}\n") "upstream debug7 {\nserver 127.0.0.1:9170;\n}\n")
@@ -1032,7 +1032,7 @@ def detSitePar(opts):
cachelist = list() cachelist = list()
for key, val in opts.items(): for key, val in opts.items():
if val and key in ['html', 'php', 'mysql', 'wp', if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain','php7']: 'wpsubdir', 'wpsubdomain','php72']:
typelist.append(key) typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'wpredis']: elif val and key in ['wpfc', 'wpsc', 'wpredis']:
cachelist.append(key) cachelist.append(key)
@@ -1046,7 +1046,7 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('php7','mysql','html') for x in typelist]: elif False not in [x in ('php72','mysql','html') for x in typelist]:
sitetype = 'mysql' sitetype = 'mysql'
if not cachelist: if not cachelist:
cachetype = 'basic' cachetype = 'basic'
@@ -1058,7 +1058,7 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('php7','mysql') for x in typelist]: elif False not in [x in ('php72','mysql') for x in typelist]:
sitetype = 'mysql' sitetype = 'mysql'
if not cachelist: if not cachelist:
cachetype = 'basic' cachetype = 'basic'
@@ -1076,8 +1076,8 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('php7','html') for x in typelist]: elif False not in [x in ('php72','html') for x in typelist]:
sitetype = 'php7' sitetype = 'php72'
if not cachelist: if not cachelist:
cachetype = 'basic' cachetype = 'basic'
else: else:
@@ -1094,19 +1094,19 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('wp','php7') for x in typelist]: elif False not in [x in ('wp','php72') for x in typelist]:
sitetype = 'wp' sitetype = 'wp'
if not cachelist: if not cachelist:
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('wpsubdir','php7') for x in typelist]: elif False not in [x in ('wpsubdir','php72') for x in typelist]:
sitetype = 'wpsubdir' sitetype = 'wpsubdir'
if not cachelist: if not cachelist:
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain','php7') for x in typelist]: elif False not in [x in ('wpsubdomain','php72') for x in typelist]:
sitetype = 'wpsubdomain' sitetype = 'wpsubdomain'
if not cachelist: if not cachelist:
cachetype = 'basic' cachetype = 'basic'
@@ -1118,7 +1118,7 @@ def detSitePar(opts):
if not typelist and not cachelist: if not typelist and not cachelist:
sitetype = None sitetype = None
cachetype = None cachetype = None
elif (not typelist or "php7" in typelist) and cachelist: elif (not typelist or "php72" in typelist) and cachelist:
sitetype = 'wp' sitetype = 'wp'
cachetype = cachelist[0] cachetype = cachelist[0]
elif typelist and (not cachelist): elif typelist and (not cachelist):

View File

@@ -57,10 +57,6 @@ class WOStackController(CementBaseController):
# dict(help='Install Nginx mainline stack', action='store_true')), # dict(help='Install Nginx mainline stack', action='store_true')),
(['--php'], (['--php'],
dict(help='Install PHP stack', action='store_true')), dict(help='Install PHP stack', action='store_true')),
(['--php7'],
dict(help='Install PHP 7.0 stack', action='store_true')),
(['--php71'],
dict(help='Install PHP 7.1 stack', action='store_true')),
(['--php72'], (['--php72'],
dict(help='Install PHP 7.2 stack', action='store_true')), dict(help='Install PHP 7.2 stack', action='store_true')),
(['--mysql'], (['--mysql'],
@@ -247,7 +243,7 @@ class WOStackController(CementBaseController):
self.app.render((data), 'fastcgi.mustache', out=wo_nginx) self.app.render((data), 'fastcgi.mustache', out=wo_nginx)
wo_nginx.close() wo_nginx.close()
data = dict(php="9000", debug="9001", hhvm="8000",php7="9070",debug7="9170", data = dict(php="9000", debug="9001", hhvm="8000",php72="9072",debug7="9170",
hhvmconf=False, php7conf= True if WOAptGet.is_installed(self,'php7.2-fpm') else False ) hhvmconf=False, php7conf= True if WOAptGet.is_installed(self,'php7.2-fpm') else False )
Log.debug(self, 'Writting the nginx configuration to ' Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/upstream.conf') 'file /etc/nginx/conf.d/upstream.conf')
@@ -629,7 +625,7 @@ class WOStackController(CementBaseController):
if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
"php7"): "php72"):
with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file:
php_file.write("upstream php7 {\nserver 127.0.0.1:9070;\n}\n" php_file.write("upstream php7 {\nserver 127.0.0.1:9070;\n}\n"
"upstream debug7 {\nserver 127.0.0.1:9170;\n}\n") "upstream debug7 {\nserver 127.0.0.1:9170;\n}\n")
@@ -892,7 +888,7 @@ class WOStackController(CementBaseController):
WOService.restart_service(self, 'php5-fpm') WOService.restart_service(self, 'php5-fpm')
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php5_6).issubset(set(apt_packages)): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
# Create log directories # Create log directories
if not os.path.exists('/var/log/php/5.6/'): if not os.path.exists('/var/log/php/5.6/'):
Log.debug(self, 'Creating directory /var/log/php/5.6/') Log.debug(self, 'Creating directory /var/log/php/5.6/')

View File

@@ -80,9 +80,9 @@ class WOStackMigrateController(CementBaseController):
# Install MariaDB # Install MariaDB
apt_packages = WOVariables.wo_mysql apt_packages = WOVariables.wo_mysql
# If PHP is installed then install php5-mysql # If PHP is installed then install php7.2-mysql
if WOAptGet.is_installed(self, "php5-fpm"): if WOAptGet.is_installed(self, "php7.2-fpm"):
apt_packages = apt_packages + ["php5-mysql"] apt_packages = apt_packages + ["php7.2-mysql"]
Log.info(self, "Updating apt-cache, hang on...") Log.info(self, "Updating apt-cache, hang on...")
WOAptGet.update(self) WOAptGet.update(self)