mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 07:18:09 +02:00
Discussion: https://chatgpt.com/share/68b10c0a-c308-800f-93ac-2ffb386cf58b - Split tasks into 01_install, 02_debug, 03_admin, 04_extensions, 05_oidc. - Ensure unzip+git+composer on demand in the container; run Composer as www-data with COMPOSER_HOME=/tmp/composer. - Idempotently unpack/install PluggableAuth & OpenIDConnect; run composer install only if vendor/ is missing. - Add sanity check for Jumbojett\OpenIDConnectClient. - Copy oidc.php only when changed and append a single require_once to LocalSettings.php. - Use REL1_44-compatible numeric array for $wgPluggableAuth_Config; set $wgPluggableAuth_ButtonLabelMessage. - Debug: add debug.php that logs to STDERR (visible via docker logs); toggle cleanly with MODE_DEBUG. - Enable OIDC feature in config; add paths/OIDC/extension vars in vars/main.yml. fix(services): include SYS_SERVICE_GROUP_CLEANUP in StartPre lock (ssd-hdd, docker-hard). fix(desktop/joomla): simplify MODE_DEBUG templating. chore: minor cleanups and renames.
46 lines
1.9 KiB
YAML
46 lines
1.9 KiB
YAML
- name: "Toggle Joomla debug flags safely (configuration.php)"
|
|
command:
|
|
argv:
|
|
- docker
|
|
- exec
|
|
- -e
|
|
- "J_MODE_DEBUG={{ MODE_DEBUG | bool | ternary('1','0') }}"
|
|
- -e
|
|
- "J_ERR_LEVEL={{ MODE_DEBUG | bool | ternary('maximum','default') }}"
|
|
- "{{ JOOMLA_CONTAINER }}"
|
|
- php
|
|
- -r
|
|
- |
|
|
$f = '{{ JOOMLA_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"; }
|
|
register: j_cfg_debug
|
|
changed_when: (j_cfg_debug.stdout | trim) == "changed"
|
|
failed_when: j_cfg_debug.rc != 0
|