From a0f5a42e908f64e7d63d36db964587796634ee01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sat, 18 Sep 2021 15:54:06 +0200 Subject: [PATCH 1/2] archwiki: ensure that MediaWiki file cache is invalidated on each MediaWiki update We've hit this problem at least twice in the past, last time with the new Vector skin update. With this change it should not be necessary to do anything manually after an update. --- roles/archwiki/handlers/main.yml | 9 +++++++++ roles/archwiki/tasks/main.yml | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/roles/archwiki/handlers/main.yml b/roles/archwiki/handlers/main.yml index c701c217..89cfdd4e 100644 --- a/roles/archwiki/handlers/main.yml +++ b/roles/archwiki/handlers/main.yml @@ -15,3 +15,12 @@ # reference: https://stackoverflow.com/a/6896903 - name: purge nginx cache command: find /var/lib/nginx/cache -type f -delete + +# The MediaWiki file cache can be invalidated by deleting the files in the +# cache, by setting $wgCacheEpoch to the current time, or by touching the +# LocalSettings.php file (thanks to $wgInvalidateCacheOnLocalSettingsChange +# being set to true). References: +# - https://www.mediawiki.org/wiki/Manual:File_cache +# - https://www.mediawiki.org/wiki/Manual:$wgInvalidateCacheOnLocalSettingsChange +- name: invalidate MediaWiki file cache + file: path="{{ archwiki_dir }}/public/LocalSettings.php" state=touch diff --git a/roles/archwiki/tasks/main.yml b/roles/archwiki/tasks/main.yml index 7ef45cd9..e3bbf020 100644 --- a/roles/archwiki/tasks/main.yml +++ b/roles/archwiki/tasks/main.yml @@ -60,8 +60,10 @@ become_user: "{{ archwiki_user }}" notify: - run wiki updatescript - # purge the nginx cache to make sure clients get the updated assets + # purge the nginx cache and MediaWiki file cache to make sure clients get updated assets + # as well as freshly rendered pages using the new assets - purge nginx cache + - invalidate MediaWiki file cache - name: configure archwiki template: src=LocalSettings.php.j2 dest="{{ archwiki_dir }}/public/LocalSettings.php" owner="{{ archwiki_user }}" group="{{ archwiki_user }}" mode=0640 -- GitLab From 6875bbb8e1ae65e54fd6449b87f5be7e301b3479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sat, 18 Sep 2021 15:57:01 +0200 Subject: [PATCH 2/2] archwiki: clean up old task --- roles/archwiki/tasks/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/roles/archwiki/tasks/main.yml b/roles/archwiki/tasks/main.yml index e3bbf020..f928f702 100644 --- a/roles/archwiki/tasks/main.yml +++ b/roles/archwiki/tasks/main.yml @@ -42,9 +42,6 @@ when: maintenance is not defined tags: ['nginx'] -- name: remove old fastcgi cache directory - file: path=/etc/nginx/wikicache state=absent - - name: configure robots.txt copy: src=robots.txt dest="{{ archwiki_dir }}/robots.txt" owner=root group=root mode=0644 -- GitLab