From 5588e5cf5400de6394d5f15b7af140a5733f9e32 Mon Sep 17 00:00:00 2001 From: James Montalvo Date: Thu, 25 Jan 2024 15:39:41 -0600 Subject: [PATCH] fix: clear then rebuild /opt/htdocs/wikis to remove deleted wikis --- src/roles/mediawiki/tasks/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/roles/mediawiki/tasks/main.yml b/src/roles/mediawiki/tasks/main.yml index cb202dfb..0e8aa88c 100644 --- a/src/roles/mediawiki/tasks/main.yml +++ b/src/roles/mediawiki/tasks/main.yml @@ -449,6 +449,32 @@ set_fact: wikis_to_rebuild_data: [] + +# Prior to running verify-wiki, which will create an {{m_htdocs}}/wikis/{{wiki_id}}/config +# symlink to {{m_deploy}}/something, nuke the entirety of {{m_htdocs}}/wikis. All it holds is +# symlinks anyway, so no data will be lost. Running verify-wiki for each wiki will regenerate +# these symlinks for all valid wikis. These two tasks are tagged "verify-wiki" such that if +# `--skip-tags verify-wiki` is run, it doesn't nuke this directory then NOT recreate due to +# verify-wiki not being run. +# +# Without these tasks, old wikis that have been deleted from config will show up in +# the wiki landing page. Nuking this directory and recreating it clears them out. +- name: Delete content & directory to remove any wikis deleted from config + file: + path: "{{ m_htdocs }}/wikis" + state: absent + tags: + - verify-wiki +- name: Recreate {{ m_htdocs }}/wikis directory + file: + path: "{{ m_htdocs }}/wikis" + state: directory + owner: "{{ user_apache }}" + group: "{{ group_apache }}" + mode: 0755 + tags: + - verify-wiki + # Check that all wikis in config are present on app and DB servers - name: Ensure defined wikis exist include_role: