Last active
April 25, 2018 03:56
-
-
Save szepeviktor/59931721b26fc750cf18 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/gordalina/cachetool | |
echo -n "Purge cache status: " | |
cachetool opcache:reset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment