fix phpmyadmin install

This commit is contained in:
VirtuBox
2019-03-31 17:14:17 +02:00
parent 5866ffa584
commit 5263ebe992
3 changed files with 38 additions and 18 deletions

View File

@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- WordOps configuration backup before upgrade
- Previous acme.sh certs migration
- "wo maintenance" command to perform server package update & cleanup
- Support for Netdata on backend : https://server.hostname:22222/netdata/
#### Changed

32
install
View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# WordOps install and update script
# -------------------------------------------------------------------------
@@ -425,7 +425,11 @@ wo_upgrade_nginx() {
rm -f /tmp/nginx-wo.key
sudo apt-get update
CHECK_NGINX_UPSTREAM_VERSION=$(grep "v3.9.5.1" /etc/nginx/conf.d/fastcgi.conf)
if [ -f /etc/nginx/common/release ]; then
CHECK_NGINX_UPSTREAM_VERSION=$(grep "$wo_version_new" /etc/nginx/common/release)
else
CHECK_NGINX_UPSTREAM_VERSION=$(grep "$wo_version_new" /etc/nginx/conf.d/fastcgi.conf)
fi
if [ -z "$CHECK_NGINX_UPSTREAM_VERSION" ]; then
# stop nginx
@@ -456,6 +460,7 @@ wo_upgrade_nginx() {
rm -f /etc/php/7.2/fpm/pool.d/{www.conf,www-two.conf,debug.conf}
fi
/usr/local/bin/wo stack install --nginx --php
echo "$wo_version_new" > /etc/nginx/common/release
if [ -n "$CHECK_PHP73" ]; then
apt-get remove php7.3-fpm -y -qq --purge
rm -f /etc/php/7.3/fpm/pool.d/{www.conf,www-two.conf,debug.conf}
@@ -535,13 +540,6 @@ wo_update_latest() {
chmod 600 /root/.my.cnf
fi
fi
# Fix WordPress example.html issue
# Ref: http://wptavern.com/xss-vulnerability-in-jetpack-and-the-twenty-fifteen-default-theme-affects-millions-of-wordpress-users
CHECK_DEINSTALL_NGINX=$(dpkg --get-selections | grep -v deinstall | grep nginx)
if [ -z "$CHECK_DEINSTALL_NGINX" ]; then
cp /usr/lib/wo/templates/locations.mustache /etc/nginx/common/locations-php72.conf
fi
# Fix Redis-server security issue
# http://redis.io/topics/security
@@ -621,11 +619,13 @@ if [ -x /usr/local/bin/wo ]; then
wo_install >> wo_install_log 2>&1
if [ -x "$(command -v nginx)" ]; then
wo_lib_echo "Upgrading Nginx" | tee -ai $wo_install_log
wo_upgrade_nginx | tee -ai $wo_install_log
wo_upgrade_nginx | tee -ai $wo_install_log
fi
wo_update_latest | tee -ai $wo_install_log
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
if [ ! -d /opt/acme.sh ]; then
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
fi
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
wo_git_init | tee -ai $wo_install_log
wo_update_wp_cli | tee -ai $wo_install_log
@@ -651,11 +651,13 @@ else
wo_install >> wo_install_log 2>&1
if [ -x "$(command -v nginx)" ]; then
wo_lib_echo "Upgrading Nginx" | tee -ai $wo_install_log
wo_upgrade_nginx | tee -ai $wo_install_log
wo_upgrade_nginx | tee -ai $wo_install_log
fi
wo_update_latest | tee -ai $wo_install_log
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
if [ ! -d /opt/acme.sh ]; then
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
wo_install_acme_sh | tee -ai $wo_install_log
fi
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
wo_git_init | tee -ai $wo_install_log
wo_update_wp_cli | tee -ai $wo_install_log

View File

@@ -369,6 +369,10 @@ class WOStackController(CementBaseController):
self.app.render((data), 'locations.mustache',
out=wo_nginx)
wo_nginx.close()
if not os.path.isfile("/etc/nginx/common/release"):
with open("/etc/nginx/common/release",
"a") as release_file:
release_file.write("v3.9.5")
# Nginx-Plus does not have nginx
# package structure like this
@@ -1029,6 +1033,17 @@ class WOStackController(CementBaseController):
WOVariables.wo_php_user,
WOVariables.wo_php_user,
recursive=True)
if os.path.isfile("/tmp/composer-install"):
WOShellExec.cmd_exec(self, "php -q /tmp/composer-install"
"--install-dir=/tmp/")
shutil.move('/tmp/composer.phar',
'/usr/local/bin/composer')
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
WOShellExec.cmd_exec(self, "sudo -u www-data -H composer "
"update --no-dev -d "
"/var/www/22222/htdocs/db/pma/")
if any('/tmp/memcached.tar.gz' == x[1]
for x in packages):
Log.debug(self, "Extracting memcached.tar.gz to location"
@@ -1286,13 +1301,15 @@ class WOStackController(CementBaseController):
# PHPMYADMIN
if self.app.pargs.phpmyadmin:
Log.debug(self, "Setting packages varible for phpMyAdmin ")
Log.debug(self, "Setting packages variable for phpMyAdmin ")
packages = packages + [["https://github.com/phpmyadmin/"
"phpmyadmin/archive/STABLE.tar.gz",
"/tmp/pma.tar.gz", "phpMyAdmin"]]
"/tmp/pma.tar.gz", "phpMyAdmin"],
["https://getcomposer.org/installer",
"/tmp/composer-install", "composer"]]
# PHPREDISADMIN
if self.app.pargs.phpredisadmin:
Log.debug(self, "Setting packages varible for phpRedisAdmin")
Log.debug(self, "Setting packages variable for phpRedisAdmin")
packages = packages + [["https://github.com/ErikDubbelboer/"
"phpRedisAdmin/archive/master.tar.gz",
"/tmp/pra.tar.gz", "phpRedisAdmin"],