Conn2Flow
Docs navigation

Reference / Libraries

atualizacoes-execucao.php library

System update triggered through the API: allow-listed arguments, command-line PHP, trigger and state (req-201).

Path in the Gestor bibliotecas/atualizacoes-execucao.php

Basis of POST /_api/system/update with action=run and run-status (req-201 / BATCH-209). It is pure (no Gestor). What runs on the server is the same CLI updater (atualizacoes-sistema.php), with lock, snapshot, dump, check and automatic restore.

Usage

  • atualizacoes_execucao_argv($opcoes, $dominio) translates API options into updater arguments. It accepts only those in ATUALIZACOES_EXECUCAO_OPCOES and sanitizes values (tag, URL without &/;/quotes, IP, tables, days). What fails comes back in recusadas. It always adds --log-stdout, so the run log carries the snapshot and check lines.

  • atualizacoes_execucao_php_cli($preferido) finds the command-line PHP. Inside PHP-FPM, PHP_BINARY is FPM itself.

  • atualizacoes_execucao_disparar($base, $id, $argv, $meta, $php) triggers in the background (nohup and setsid), with output in <id>.log and the exit code in <id>.exit, inside temp/atualizacoes/runs/. It uses pipes, not /dev/null, because HestiaCP's open_basedir blocks opening /dev/null from PHP. On failure it writes exit code 1 so the run is not left "running".

  • atualizacoes_execucao_estado($log, $exit) reads the state: no code yet means running; updater codes become success, rolled_back (6), locked (8) and error-*. It also extracts snapshot, check, automatic restore, errors and the end of the log.

  • atualizacoes_execucao_novo_id(), atualizacoes_execucao_id_valido() and atualizacoes_execucao_pasta() handle the run-<date>-<suffix> id and the folder.

Functions

Generated from gestor/bibliotecas/atualizacoes-execucao.php · 7 functions

7 of 7

atualizacoes_execucao_argv

view source · line 45 ↗
atualizacoes_execucao_argv(array $opcoes, string $dominio): array

Argumentos do atualizador a partir das opções da API. Só entram as opções da lista branca; valores são limpos (tag, URL, IP, tabelas, dias). Opção desconhecida ou valor inválido vai para recusadas.

Parameters

$opcoesarray
$dominiostring

Returns

array
['argv' => string[], 'recusadas' => string[]]

atualizacoes_execucao_php_cli

view source · line 76 ↗
atualizacoes_execucao_php_cli(?string $preferido = null): string

PHP de linha de comando. Dentro do PHP-FPM, PHP_BINARY é o próprio FPM; procura, na ordem: $preferido (ex.: ATUALIZACOES_PHP_CLI), php<maior>.<menor> e php na pasta dos binários do PHP, e por fim php no PATH.

Parameters

$preferido?string

Returns

string

atualizacoes_execucao_disparar

view source · line 92 ↗
atualizacoes_execucao_disparar(string $base, string $id, array $argv, array $meta, string $php): array

Dispara o atualizador em segundo plano, desligado da requisição (nohup + setsid quando existe). A saída vai para <id>.log e o código de saída para <id>.exit; <id>.json guarda o pedido.

Parameters

$basestring
$idstring
$argvarray
$metaarray
$phpstring

Returns

array
['ok' => bool, 'erro' => string, 'id' => string, 'log' => string]

atualizacoes_execucao_estado

view source · line 127 ↗
atualizacoes_execucao_estado(string $log, ?string $exit): array

Estado de uma execução a partir do log e do código de saída (sem o código: ainda rodando).

Parameters

$logstring
$exit?string

Returns

array
['status' => string, 'codigo' => int|null, 'snapshot' => string|null, 'saude' => string|null,

The Future is Hybrid: Human + AI.

Conn2Flow is the tool. If you need the Architect to design your company's strategy using this technology...

Hire Specialized Consulting