Prechádzať zdrojové kódy

Always create wp-config from template to ensure we have latest config

Girish Ramakrishnan 10 rokov pred
rodič
commit
151e3431fb
3 zmenil súbory, kde vykonal 5 pridanie a 8 odobranie
  1. 0 3
      Dockerfile
  2. 2 2
      start.sh
  3. 3 3
      wp-config.php.template

+ 0 - 3
Dockerfile

@@ -23,9 +23,6 @@ RUN a2enmod php5
 # supervisor
 ADD supervisor-apache2.conf /etc/supervisor/conf.d/apache2.conf
 
-# these links will become valid after setup is run
-RUN ln -s /app/data/wp-config.php /app/code/wp-config.php
-
 EXPOSE 80
 
 CMD [ "/app/code/start.sh" ]

+ 2 - 2
start.sh

@@ -3,7 +3,7 @@
 set -eux
 
 if [[ -z "$(ls -A /app/data)" ]]; then
-    cp /app/configs/wp-config.php.template /app/data/wp-config.php
+    ln -sf /app/data/wp-config.php /app/code/wp-config.php
     mv /app/code/wp-content /app/data/wp-content/
     ln -s /app/data/wp-content /app/code/wp-content
 fi
@@ -27,7 +27,7 @@ sed -e "s/define('DB_NAME',.*/define('DB_NAME', '${db}');/" \
     -e "s/define('DB_HOST',.*/define('DB_HOST', '${host}');/" \
     -e "s|define('WP_HOME',.*|define('WP_HOME', 'https://$(hostname -f)');|" \
     -e "s|define('WP_SITEURL',.*|define('WP_SITEURL', 'https://$(hostname -f)');|" \
-    -i /app/data/wp-config.php
+    /app/configs/wp-config.php.template > /app/code/wp-config.php
 
 /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i MediaWiki
 

+ 3 - 3
wp-config.php.template

@@ -89,6 +89,9 @@ if ( !defined('ABSPATH') )
 /** Sets up WordPress vars and included files. */
 require_once(ABSPATH . 'wp-settings.php');
 
+define('WP_HOME', '');
+define('WP_SITEURL', '');
+
 /*
  http://cmanios.wordpress.com/2014/04/12/nginx-https-reverse-proxy-to-wordpress-with-apache-http-and-different-port/
  http://wordpress.org/support/topic/compatibility-with-wordpress-behind-a-reverse-proxy
@@ -98,9 +101,6 @@ require_once(ABSPATH . 'wp-settings.php');
 if (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) {
     $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
 
-    define('WP_HOME', '');
-    define('WP_SITEURL', '');
-
     if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
         $_SERVER['HTTPS']='on';
 }