Update app.py
Browse files
app.py
CHANGED
|
@@ -15,12 +15,13 @@ def execute_wp_cli(command, args):
|
|
| 15 |
if not wp_path or not wp_user or not wp_password:
|
| 16 |
return "Erro: Variáveis de ambiente WP_PATH, WP_USER ou WP_PASSWORD não definidas."
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
full_command = ['wp', '--path=' + wp_path, '
|
| 20 |
|
| 21 |
# Executa o comando WP-CLI
|
| 22 |
-
result = subprocess.run(full_command, input=wp_password + "\n", capture_output=True, text=True
|
| 23 |
-
|
|
|
|
| 24 |
if result.returncode != 0:
|
| 25 |
return f"Erro ao executar o comando: {result.stderr}"
|
| 26 |
return result.stdout
|
|
|
|
| 15 |
if not wp_path or not wp_user or not wp_password:
|
| 16 |
return "Erro: Variáveis de ambiente WP_PATH, WP_USER ou WP_PASSWORD não definidas."
|
| 17 |
|
| 18 |
+
# Configura o comando WP-CLI completo
|
| 19 |
+
full_command = ['wp', '--path=' + wp_path, 'cli', command] + args.split()
|
| 20 |
|
| 21 |
# Executa o comando WP-CLI
|
| 22 |
+
result = subprocess.run(full_command, input=wp_password + "\n", capture_output=True, text=True)
|
| 23 |
+
|
| 24 |
+
# Verifica se houve erro na execução
|
| 25 |
if result.returncode != 0:
|
| 26 |
return f"Erro ao executar o comando: {result.stderr}"
|
| 27 |
return result.stdout
|