Add upgrade script for phpmyadmin

This commit is contained in:
VirtuBox
2019-07-14 22:50:34 +02:00
parent 2eb05e7b82
commit 37bd353fa4
8 changed files with 2665 additions and 2629 deletions

View File

@@ -79,7 +79,7 @@ _wo_complete()
;; ;;
"upgrade" ) "upgrade" )
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--web --nginx --php --php73 --mysql --all --netdata --no-prompt --wpcli" \ -W "--web --nginx --php --php73 --mysql --all --netdata --composer --phpmyadmin --no-prompt --wpcli" \
-- $cur) ) -- $cur) )
;; ;;
"start" | "stop" | "reload" | "restart" | "status") "start" | "stop" | "reload" | "restart" | "status")
@@ -310,7 +310,7 @@ _wo_complete()
"--all") "--all")
if [ ${COMP_WORDS[1]} == "clean" ]; then if [ ${COMP_WORDS[1]} == "clean" ]; then
retlist="--memcache --opcache --fastcgi --redis" retlist="--opcache --fastcgi --redis"
elif [ ${COMP_WORDS[2]} == "delete" ]; then elif [ ${COMP_WORDS[2]} == "delete" ]; then
retlist="--db --files --force" retlist="--db --files --force"
elif [ ${COMP_WORDS[2]} == "update" ]; then elif [ ${COMP_WORDS[2]} == "update" ]; then

View File

@@ -3,17 +3,17 @@
.B WordOps (wo) .B WordOps (wo)
\- Manage Nginx Based Websites. \- Manage Nginx Based Websites.
.SH SYNOPSIS .SH SYNOPSIS
wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync | maintenance] wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync | maintenance ]
.TP .TP
wo stack [ install | remove | purge | migrate | upgrade] [ --web | --all | --nginx | --php | --php73 | --mysql | --admin | --adminer | --redis | --phpmyadmin | --phpredisadmin | --wpcli | --utils | --dashboard | --netdata ] wo stack [ install | remove | purge | migrate | upgrade] [ --web | --all | --nginx | --php | --php73 | --mysql | --admin | --adminer | --redis | --phpmyadmin | --phpredisadmin | --wpcli | --utils | --dashboard | --netdata ]
.TP .TP
wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php73 |--mysql | --web | --memcached | --redis] wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php73 |--mysql | --web | --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 | --php73 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --letsencrypt/-le/--letsencrypt=subdomain]] wo site create example.com [ --html | --php | --php73 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --letsencrypt/--le/--letsencrypt=subdomain/wildcard]]
.TP .TP
wo site update example.com [ --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis ] [--password] [--letsencrypt=on/off/subdomain/renew]] wo site update example.com [ --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis ] [--password] [--le/--letsencrypt=on/off/subdomain/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 | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .B install [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard ]
.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 | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .B remove [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard ]
.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 | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .B purge [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard ]
.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
@@ -163,7 +163,7 @@ if used with --all=off argument.
.br .br
Update security settings. Update security settings.
.TP .TP
.B clean [ --fastcgi | --opcache | --memcached | --redis | --all ] .B clean [ --fastcgi | --opcache | --redis | --all ]
.br .br
Clean NGINX fastCGI cache, Opcache, memcached, Redis cache. Clean NGINX fastCGI cache, Opcache, memcached, Redis cache.
.br .br

View File

@@ -370,7 +370,7 @@ class WOStackController(CementBaseController):
# php73 conf # php73 conf
if not os.path.isfile("/etc/nginx/common/php73.conf"): if not os.path.isfile("/etc/nginx/common/php73.conf"):
# data = dict() # data = dict()
Log.debug(self, 'Writting the nginx configuration to ' Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/php73.conf') 'file /etc/nginx/common/php73.conf')
wo_nginx = open('/etc/nginx/common/php73.conf', wo_nginx = open('/etc/nginx/common/php73.conf',
@@ -1418,6 +1418,7 @@ class WOStackController(CementBaseController):
self.app.pargs.web = True self.app.pargs.web = True
self.app.pargs.admin = True self.app.pargs.admin = True
self.app.pargs.php73 = True self.app.pargs.php73 = True
self.app.pargs.redis = True
if self.app.pargs.web: if self.app.pargs.web:
self.app.pargs.nginx = True self.app.pargs.nginx = True

View File

@@ -38,6 +38,8 @@ class WOStackUpgradeController(CementBaseController):
dict(help='Upgrade Redis', action='store_true')), dict(help='Upgrade Redis', action='store_true')),
(['--netdata'], (['--netdata'],
dict(help='Upgrade Netdata', action='store_true')), dict(help='Upgrade Netdata', action='store_true')),
(['--phpmyadmin'],
dict(help='Upgrade phpMyAdmin', action='store_true')),
(['--no-prompt'], (['--no-prompt'],
dict(help="Upgrade Packages without any prompt", dict(help="Upgrade Packages without any prompt",
action='store_true')), action='store_true')),
@@ -83,7 +85,9 @@ class WOStackUpgradeController(CementBaseController):
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and 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.php) and (not self.app.pargs.mysql) and
(not self.app.pargs.all) and (not self.app.pargs.wpcli) and (not self.app.pargs.all) and (not self.app.pargs.wpcli) and
(not self.app.pargs.netdata) and (not self.app.pargs.redis)): (not self.app.pargs.netdata) and
(not self.app.pargs.phpmyadmin) and
(not self.app.pargs.redis)):
self.app.pargs.web = True self.app.pargs.web = True
if self.app.pargs.all: if self.app.pargs.all:
@@ -144,6 +148,18 @@ class WOStackUpgradeController(CementBaseController):
'kickstart-static64.sh', 'kickstart-static64.sh',
'/var/lib/wo/tmp/kickstart.sh', '/var/lib/wo/tmp/kickstart.sh',
'Netdata']] 'Netdata']]
if self.app.pargs.phpmyadmin:
if os.path.isdir('/var/www/22222/htdocs/db/pma'):
packages = packages + \
[["https://files.phpmyadmin.net"
"/phpMyAdmin/{0}/"
"phpMyAdmin-{0}-"
"all-languages"
".zip".format(WOVariables.wo_phpmyadmin),
"/var/lib/wo/tmp/pma.tar.gz",
"PHPMyAdmin"]]
else:
Log.error(self, "phpMyAdmin isn't installed")
if len(packages) or len(apt_packages): if len(packages) or len(apt_packages):
@@ -190,6 +206,24 @@ class WOStackUpgradeController(CementBaseController):
WOShellExec.cmd_exec(self, "/bin/bash /var/lib/wo/tmp/" WOShellExec.cmd_exec(self, "/bin/bash /var/lib/wo/tmp/"
"kickstart.sh " "kickstart.sh "
"--dont-wait") "--dont-wait")
if self.app.pargs.phpmyadmin:
Log.info(self, "Upgrading phpMyAdmin, please wait...")
WOExtract.extract(
self, '/var/lib/wo/tmp/pma.tar.gz', '/var/lib/wo/tmp/')
shutil.copyfile('{0}22222/htdocs/db/pma'
'/config.inc.php'
.format(WOVariables.wo_webroot),
'/var/lib/wo/tmp/phpMyAdmin-{0}'
'-all-languages/config.inc.php'
.format(WOVariables.wo_phpmyadmin)
)
WOFileUtils.remove('{0}22222/htdocs/db/pma'
.format(WOVariables.wo_webroot))
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
'-all-languages/'
.format(WOVariables.wo_phpmyadmin),
'{0}22222/htdocs/db/pma/'
.format(WOVariables.wo_webroot))
Log.info(self, "Successfully updated packages") Log.info(self, "Successfully updated packages")
else: else:

View File

@@ -15,6 +15,7 @@ class WOVariables():
# WordOps packages versions # WordOps packages versions
wo_wp_cli = "2.2.0" wo_wp_cli = "2.2.0"
wo_adminer = "4.7.1" wo_adminer = "4.7.1"
wo_phpmyadmin = "4.9.0.1"
# Get WPCLI path # Get WPCLI path
wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read()