Skip to content

Commit

Permalink
XDOCKER-152: Does not work if database name is not xwiki
Browse files Browse the repository at this point in the history
  • Loading branch information
vmassol committed Jun 27, 2024
1 parent e8e71bd commit 005a3e8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
5 changes: 1 addition & 4 deletions 14/postgres-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ function configure() {
safesed "replacedatabase" $DB_DATABASE /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
safesed "replacejdbcparams" $JDBC_PARAMS /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml

# Set any non-default main wiki database name in the xwiki.cfg file.
if [ "$DB_DATABASE" != "xwiki" ]; then
xwiki_set_cfg "xwiki.db" $DB_DATABASE
fi


echo ' Setting permanent directory...'
xwiki_set_properties 'environment.permanentDirectory' '/usr/local/xwiki/data'
Expand Down
5 changes: 1 addition & 4 deletions 15/postgres-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ function configure() {
safesed "replacedatabase" $DB_DATABASE /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
safesed "replacejdbcparams" $JDBC_PARAMS /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml

# Set any non-default main wiki database name in the xwiki.cfg file.
if [ "$DB_DATABASE" != "xwiki" ]; then
xwiki_set_cfg "xwiki.db" $DB_DATABASE
fi


echo ' Setting permanent directory...'
xwiki_set_properties 'environment.permanentDirectory' '/usr/local/xwiki/data'
Expand Down
5 changes: 1 addition & 4 deletions 16.4/postgres-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ function configure() {
safesed "replacedatabase" $DB_DATABASE /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
safesed "replacejdbcparams" $JDBC_PARAMS /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml

# Set any non-default main wiki database name in the xwiki.cfg file.
if [ "$DB_DATABASE" != "xwiki" ]; then
xwiki_set_cfg "xwiki.db" $DB_DATABASE
fi


echo ' Setting permanent directory...'
xwiki_set_properties 'environment.permanentDirectory' '/usr/local/xwiki/data'
Expand Down
5 changes: 1 addition & 4 deletions 16/postgres-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ function configure() {
safesed "replacedatabase" $DB_DATABASE /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
safesed "replacejdbcparams" $JDBC_PARAMS /usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml

# Set any non-default main wiki database name in the xwiki.cfg file.
if [ "$DB_DATABASE" != "xwiki" ]; then
xwiki_set_cfg "xwiki.db" $DB_DATABASE
fi


echo ' Setting permanent directory...'
xwiki_set_properties 'environment.permanentDirectory' '/usr/local/xwiki/data'
Expand Down
13 changes: 9 additions & 4 deletions template/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,15 @@ function configure() {
safesed "replacedatabase" \$DB_DATABASE /usr/local/tomcat/webapps/\$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
safesed "replacejdbcparams" \$JDBC_PARAMS /usr/local/tomcat/webapps/\$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml

# Set any non-default main wiki database name in the xwiki.cfg file.
if [ "\$DB_DATABASE" != "xwiki" ]; then
xwiki_set_cfg "xwiki.db" \$DB_DATABASE
fi
<% // XWiki uses PostgreSQL schemas by default and the schema name is defined by xwiki.db. Thus we shouldn't change it
// when the db name is not the default one (the schema must remain being "public"). For MySQL and MariaDB, we use
// different dbs (and not schemas and tbus "xwiki.db" must be set.
if (db != 'postgres') {
println '''# Set any non-default main wiki database name in the xwiki.cfg file.'''
println ''' if [ "\$DB_DATABASE" != "xwiki" ]; then'''
println ''' xwiki_set_cfg "xwiki.db" \$DB_DATABASE'''
print ''' fi'''
} %>

echo ' Setting permanent directory...'
xwiki_set_properties 'environment.permanentDirectory' '/usr/local/xwiki/data'
Expand Down

0 comments on commit 005a3e8

Please sign in to comment.