From e8cc3f14e1cb588abc373df90feb4b695d3cb8f0 Mon Sep 17 00:00:00 2001
From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de>
Date: Wed, 2 Sep 2020 17:13:58 +0200
Subject: [PATCH] Update dokuwiki plugins regularly (and automatically)

---
 dokuwiki/tasks/main.yml                    | 1 +
 dokuwiki/templates/crontab.j2              | 1 +
 dokuwiki/templates/update_extensions.sh.j2 | 5 +++++
 3 files changed, 7 insertions(+)
 create mode 100644 dokuwiki/templates/update_extensions.sh.j2

diff --git a/dokuwiki/tasks/main.yml b/dokuwiki/tasks/main.yml
index 47da4a3..f2a81a7 100644
--- a/dokuwiki/tasks/main.yml
+++ b/dokuwiki/tasks/main.yml
@@ -213,6 +213,7 @@
     - indexer
     - cleanup
     - blacklist
+    - update_extensions
   notify:
     - update blacklist
   tags:
diff --git a/dokuwiki/templates/crontab.j2 b/dokuwiki/templates/crontab.j2
index 507ab16..2a7d7c7 100644
--- a/dokuwiki/templates/crontab.j2
+++ b/dokuwiki/templates/crontab.j2
@@ -3,3 +3,4 @@
 39 3 * * * root /usr/local/sbin/dokuwiki-cleanup.sh
 39 4 * * * root /usr/local/sbin/dokuwiki-blacklist.sh
 39 5 * * * root /usr/local/sbin/dokuwiki-indexer.sh
+39 5 * * * root /usr/local/sbin/dokuwiki-update_extensions.sh
diff --git a/dokuwiki/templates/update_extensions.sh.j2 b/dokuwiki/templates/update_extensions.sh.j2
new file mode 100644
index 0000000..ee00c80
--- /dev/null
+++ b/dokuwiki/templates/update_extensions.sh.j2
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+{% for dw in dokuwiki %}
+sudo -u {{ dw.user }} php {{ dw.path }}/bin/plugin.php extension upgrade
+{% endfor %}
-- 
GitLab