diff --git a/roles/archwiki/handlers/main.yml b/roles/archwiki/handlers/main.yml index c701c2176669f53d87fcf0ff2e6c1f79ab5b747e..89cfdd4efef3c3664178b53cc4b91f976132653d 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 7ef45cd9cedd81047a1fafc27a6170801de42a84..f928f70247e680f4c7ef8bb177529b0751b9f817 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 @@ -60,8 +57,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