feat: Enhance deployment process with automatic Breeze cache clearing

- Update deploy-plugin.sh to automatically clear Breeze cache after plugin activation
- Add plugin deactivation/reactivation to ensure hooks fire properly
- Include WordPress cache flushing and transient clearing
- Add rewrite rules flushing
- Update CLAUDE.md documentation with new deployment workflow
- Ensures cache invalidation prevents stale content issues after deployments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
bengizmo 2025-05-21 23:08:54 -03:00
parent cec59b1f6e
commit 800b5b69ff
2 changed files with 48 additions and 0 deletions

View file

@ -118,6 +118,7 @@ cd tests && ./run-tests.sh --generate-action-items
## Memory Entries ## 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 - 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 ## Architecture Overview

View file

@ -123,6 +123,53 @@ else
fi fi
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 # Verify deployment
echo "Verifying deployment..." echo "Verifying deployment..."
if [ "$DRY_RUN" = true ]; then if [ "$DRY_RUN" = true ]; then