Files
claude-plugins/wordpress/skills/wp-cli/scripts/wp-auto.sh
Emanuel Almeida 9404af7ac9 feat: sync all plugins, skills, agents updates
New plugins: core-tools
New skills: auto-expense, ticket-triage, design, security-check,
  aiktop-tasks, daily-digest, imap-triage, index-update, mindmap,
  notebooklm, proc-creator, tasks-overview, validate-component,
  perfex-module, report, calendar-manager
New agents: design-critic, design-generator, design-lead,
  design-prompt-architect, design-researcher, compliance-auditor,
  metabase-analyst, gitea-integration-specialist
Updated: all plugin configs, knowledge datasets, existing skills

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 17:16:32 +00:00

35 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# wp-auto.sh — WP-CLI com detecção automática de PHP no CWP
# Uso: /root/wp-auto.sh --path=/home/USER/public_html [comando wp-cli]
# Exemplo: /root/wp-auto.sh --path=/home/site/public_html plugin list
# Pegar utilizador do directório de trabalho
if [[ "$*" == *"--path="* ]]; then
WP_PATH=$(echo "$@" | grep -o '\-\-path=[^ ]*' | cut -d= -f2)
else
WP_PATH=$(pwd)
fi
USER=$(stat -c '%U' "$WP_PATH" 2>/dev/null || echo "nobody")
# Encontrar versão PHP-FPM activa para este utilizador
PHP_FPM_PROCESS=$(ps aux | grep "php-fpm: pool ${USER}" | grep -v grep | head -n 1)
PHP_VERSION=$(echo "$PHP_FPM_PROCESS" | grep -o 'php-fpm[0-9][0-9]' | grep -o '[0-9][0-9]' | head -1)
if [ -z "$PHP_VERSION" ]; then
echo "⚠ Usando PHP 8.2 (padrão — pool ${USER} não encontrado)" >&2
PHP_PATH="/opt/alt/php-fpm82/usr/bin/php"
else
PHP_PATH="/opt/alt/php-fpm${PHP_VERSION}/usr/bin/php"
echo " PHP ${PHP_VERSION} detectado para utilizador ${USER}" >&2
fi
# Verificar se o PHP existe
if [ ! -f "$PHP_PATH" ]; then
echo "❌ PHP não encontrado: $PHP_PATH — usando PHP 8.3" >&2
PHP_PATH="/opt/alt/php-fpm83/usr/bin/php"
fi
# Executar WP-CLI
exec "$PHP_PATH" /usr/local/bin/wp --allow-root "$@"