Skip to content

Instantly share code, notes, and snippets.

Last active April 25, 2018 03:56
What would you like to do?
Piwik automatic update - bash script
# Start this scipt above the /piwik directory.
# We assume that the webserver runs under www-data.
# download & verify
wget -nv "" || exit 1
wget -nv "" || exit 2
gpg --verify || exit 3
# update files in piwik/ directory
unzip -o "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
chown -R www-data:www-data . || echo "ERROR: Failed to set permissions." >&2
# purge opcache
# see:
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