Files
computer-playbook/roles/web-app-joomla/tasks/04_patch.yml
Kevin Veen-Birkenbach 62d20fbb71 Joomla: Add upload-size support, introduce php-upload.ini, refactor task numbering, update Docker Compose and override logout client_max_body_size
This commit adds dynamic upload size configuration (upload_max_filesize + post_max_size), introduces a dedicated php-upload.ini template, mounts it through Docker Compose, renumbers all task files consistently, updates main.yml flow, and overrides client_max_body_size inside the logout role.

Improves clarity, consistency, and brings Joomla in line with other IN roles.

See: https://chatgpt.com/share/6927075c-4de0-800f-bcee-b1f5193e4a99
2025-11-26 14:59:51 +01:00

53 lines
1.6 KiB
YAML

- name: "Ensure configuration.php DB settings match inventory"
command:
argv:
- docker
- exec
- -e
- J_DBTYPE={{ JOOMLA_DB_CONNECTOR }}
- -e
- J_DBHOST={{ database_host }}:{{ database_port }}
- -e
- J_DBUSER={{ database_username }}
- -e
- J_DBPASS={{ database_password }}
- -e
- J_DBNAME={{ database_name }}
- "{{ JOOMLA_CONTAINER }}"
- php
- -r
- |
$f = '{{ JOOMLA_CONFIG_FILE }}';
if (!file_exists($f)) { exit(0); }
$c = file_get_contents($f);
$changed = 0;
$map = [
'dbtype' => getenv('J_DBTYPE'),
'host' => getenv('J_DBHOST'),
'user' => getenv('J_DBUSER'),
'password' => getenv('J_DBPASS'),
'db' => getenv('J_DBNAME'),
];
foreach ($map as $k => $v) {
// Escape single quotes for safe embedding into the PHP source string
$vEsc = str_replace("'", "\\'", $v);
// Match current value in config: public $key = '...';
if (preg_match("/public \\$".$k."\\s*=\\s*'([^']*)';/", $c, $m) && $m[1] !== $v) {
$c = preg_replace(
"/public \\$".$k."\\s*=\\s*'[^']*';/",
"public $".$k." = '".$vEsc."';",
$c
);
$changed = 1;
}
}
if ($changed) { file_put_contents($f, $c); echo "changed"; } else { echo "ok"; }
register: cfg_patch
changed_when: cfg_patch.stdout == "changed"
failed_when: cfg_patch.rc != 0
when: joomla_installed.rc == 0