mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 23:38:13 +02:00
Remove non-functional Joomla LDAP integration
- Disabled LDAP feature flag (set to false by default, with comment) - Removed ldapautocreate plugin (PHP + XML) - Deleted LDAP helper tasks (01_ldap_files.yml, 05_ldap.yml, 07_diagnose.yml) - Deleted LDAP CLI helper scripts (cli.php, diagnose.php, plugins.php, auth-trace.php) - Removed LDAP configuration variables from vars/main.yml - Removed LDAP environment variables from env.j2 - Removed LDAP-specific mounts from docker-compose.yml.j2 - Dropped php-ldap installation from Dockerfile - Renamed task files for consistent numbering (02->01_install, 03->02_debug, 04->03_patch, 06->04_assert) Reason: LDAP integration was removed because it was not functional. Conversation: https://chatgpt.com/share/68b09373-7aa8-800f-8f2c-11e27123bad1
This commit is contained in:
52
roles/web-app-joomla/tasks/03_patch.yml
Normal file
52
roles/web-app-joomla/tasks/03_patch.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
- 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
|
Reference in New Issue
Block a user