diff --git a/CLAUDE.md b/CLAUDE.md index bb75aefb..e7ab2dae 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -118,6 +118,7 @@ cd tests && ./run-tests.sh --generate-action-items ## Memory Entries - Do not make standalone 'fixes' which upload separate from the plugin deployment. Instead, always redeploy the whole plugin with your fixes. Before deploying, always remove the old versions of the plugin. Always activate and verify after plugin upload +- The deployment process now automatically clears Breeze cache after plugin activation through wp-cli. This ensures proper cache invalidation and prevents stale content issues. ## Architecture Overview diff --git a/wordpress-dev/bin/deploy-plugin.sh b/wordpress-dev/bin/deploy-plugin.sh index 1d433c1d..44241de4 100755 --- a/wordpress-dev/bin/deploy-plugin.sh +++ b/wordpress-dev/bin/deploy-plugin.sh @@ -123,6 +123,53 @@ else fi fi +# Activate plugin to ensure hooks fire properly +echo "Activating plugin..." +if [ "$DRY_RUN" = true ]; then + echo "[DRY RUN] Would execute: ssh \"$REMOTE_USER@$REMOTE_HOST\" \"cd $REMOTE_PATH_BASE && wp plugin deactivate $PLUGIN_SLUG --allow-root && wp plugin activate $PLUGIN_SLUG --allow-root\"" +else + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && wp plugin deactivate $PLUGIN_SLUG --allow-root 2>/dev/null || true" + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && wp plugin activate $PLUGIN_SLUG --allow-root" + if [ $? -eq 0 ]; then + echo "Plugin activated successfully." + else + echo "Warning: Plugin activation failed." + fi +fi + +# Clear Breeze cache after plugin activation +echo "Clearing Breeze cache..." +if [ "$DRY_RUN" = true ]; then + echo "[DRY RUN] Would clear Breeze cache" +else + # Use existing cache clearing script if available + if [ -f "$(dirname "$0")/clear-breeze-cache.sh" ]; then + echo "Using existing cache clearing script..." + "$(dirname "$0")/clear-breeze-cache.sh" + else + echo "Performing manual Breeze cache clearing..." + # Clear Breeze cache files + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && find wp-content/cache/breeze -type f -name '*.php' -delete 2>/dev/null || true" + # Clear Breeze minified files + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && rm -rf wp-content/uploads/breeze/js/* wp-content/uploads/breeze/css/* 2>/dev/null || true" + # Clear WordPress caches + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && wp cache flush --allow-root 2>/dev/null || true" + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && wp transient delete --all --allow-root 2>/dev/null || true" + # Clear Breeze-specific transients + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && wp transient delete '_breeze_minification' --allow-root 2>/dev/null || true" + fi + echo "Cache clearing completed." +fi + +# Flush rewrite rules +echo "Flushing rewrite rules..." +if [ "$DRY_RUN" = true ]; then + echo "[DRY RUN] Would flush rewrite rules" +else + ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH_BASE && wp rewrite flush --allow-root 2>/dev/null || true" + echo "Rewrite rules flushed." +fi + # Verify deployment echo "Verifying deployment..." if [ "$DRY_RUN" = true ]; then