#!/bin/bash
# Sur l'hébergement OVH : sauvegarde des extensions et thèmes dans ~/yv-tmp, puis mises à jour par WP-CLI.
d="$1"; WP="/usr/local/php8.3/bin/php $HOME/yv-outils/wp-cli.phar --path=$HOME/$d"; D=$(date -u +%Y%m%dT%H%M%SZ)
mkdir -p ~/yv-tmp/sauv-maj && tar czf ~/yv-tmp/sauv-maj/code-$d-$D.tar.gz -C ~/$d/wp-content plugins themes mu-plugins 2>/dev/null; echo "code sauvegardé : ~/yv-tmp/sauv-maj/code-$d-$D.tar.gz ($(du -h ~/yv-tmp/sauv-maj/code-$d-$D.tar.gz | cut -f1))"
$WP plugin update --all 2>&1 | grep -E "^\||Success|Error|Warning" | tail -20
$WP theme update --all 2>&1 | grep -E "Success|Error|Warning" | tail -3
$WP core update --minor 2>&1 | grep -E "Success|Error|Warning" | tail -2
$WP elementor flush-css 2>&1 | tail -1
$WP cache flush 2>&1 | tail -1
