mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 22:37:29 +00:00
In swarm mode *_CONTAINER_ADDRESS resolves to "$(/usr/bin/resolve-container-id
<stack> <service>)", which must reach /bin/sh unquoted so the subshell runs.
- listmonk: drop the `| quote` filter; shlex.quote single-quoted the whole
"$(...)", suppressing the substitution, so docker received the literal token
("No such container: $(...)").
- joomla: rewrite the docker/container exec tasks from the shell argv-list form
(executed directly, never via /bin/sh, so the $() was never evaluated) to the
free-form string shell, and switch the raw `docker exec` calls to the
`container` wrapper (the argv form had hidden them from the no-raw-docker lint).
- joomla: move the three inline PHP scripts (configuration.php debug toggle, DB
settings patch, OIDC plugin ZIP packaging) out of inline `vars:` into
files/php/*.php, fed via `lookup('file', ...)` over stdin to
`container exec -i ... php --`, with their inputs passed as J_* env vars
(the files/php + stdin convention already used by friendica/espocrm/snipe-it).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.3 KiB
PHP
31 lines
1.3 KiB
PHP
<?php
|
|
$f = getenv('J_CONFIG_FILE');
|
|
if (!file_exists($f)) { fwrite(STDERR, "configuration.php missing\n"); exit(1); }
|
|
$c = file_get_contents($f);
|
|
$changed = 0;
|
|
|
|
$debug = getenv('J_MODE_DEBUG') === '1';
|
|
$err = getenv('J_ERR_LEVEL') ?: 'default';
|
|
|
|
// Clean up previously broken lines
|
|
$c = preg_replace('/^\s*public\s+1\s*=.*?;$/m', '', $c, -1, $nBad1); $changed += $nBad1;
|
|
$c = preg_replace('/^\s*public\s*=\s*maximum;$/m', '', $c, -1, $nBad2); $changed += $nBad2;
|
|
|
|
// Ensure: public $debug = true|false;
|
|
$lineDebug = "public \$debug = " . ($debug ? 'true' : 'false') . ";";
|
|
if (preg_match('/public\s*\$debug\s*=\s*[^;]*;/', $c)) {
|
|
$c = preg_replace('/public\s*\$debug\s*=\s*[^;]*;/', $lineDebug, $c, 1, $n); $changed += $n;
|
|
} else {
|
|
$c = preg_replace("/\n\}\s*$/", "\n\t".$lineDebug."\n}\n", $c, 1, $n); $changed += $n;
|
|
}
|
|
|
|
// Ensure: public $error_reporting = 'maximum'|'default';
|
|
$lineErr = "public \$error_reporting = '" . str_replace("'", "\\'", $err) . "';";
|
|
if (preg_match('/public\s*\$error_reporting\s*=\s*[^;]*;/', $c)) {
|
|
$c = preg_replace('/public\s*\$error_reporting\s*=\s*[^;]*;/', $lineErr, $c, 1, $n); $changed += $n;
|
|
} else {
|
|
$c = preg_replace("/\n\}\s*$/", "\n\t".$lineErr."\n}\n", $c, 1, $n); $changed += $n;
|
|
}
|
|
|
|
if ($changed) { file_put_contents($f, $c); echo "changed"; } else { echo "ok"; }
|