1+ #! /bin/bash
2+
3+ # Set version(s)
4+ pma_v=' 4.8.5'
5+
6+ # Upgrade phpMyAdmin
7+ if [ " $DB_SYSTEM " = ' mysql' ]; then
8+ # Display upgrade information
9+ echo " Upgrade phpMyAdmin to v$pma_v ..."
10+
11+ # Download latest phpMyAdmin release
12+ wget --quiet https://files.phpmyadmin.net/phpMyAdmin/$pma_v /phpMyAdmin-$pma_v -all-languages.tar.gz
13+
14+ # Unpack files
15+ tar xzf phpMyAdmin-$pma_v -all-languages.tar.gz
16+
17+ # Delete file to prevent error
18+ rm -fr /usr/share/phpmyadmin/doc/html
19+
20+ # Overwrite old files
21+ cp -rf phpMyAdmin-$pma_v -all-languages/* /usr/share/phpmyadmin
22+
23+ # Set config and log directory
24+ sed -i " s|define('CONFIG_DIR', '');|define('CONFIG_DIR', '/etc/phpmyadmin/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
25+ sed -i " s|define('TEMP_DIR', './tmp/');|define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
26+
27+ # Create temporary folder and change permissions
28+ if [ ! -d /usr/share/phpmyadmin/tmp ]; then
29+ mkdir /usr/share/phpmyadmin/tmp
30+ chmod 777 /usr/share/phpmyadmin/tmp
31+ fi
32+
33+ # Clean up
34+ rm -fr phpMyAdmin-$pma_v -all-languages
35+ rm -f phpMyAdmin-$pma_v -all-languages.tar.gz
36+ fi
37+
38+ # Add amd64 to repositories to prevent notifications - https://goo.gl/hmsSV7
39+ if ! grep -q ' arch=amd64' /etc/apt/sources.list.d/nginx.list; then
40+ sed -i s/" deb " /" deb [arch=amd64] " /g /etc/apt/sources.list.d/nginx.list
41+ fi
42+ if ! grep -q ' arch=amd64' /etc/apt/sources.list.d/mariadb.list; then
43+ sed -i s/" deb " /" deb [arch=amd64] " /g /etc/apt/sources.list.d/mariadb.list
44+ fi
45+
46+ # Fix named rule for AppArmor - https://goo.gl/SPqHdq
47+ if [ " $DNS_SYSTEM " = ' bind9' ] && [ ! -f /etc/apparmor.d/local/usr.sbin.named ]; then
48+ echo " /home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
49+ fi
50+
51+ # Remove obsolete ports.conf if exists.
52+ if [ -f /usr/local/hestia/data/firewall/ports.conf ]; then
53+ rm -f /usr/local/hestia/data/firewall/ports.conf
54+ fi
55+
56+ # Reset backend port
57+ if [ ! -z " $BACKEND_PORT " ]; then
58+ /usr/local/hestia/bin/v-change-sys-port $BACKEND_PORT
59+ fi
60+
61+ # Set Purge to false in roundcube config - https://goo.gl/3Nja3u
62+ if [ -f /etc/roundcube/config.inc.php ]; then
63+ sed " s/deletion'] = 'Purge'/deletion'] = false/g" /etc/roundcube/config.inc.php
64+ elif [ -f /etc/roundcube/main.inc.php ]
65+ sed " s/deletion'] = 'Purge'/deletion'] = false/g" /etc/roundcube/main.inc.php
66+ fi
67+
68+ # Copy default "Success" page for unassigned hosts
69+ cp -rf $hestiacp /templates/web/unassigned/* /var/www/
0 commit comments