diff --git a/roles/nextcloud/README.md b/roles/nextcloud/README.md index f4cafa9..5d16488 100644 --- a/roles/nextcloud/README.md +++ b/roles/nextcloud/README.md @@ -14,11 +14,6 @@ backends. LDAP via `occ` — every setting is read first and only written when the stored value differs, so re-runs don't churn - Sets up notify_push (when enabled) -- Applies an in-container PHP source workaround for the upstream - `UserConfig::getValueBool` TypeError (nextcloud/server#59629, fixed in - master via PR #59646 with no stable33 backport before 33.0.4). - Idempotent via grep guard; remove the patch task once - `nextcloud_image` is >= 33.0.4. ## Requirements diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index c43bc4d..e33088b 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -49,61 +49,6 @@ project_src: "{{ nextcloud_docker_compose_dir }}" state: present -# nextcloud/server#59629: UserConfig::getValueBool() passes a non-string from -# getTypedValue() into strtolower() under PHP 8.x + OPcache, throwing a -# TypeError on every authenticated request once user_ldap is involved. Fix -# is in master (PR #59646) but no stable33 backport landed before 33.0.4. -# Apply the (string) cast in-container; idempotent via grep guard. Remove -# this block once nextcloud_image >= 33.0.4. -- name: Discover nextcloud php containers needing the UserConfig patch - ansible.builtin.shell: - cmd: >- - docker ps --filter "label=com.docker.compose.project={{ nextcloud_docker_compose_dir | basename }}" - --filter "label=com.docker.compose.service=nextcloud" - --format '{% raw %}{{.Names}}{% endraw %}' - register: _nextcloud_php_containers - changed_when: false - -- name: Check UserConfig.php patch status per container - ansible.builtin.shell: - # rc 0 -> already patched; rc 1 -> still the unpatched original; rc 2 -> - # neither marker present (upstream drift -> the guard task below fails loud). - cmd: >- - docker exec {{ item }} sh -c ' - grep -q "strtolower((string)\$this->getTypedValue" /var/www/html/lib/private/Config/UserConfig.php && exit 0; - grep -q "strtolower(\$this->getTypedValue" /var/www/html/lib/private/Config/UserConfig.php && exit 1; - exit 2' - loop: "{{ _nextcloud_php_containers.stdout_lines }}" - register: _nextcloud_userconfig_check - changed_when: false - failed_when: false - -- name: Fail if the UserConfig.php source drifted from the expected upstream line - ansible.builtin.fail: - msg: >- - Neither the patched nor the expected original strtolower($this->getTypedValue(...)) - line was found in {{ item.item }}:/var/www/html/lib/private/Config/UserConfig.php. - The nextcloud/server#59629 workaround can no longer locate its target — the upstream - source likely changed. Re-verify whether the fix shipped (then drop this block) or - update the sed expression. Silently skipping would let the TypeError regress. - loop: "{{ _nextcloud_userconfig_check.results }}" - loop_control: - label: "{{ item.item }}" - when: - - item.rc | default(2) == 2 - -- name: Apply UserConfig::getValueBool string-cast workaround - ansible.builtin.shell: - cmd: >- - docker exec {{ item.item }} - sed -i 's|$b = strtolower($this->getTypedValue|$b = strtolower((string)$this->getTypedValue|' - /var/www/html/lib/private/Config/UserConfig.php - loop: "{{ _nextcloud_userconfig_check.results }}" - loop_control: - label: "{{ item.item }}" - when: - - item.rc | default(2) == 1 - - name: Wait for Nextcloud to be ready ansible.builtin.shell: cmd: docker compose exec -T nextcloud php /var/www/html/occ status --output=json