1
0
Fork 0

Found old wordpress update script, mixing svn and localized version

This commit is contained in:
Chl 2019-09-05 12:58:45 +02:00
parent 273b6c8631
commit f25c3e0c9a

34
oldies/update-wordpress-fr.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/sh
set -e
set -x
TMPDIR="/tmp/wordpress-update"
WORKINGDIR="/var/www/wordpress"
echo "Backup..."
/usr/local/share/scripts-admin/sauvegarde_mysql.sh
cd "$WORKINGDIR" && tar -czf /var/backups/www/www_$( date +\%Y\%m\%d-\%H\%M\%S ).tar.gz ./
echo "Téléchargement de la dernière version..."
mkdir "$TMPDIR"
cd "$TMPDIR"
wget --content-disposition "https://fr.wordpress.org/latest-fr_FR.zip"
WORDPRESSPACKAGE="$( ls )"
WORDPRESSVERSION="$( echo "$WORDPRESSPACKAGE" | cut -d - -f 2 )"
if [ "$( echo "$WORDPRESSVERSION" | egrep -c '^[0-9\.]{3,6}$' )" -ne 1 ]; then
echo "ERROR: suspicious version number : $WORDPRESSVERSION." >&2
exit 1
fi
echo "Extracting languages..."
unzip "$TMPDIR/$WORDPRESSPACKAGE" 'wordpress/wp-content/languages/*'
echo "Updating/switching working dir..."
cd "$WORKINGDIR"
svn sw "https://core.svn.wordpress.org/tags/$WORDPRESSVERSION" .
rm -rf wp-content/languages
cp -ir "$TMPDIR/wordpress/wp-content/languages" ./wp-content/
echo "Final cleanup..."
rm -rf "$TMPDIR"