Skip to content

Instantly share code, notes, and snippets.

@gurdiga
Last active September 23, 2019 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gurdiga/451f69d12f4c8f9673c9a9071a510ad4 to your computer and use it in GitHub Desktop.
Save gurdiga/451f69d12f4c8f9673c9a9071a510ad4 to your computer and use it in GitHub Desktop.
A script to automate the update phpBB3 from a given download URL. Accepts the download URL as its single argument.
#!/bin/bash
# https://sipb.mit.edu/doc/safe-shell/
set -xeuf -o pipefail
archive_url="$1"
archive_name=`basename $archive_url`
wget --no-verbose $archive_url
mv $archive_name tmp
rm -rf ~/tmp/phpBB3
unzip -q ~/tmp/$archive_name -d tmp
rm -rf ~/tmp/phpBB3/{config.php,images,store,files}
backup_name=`date +%F`
mysqldump phpbb > ~/backup/phpbb-$backup_name.sql
rm -rf ~/backup/phpbb-$backup_name-files
cp -rp /var/www/html ~/backup/phpbb-$backup_name-files
rm -rf /var/www/html/{vendor,cache}
rsync -r ~/tmp/phpBB3/ /var/www/html
chown -R www-data:www-data /var/www/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment