Almost there, don't use this yet
This commit is contained in:
@@ -29,7 +29,7 @@ _wo_complete()
|
||||
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
|
||||
"debug")
|
||||
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) )
|
||||
;;
|
||||
|
||||
@@ -53,7 +53,7 @@ _wo_complete()
|
||||
|
||||
"info")
|
||||
COMPREPLY=( $(compgen \
|
||||
-W "--mysql --php --php7 --nginx" \
|
||||
-W "--mysql --php --php72 --nginx" \
|
||||
-- $cur) )
|
||||
;;
|
||||
|
||||
@@ -74,17 +74,17 @@ _wo_complete()
|
||||
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE
|
||||
"install" | "purge" | "remove" )
|
||||
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) )
|
||||
;;
|
||||
"upgrade" )
|
||||
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) )
|
||||
;;
|
||||
"start" | "stop" | "reload" | "restart" | "status")
|
||||
COMPREPLY=( $(compgen \
|
||||
-W "--nginx --php --php7 --mysql --memcache --redis" \
|
||||
-W "--nginx --php --php72 --mysql --memcache --redis" \
|
||||
-- $cur) )
|
||||
;;
|
||||
"migrate")
|
||||
@@ -136,7 +136,7 @@ _wo_complete()
|
||||
;;
|
||||
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"
|
||||
ret="${retlist[@]/$prev}"
|
||||
COMPREPLY=( $(compgen \
|
||||
@@ -159,13 +159,13 @@ _wo_complete()
|
||||
|
||||
"create")
|
||||
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) )
|
||||
;;
|
||||
|
||||
"update")
|
||||
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) )
|
||||
;;
|
||||
"delete")
|
||||
@@ -211,9 +211,9 @@ _wo_complete()
|
||||
"--wp")
|
||||
if [ ${COMP_WORDS[1]} != "debug" ]; 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
|
||||
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
|
||||
retlist=""
|
||||
fi
|
||||
@@ -230,9 +230,9 @@ _wo_complete()
|
||||
"--wpsubdir" | "--wpsubdomain")
|
||||
if [ ${COMP_WORDS[1]} != "debug" ]; 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
|
||||
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
|
||||
retlist=""
|
||||
fi
|
||||
@@ -248,7 +248,7 @@ _wo_complete()
|
||||
|
||||
"--hhvm" | "--wpredis" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp")
|
||||
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
|
||||
retlist=""
|
||||
fi
|
||||
@@ -261,7 +261,7 @@ _wo_complete()
|
||||
|
||||
"--hhvm" | "--wpredis" | "--wpfc")
|
||||
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
|
||||
retlist=""
|
||||
fi
|
||||
@@ -272,15 +272,15 @@ _wo_complete()
|
||||
-- $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
|
||||
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
|
||||
retlist="--nginx --php --php7 --mysql --memcache --redis"
|
||||
retlist="--nginx --php --php72 --mysql --memcache --redis"
|
||||
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
|
||||
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
|
||||
elif [[ ${COMP_WORDS[1]} == "log" ]]; then
|
||||
if [ ${COMP_WORDS[2]} == "show" ]; then
|
||||
@@ -363,7 +363,7 @@ _wo_complete()
|
||||
case "$mprev" in
|
||||
"--user" | "--email" | "--pass")
|
||||
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
|
||||
ret="${retlist[@]/$prev}"
|
||||
COMPREPLY=( $(compgen \
|
||||
|
||||
24
docs/wo.8
24
docs/wo.8
@@ -5,15 +5,15 @@
|
||||
.SH SYNOPSIS
|
||||
wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync]
|
||||
.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
|
||||
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
|
||||
wo site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ]
|
||||
.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
|
||||
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
|
||||
wo site delete example.com [--db | --files | --all | --no-prompt | --force/-f ]
|
||||
.TP
|
||||
@@ -46,19 +46,19 @@ Display WordOps (wo) help.
|
||||
.TP
|
||||
.B stack
|
||||
.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
|
||||
Install Nginx PHP5 MySQL Postfix stack Packages if not used with
|
||||
.br
|
||||
any options.Installs specific package if used with option.
|
||||
.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
|
||||
Remove Nginx PHP5 MySQL Postfix stack Packages if not used with
|
||||
.br
|
||||
any options. Remove specific package if used with option.
|
||||
.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
|
||||
Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any
|
||||
.br
|
||||
@@ -129,13 +129,13 @@ Disable site by Destroying softlink with site file in
|
||||
.br
|
||||
Edit NGINX configuration of site.
|
||||
.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
|
||||
Create new site according to given options. If no options provided
|
||||
.br
|
||||
create static site with html only.
|
||||
.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
|
||||
Update site configuration according to specified options.
|
||||
.TP
|
||||
@@ -143,7 +143,7 @@ Update site configuration according to specified options.
|
||||
.br
|
||||
Delete site i.e webroot, database, ad configuration permanently.
|
||||
.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
|
||||
Starts server level debugging. If this is used without arguments it will start debugging
|
||||
.br
|
||||
@@ -182,9 +182,9 @@ used with wo debug command. used to start or stop nginx debugging.
|
||||
.br
|
||||
used with wo debug command. used to start or stop php debugging.
|
||||
.TP
|
||||
.B --php7=on/off
|
||||
.B --php72=on/off
|
||||
.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
|
||||
.B --mysql=on/off
|
||||
.br
|
||||
|
||||
@@ -29,7 +29,7 @@ class WOInfoController(CementBaseController):
|
||||
(['--php'],
|
||||
dict(help='Get PHP configuration information',
|
||||
action='store_true')),
|
||||
(['--php7'],
|
||||
(['--php72'],
|
||||
dict(help='Get PHP 7.2 configuration information',
|
||||
action='store_true')),
|
||||
(['--nginx'],
|
||||
@@ -138,7 +138,7 @@ class WOInfoController(CementBaseController):
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php7(self):
|
||||
def info_php72(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
@@ -243,7 +243,7 @@ class WOInfoController(CementBaseController):
|
||||
def default(self):
|
||||
"""default function for info"""
|
||||
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.php = True
|
||||
self.app.pargs.mysql = True
|
||||
@@ -268,9 +268,9 @@ class WOInfoController(CementBaseController):
|
||||
else:
|
||||
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'):
|
||||
self.info_php7()
|
||||
self.info_php72()
|
||||
else:
|
||||
Log.error(self, "PHP 7.2 is not installed")
|
||||
|
||||
|
||||
@@ -309,8 +309,8 @@ class WOSiteCreateController(CementBaseController):
|
||||
dict(help="create html site", action='store_true')),
|
||||
(['--php'],
|
||||
dict(help="create php site", action='store_true')),
|
||||
(['--php7'],
|
||||
dict(help="create php 7.0 site", action='store_true')),
|
||||
(['--php72'],
|
||||
dict(help="create php 7.2 site", action='store_true')),
|
||||
(['--mysql'],
|
||||
dict(help="create mysql site", action='store_true')),
|
||||
(['--wp'],
|
||||
@@ -410,16 +410,16 @@ class WOSiteCreateController(CementBaseController):
|
||||
data['port'] = port
|
||||
wo_site_webroot = ""
|
||||
|
||||
if self.app.pargs.php7:
|
||||
if self.app.pargs.php72:
|
||||
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,
|
||||
wpsubdir=False, webroot=wo_site_webroot)
|
||||
data['basic'] = True
|
||||
|
||||
if stype in ['html', 'php' ]:
|
||||
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,
|
||||
wpsubdir=False, webroot=wo_site_webroot)
|
||||
|
||||
@@ -453,27 +453,27 @@ class WOSiteCreateController(CementBaseController):
|
||||
if stype == "html" and self.app.pargs.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):
|
||||
Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain))
|
||||
|
||||
# Check prompt
|
||||
check_prompt = input("Type \"y\" to continue [n]:")
|
||||
if check_prompt != "Y" and check_prompt != "y":
|
||||
Log.info(self, "Not using PHP 7.0 for site.")
|
||||
data['php7'] = False
|
||||
Log.info(self, "Not using PHP 7.2 for site.")
|
||||
data['php72'] = False
|
||||
data['basic'] = True
|
||||
php7 = 0
|
||||
self.app.pargs.php7 = False
|
||||
php72 = 0
|
||||
self.app.pargs.php72 = False
|
||||
else:
|
||||
data['php7'] = True
|
||||
php7 = 1
|
||||
data['php72'] = True
|
||||
php72 = 1
|
||||
else:
|
||||
data['php7'] = True
|
||||
php7 = 1
|
||||
data['php72'] = True
|
||||
php72 = 1
|
||||
elif data:
|
||||
data['php7'] = False
|
||||
php7 = 0
|
||||
data['php72'] = False
|
||||
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):
|
||||
data['basic'] = True
|
||||
@@ -563,7 +563,7 @@ class WOSiteCreateController(CementBaseController):
|
||||
" http://{0}".format(wo_domain))
|
||||
return
|
||||
|
||||
if data['php7']:
|
||||
if data['php72']:
|
||||
php_version = "7.2"
|
||||
else:
|
||||
php_version = "7.2"
|
||||
@@ -775,7 +775,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
dict(help="update to html site", action='store_true')),
|
||||
(['--php'],
|
||||
dict(help="update to php site", action='store_true')),
|
||||
(['--php7'],
|
||||
(['--php72'],
|
||||
dict(help="update to php7 site",
|
||||
action='store' or 'store_const',
|
||||
choices=('on', 'off'), const='on', nargs='?')),
|
||||
@@ -822,7 +822,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
if pargs.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.wpsubdomain or pargs.wpfc or pargs.wpsc or
|
||||
pargs.hhvm or pargs.wpredis or pargs.letsencrypt):
|
||||
@@ -850,7 +850,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
def doupdatesite(self, pargs):
|
||||
hhvm = None
|
||||
letsencrypt = False
|
||||
php7 = None
|
||||
php72 = None
|
||||
|
||||
|
||||
data = dict()
|
||||
@@ -899,13 +899,13 @@ class WOSiteUpdateController(CementBaseController):
|
||||
check_ssl = check_site.is_ssl
|
||||
check_php_version = check_site.php_version
|
||||
|
||||
if check_php_version == "7.0":
|
||||
old_php7 = True
|
||||
if check_php_version == "7.2":
|
||||
old_php72 = True
|
||||
else:
|
||||
old_php7 = False
|
||||
old_php72 = False
|
||||
|
||||
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.wpsubdir or pargs.wpsubdomain)):
|
||||
try:
|
||||
@@ -925,16 +925,16 @@ class WOSiteUpdateController(CementBaseController):
|
||||
Log.info(self, Log.FAIL + "Can not update HTML site to HHVM")
|
||||
return 1
|
||||
|
||||
if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php7']) or
|
||||
# (stype == 'php7' and oldsitetype not in ['html', 'mysql', 'php', 'php7', 'wp', 'wpsubdir', 'wpsubdomain', ]) or
|
||||
if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php72']) or
|
||||
# (stype == 'php72' and oldsitetype not in ['html', 'mysql', 'php', 'php72', 'wp', 'wpsubdir', 'wpsubdomain', ]) or
|
||||
(stype == 'mysql' and oldsitetype not in ['html', 'php',
|
||||
'proxy','php7']) or
|
||||
'proxy','php72']) or
|
||||
(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 == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
|
||||
(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}".
|
||||
format(oldsitetype, oldcachetype, stype, cache))
|
||||
return 1
|
||||
@@ -976,7 +976,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
if stype == 'wpsubdir':
|
||||
data['wpsubdir'] = True
|
||||
|
||||
if pargs.hhvm or pargs.php7:
|
||||
if pargs.hhvm or pargs.php72:
|
||||
if not data:
|
||||
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
||||
currsitetype=oldsitetype,
|
||||
@@ -1038,24 +1038,24 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data['hhvm'] = False
|
||||
hhvm = False
|
||||
|
||||
if pargs.php7 == 'on' :
|
||||
data['php7'] = True
|
||||
php7 = True
|
||||
check_php_version= '7.0'
|
||||
elif pargs.php7 == 'off':
|
||||
data['php7'] = False
|
||||
php7 = False
|
||||
if pargs.php72 == 'on' :
|
||||
data['php72'] = True
|
||||
php72 = True
|
||||
check_php_version= '7.2'
|
||||
elif pargs.php72 == 'off':
|
||||
data['php72'] = False
|
||||
php72 = False
|
||||
check_php_version = '5.6'
|
||||
|
||||
if pargs.php7:
|
||||
if php7 is old_php7:
|
||||
if php7 is False:
|
||||
Log.info(self, "PHP 7.0 is already disabled for given "
|
||||
if pargs.php72:
|
||||
if php72 is old_php72:
|
||||
if php72 is False:
|
||||
Log.info(self, "PHP 7.2 is already disabled for given "
|
||||
"site")
|
||||
elif php7 is True:
|
||||
Log.info(self, "PHP 7.0 is already enabled for given "
|
||||
elif php72 is True:
|
||||
Log.info(self, "PHP 7.2 is already enabled for given "
|
||||
"site")
|
||||
pargs.php7 = False
|
||||
pargs.php72 = False
|
||||
|
||||
#--letsencrypt=renew code goes here
|
||||
if pargs.letsencrypt == "renew" and not pargs.all:
|
||||
@@ -1154,33 +1154,30 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data['hhvm'] = False
|
||||
hhvm = False
|
||||
|
||||
if data and (not pargs.php7):
|
||||
if old_php7 is True:
|
||||
data['php7'] = True
|
||||
php7 = True
|
||||
if data and (not pargs.php72):
|
||||
if old_php72 is True:
|
||||
data['php72'] = True
|
||||
php72 = True
|
||||
else:
|
||||
data['php7'] = False
|
||||
php7 = False
|
||||
data['php72'] = False
|
||||
php72 = False
|
||||
|
||||
if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php7=="on":
|
||||
if pargs.php7 == "on":
|
||||
if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php72=="on":
|
||||
if pargs.php72 == "on":
|
||||
if (not pargs.experimental):
|
||||
Log.info(self, "PHP7.0 is experimental feature and it may not"
|
||||
" 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))
|
||||
Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain))
|
||||
|
||||
check_prompt = input("Type \"y\" to continue [n]:")
|
||||
if check_prompt != "Y" and check_prompt != "y":
|
||||
Log.info(self, "Not using PHP 7.0 for site")
|
||||
data['php7'] = False
|
||||
php7 = False
|
||||
Log.info(self, "Not using PHP 7.2 for site")
|
||||
data['php72'] = False
|
||||
php72 = False
|
||||
else:
|
||||
data['php7'] = True
|
||||
php7 = True
|
||||
data['php72'] = True
|
||||
php72 = True
|
||||
else:
|
||||
data['php7'] = True
|
||||
php7 = True
|
||||
data['php72'] = True
|
||||
php72 = True
|
||||
|
||||
if pargs.hhvm == "on":
|
||||
if (not pargs.experimental):
|
||||
@@ -1242,7 +1239,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data['basic'] = True
|
||||
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)):
|
||||
return 1
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ def setupdomain(self, data):
|
||||
wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}'
|
||||
.format(wo_domain_name), encoding='utf-8',
|
||||
mode='w')
|
||||
if not data['php7']:
|
||||
if not data['php72']:
|
||||
self.app.render((data), 'virtualconf.mustache',
|
||||
out=wo_site_nginx_conf)
|
||||
else:
|
||||
@@ -623,7 +623,7 @@ def sitebackup(self, data):
|
||||
.format(data['site_name']), backup_path)
|
||||
|
||||
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='')
|
||||
WOFileUtils.copyfiles(self, wo_site_webroot + '/htdocs', backup_path + '/htdocs')
|
||||
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
|
||||
@@ -663,7 +663,7 @@ def sitebackup(self, data):
|
||||
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
|
||||
# move wp-config.php/wo-config.php to backup
|
||||
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)
|
||||
else:
|
||||
WOFileUtils.mvfile(self, configfiles[0], backup_path)
|
||||
@@ -677,7 +677,7 @@ def site_package_check(self, stype):
|
||||
stack = WOStackController()
|
||||
stack.app = self.app
|
||||
if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir',
|
||||
'wpsubdomain', 'php7']:
|
||||
'wpsubdomain', 'php72']:
|
||||
Log.debug(self, "Setting apt_packages variable for Nginx")
|
||||
|
||||
# Check if server has nginx-custom package
|
||||
@@ -708,14 +708,14 @@ def site_package_check(self, stype):
|
||||
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
|
||||
'\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")
|
||||
|
||||
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")
|
||||
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'):
|
||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||
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"
|
||||
"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'):
|
||||
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 not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
|
||||
"php7"):
|
||||
"php72"):
|
||||
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"
|
||||
"upstream debug7 {\nserver 127.0.0.1:9170;\n}\n")
|
||||
@@ -1032,7 +1032,7 @@ def detSitePar(opts):
|
||||
cachelist = list()
|
||||
for key, val in opts.items():
|
||||
if val and key in ['html', 'php', 'mysql', 'wp',
|
||||
'wpsubdir', 'wpsubdomain','php7']:
|
||||
'wpsubdir', 'wpsubdomain','php72']:
|
||||
typelist.append(key)
|
||||
elif val and key in ['wpfc', 'wpsc', 'wpredis']:
|
||||
cachelist.append(key)
|
||||
@@ -1046,7 +1046,7 @@ def detSitePar(opts):
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
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'
|
||||
if not cachelist:
|
||||
cachetype = 'basic'
|
||||
@@ -1058,7 +1058,7 @@ def detSitePar(opts):
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
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'
|
||||
if not cachelist:
|
||||
cachetype = 'basic'
|
||||
@@ -1076,8 +1076,8 @@ def detSitePar(opts):
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
cachetype = cachelist[0]
|
||||
elif False not in [x in ('php7','html') for x in typelist]:
|
||||
sitetype = 'php7'
|
||||
elif False not in [x in ('php72','html') for x in typelist]:
|
||||
sitetype = 'php72'
|
||||
if not cachelist:
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
@@ -1094,19 +1094,19 @@ def detSitePar(opts):
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
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'
|
||||
if not cachelist:
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
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'
|
||||
if not cachelist:
|
||||
cachetype = 'basic'
|
||||
else:
|
||||
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'
|
||||
if not cachelist:
|
||||
cachetype = 'basic'
|
||||
@@ -1118,7 +1118,7 @@ def detSitePar(opts):
|
||||
if not typelist and not cachelist:
|
||||
sitetype = None
|
||||
cachetype = None
|
||||
elif (not typelist or "php7" in typelist) and cachelist:
|
||||
elif (not typelist or "php72" in typelist) and cachelist:
|
||||
sitetype = 'wp'
|
||||
cachetype = cachelist[0]
|
||||
elif typelist and (not cachelist):
|
||||
|
||||
@@ -57,10 +57,6 @@ class WOStackController(CementBaseController):
|
||||
# dict(help='Install Nginx mainline stack', action='store_true')),
|
||||
(['--php'],
|
||||
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'],
|
||||
dict(help='Install PHP 7.2 stack', action='store_true')),
|
||||
(['--mysql'],
|
||||
@@ -247,7 +243,7 @@ class WOStackController(CementBaseController):
|
||||
self.app.render((data), 'fastcgi.mustache', out=wo_nginx)
|
||||
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 )
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'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 not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
|
||||
"php7"):
|
||||
"php72"):
|
||||
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"
|
||||
"upstream debug7 {\nserver 127.0.0.1:9170;\n}\n")
|
||||
@@ -892,7 +888,7 @@ class WOStackController(CementBaseController):
|
||||
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
|
||||
if not os.path.exists('/var/log/php/5.6/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/5.6/')
|
||||
|
||||
@@ -80,9 +80,9 @@ class WOStackMigrateController(CementBaseController):
|
||||
# Install MariaDB
|
||||
apt_packages = WOVariables.wo_mysql
|
||||
|
||||
# If PHP is installed then install php5-mysql
|
||||
if WOAptGet.is_installed(self, "php5-fpm"):
|
||||
apt_packages = apt_packages + ["php5-mysql"]
|
||||
# If PHP is installed then install php7.2-mysql
|
||||
if WOAptGet.is_installed(self, "php7.2-fpm"):
|
||||
apt_packages = apt_packages + ["php7.2-mysql"]
|
||||
|
||||
Log.info(self, "Updating apt-cache, hang on...")
|
||||
WOAptGet.update(self)
|
||||
|
||||
Reference in New Issue
Block a user