34 lines
1,006 B
Bash
Executable file
34 lines
1,006 B
Bash
Executable file
#!/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"
|