From 353d6eb4b54742c47fa8c1e4ac7bec4e9074bd3f Mon Sep 17 00:00:00 2001
From: Luke Murphy <lukewm@riseup.net>
Date: Thu, 15 Oct 2020 18:23:45 +0200
Subject: [PATCH] Install optional OpenIDConnect extension

---
 compose.yml        |  1 +
 entrypoint.sh.tmpl | 18 ++++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/compose.yml b/compose.yml
index d3721a7..b46139b 100644
--- a/compose.yml
+++ b/compose.yml
@@ -12,6 +12,7 @@ services:
       - MEDIAWIKI_SITENAME
       - MEDIAWIKI_SITENAMESPACE
       - SAML_ENABLED
+      - OPENID_ENABLED
       - DB_HOST=db
       - DB_USER=mediawiki
       - DB_NAME=mediawiki
diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl
index c753120..0a451e1 100755
--- a/entrypoint.sh.tmpl
+++ b/entrypoint.sh.tmpl
@@ -35,10 +35,20 @@ install_extensions() {
 			/var/www/html/extensions/PluggableAuth
 	fi
 
-	if [ ! -d /var/www/html/extensions/SimpleSAMLphp ]; then
-		git clone --depth 1 -b REL1_32 \
-			https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SimpleSAMLphp \
-			/var/www/html/extensions/SimpleSAMLphp
+	if [ -n "$SAML_ENABLED" ]; then
+		if [ ! -d /var/www/html/extensions/SimpleSAMLphp ]; then
+			git clone --depth 1 -b REL1_32 \
+				https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SimpleSAMLphp \
+				/var/www/html/extensions/SimpleSAMLphp
+		fi
+	fi
+
+	if [ -n "$OPENID_ENABLED" ]; then
+		if [ ! -d /var/www/html/extensions/OpenIDConnect]; then
+			git clone --depth 1 -b REL1_35 \
+				https://gerrit.wikimedia.org/r/admin/repos/mediawiki/extensions/OpenIDConnect
+				/var/www/html/extensions/OpenIDConnect
+		fi
 	fi
 }