Conn2Flow
Docs navigation

Reference / Libraries

variaveis.php library

Reading and writing system variables (module _sistema) in the variaveis table — a library unused by the core, distinct from the gestor_variaveis() text system.

Path in the Gestor bibliotecas/variaveis.php

variaveis.php reads and writes system variables: records of the variaveis table with modulo = '_sistema', organized by grupo.

The library is registered as variaveis in $_GESTOR['bibliotecas-dados']. The only place in the core that includes it is the language selector in gestor.php, and even there the functions used are gestor_variaveis(): the include is unnecessary.

Functions

  • variaveis_sistema($grupo, $id = false) loads every variable of the group in a single query and caches it in the global $_VARIAVEIS_SISTEMA[$grupo]. With $id, it returns the value (or null when missing). Without $id, it returns the group's id => value array (empty when there is nothing).

  • variaveis_sistema_incluir($grupo, $id, $valor, $tipo = 'string') creates the variable only when it does not exist yet (it never updates an existing one). A null $valor is stored as NULL.

  • variaveis_sistema_atualizar($grupo, $id, $valor) runs the UPDATE of the value (null stores NULL).

Caveats

  • The queries do not filter by language. If the same variable exists in more than one language, variaveis_sistema() keeps the last record read.

  • variaveis_sistema_atualizar() does not update the cache: within the same request, variaveis_sistema() keeps returning the old value. The function declares global $_VARIAVEIS_id, which is never used.

See also

Functions (generated reference)

Generated from gestor/bibliotecas/variaveis.php · 3 functions

3 of 3

variaveis_sistema

view source · line 41 ↗
variaveis_sistema(string $grupo, string|false $id = false): string|array|null

Retorna variável(is) do sistema.

Parameters

$grupostring
Grupo da variável (obrigatório).
$idstring|false
ID específico da variável (opcional).

Returns

string|array|null
Se $id fornecido, retorna o valor da variável específica.

variaveis_sistema_incluir

view source · line 88 ↗
variaveis_sistema_incluir(string $grupo, string $id, string $valor, string $tipo = 'string'): void

Inclui uma nova variável do sistema.

Parameters

$grupostring
Grupo da variável (obrigatório).
$idstring
ID da variável (obrigatório).
$valorstring
Valor que será incluído (obrigatório).
$tipostring
Tipo da variável (opcional, padrão: 'string').

Returns

void

variaveis_sistema_atualizar

view source · line 132 ↗
variaveis_sistema_atualizar(string $grupo, string $id, string $valor): void

Atualiza o valor de uma variável do sistema.

Parameters

$grupostring
Grupo da variável (obrigatório).
$idstring
ID da variável (obrigatório).
$valorstring
Novo valor que será atribuído (obrigatório).

Returns

void

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