From 28eae59f9632a5df80bd98ac5a29d3d9921f318e Mon Sep 17 00:00:00 2001
From: Thomas Mortagne <thomas.mortagne@gmail.com>
Date: Tue, 24 Apr 2018 09:10:14 +0200
Subject: [PATCH] [misc] File store is the default since 10.3

---
 10/mysql-tomcat/xwiki/docker-entrypoint.sh    | 6 ------
 10/postgres-tomcat/xwiki/docker-entrypoint.sh | 6 ------
 9/mysql-tomcat/xwiki/docker-entrypoint.sh     | 1 +
 9/postgres-tomcat/xwiki/docker-entrypoint.sh  | 1 +
 template/xwiki/docker-entrypoint.sh           | 4 +++-
 5 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/10/mysql-tomcat/xwiki/docker-entrypoint.sh b/10/mysql-tomcat/xwiki/docker-entrypoint.sh
index 4e7f232..e72e445 100755
--- a/10/mysql-tomcat/xwiki/docker-entrypoint.sh
+++ b/10/mysql-tomcat/xwiki/docker-entrypoint.sh
@@ -121,12 +121,6 @@ function configure() {
   safesed "replacecontainer" $DB_HOST /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
   safesed "replacedatabase" $DB_DATABASE /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
 
-  echo '  Using filesystem-based attachments...'
-  xwiki_set_cfg 'xwiki.store.attachment.hint' 'file'
-  xwiki_set_cfg 'xwiki.store.attachment.versioning.hint' 'file'
-  xwiki_set_cfg 'xwiki.store.attachment.recyclebin.content.hint' 'file'
-  echo '  Using filesystem-based deleted documents...'
-  xwiki_set_cfg 'xwiki.store.recyclebin.content.hint' 'file'
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
diff --git a/10/postgres-tomcat/xwiki/docker-entrypoint.sh b/10/postgres-tomcat/xwiki/docker-entrypoint.sh
index 4e7f232..e72e445 100755
--- a/10/postgres-tomcat/xwiki/docker-entrypoint.sh
+++ b/10/postgres-tomcat/xwiki/docker-entrypoint.sh
@@ -121,12 +121,6 @@ function configure() {
   safesed "replacecontainer" $DB_HOST /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
   safesed "replacedatabase" $DB_DATABASE /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
 
-  echo '  Using filesystem-based attachments...'
-  xwiki_set_cfg 'xwiki.store.attachment.hint' 'file'
-  xwiki_set_cfg 'xwiki.store.attachment.versioning.hint' 'file'
-  xwiki_set_cfg 'xwiki.store.attachment.recyclebin.content.hint' 'file'
-  echo '  Using filesystem-based deleted documents...'
-  xwiki_set_cfg 'xwiki.store.recyclebin.content.hint' 'file'
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
diff --git a/9/mysql-tomcat/xwiki/docker-entrypoint.sh b/9/mysql-tomcat/xwiki/docker-entrypoint.sh
index 4e7f232..0a7e24f 100755
--- a/9/mysql-tomcat/xwiki/docker-entrypoint.sh
+++ b/9/mysql-tomcat/xwiki/docker-entrypoint.sh
@@ -127,6 +127,7 @@ function configure() {
   xwiki_set_cfg 'xwiki.store.attachment.recyclebin.content.hint' 'file'
   echo '  Using filesystem-based deleted documents...'
   xwiki_set_cfg 'xwiki.store.recyclebin.content.hint' 'file'
+
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
diff --git a/9/postgres-tomcat/xwiki/docker-entrypoint.sh b/9/postgres-tomcat/xwiki/docker-entrypoint.sh
index 4e7f232..0a7e24f 100755
--- a/9/postgres-tomcat/xwiki/docker-entrypoint.sh
+++ b/9/postgres-tomcat/xwiki/docker-entrypoint.sh
@@ -127,6 +127,7 @@ function configure() {
   xwiki_set_cfg 'xwiki.store.attachment.recyclebin.content.hint' 'file'
   echo '  Using filesystem-based deleted documents...'
   xwiki_set_cfg 'xwiki.store.recyclebin.content.hint' 'file'
+
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
diff --git a/template/xwiki/docker-entrypoint.sh b/template/xwiki/docker-entrypoint.sh
index da52db7..dbff90c 100755
--- a/template/xwiki/docker-entrypoint.sh
+++ b/template/xwiki/docker-entrypoint.sh
@@ -120,13 +120,15 @@ function configure() {
   safesed "replacepassword" \$DB_PASSWORD /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
   safesed "replacecontainer" \$DB_HOST /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
   safesed "replacedatabase" \$DB_DATABASE /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
-
+<% if (xwikiVersion.startsWith('9.'))
+print '''
   echo '  Using filesystem-based attachments...'
   xwiki_set_cfg 'xwiki.store.attachment.hint' 'file'
   xwiki_set_cfg 'xwiki.store.attachment.versioning.hint' 'file'
   xwiki_set_cfg 'xwiki.store.attachment.recyclebin.content.hint' 'file'
   echo '  Using filesystem-based deleted documents...'
   xwiki_set_cfg 'xwiki.store.recyclebin.content.hint' 'file'
+'''%>
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "\$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "\$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
-- 
GitLab