-
-
Save Boldewyn/0303667f07cbce7e117755d25f92eef8 to your computer and use it in GitHub Desktop.
Piwik automatic update - bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Start this scipt above the /piwik directory. | |
# We assume that the webserver runs under www-data. | |
# download & verify | |
wget -nv "http://builds.piwik.org/piwik.zip" || exit 1 | |
wget -nv "http://builds.piwik.org/piwik.zip.asc" || exit 2 | |
gpg --verify piwik.zip.asc || exit 3 | |
# update files in piwik/ directory | |
unzip -o piwik.zip "piwik/*" | sed 's/.*/./' | paste -s -d'.' | |
# show version | |
echo -n "New PIWIK Version: " | |
grep 'const VERSION' piwik/core/Version.php|cut -d"'" -f2 || echo "ERROR: Failed to detect version" >&2 | |
# DB update | |
# double it to make sure | |
piwik/console core:update --no-interaction | |
piwik/console core:update --no-interaction | |
# clean up | |
# no need to `rm`, see: "How to install Piwik.html" | |
rm -v piwik.zip piwik.zip.asc | |
chown -R www-data:www-data . || echo "ERROR: Failed to set permissions." >&2 | |
# purge opcache | |
# see: https://github.com/szepeviktor/wplib/blob/master/share/wplib/opcache-del-dir.php | |
echo -n "Purge cache status: " | |
php /usr/local/share/wplib/opcache-del-dir.php "/var/www/piwik/piwik"; echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment