Parcourir la source

Unpack plugins on every run

Girish Ramakrishnan il y a 9 ans
Parent
commit
429b97ab7d
1 fichiers modifiés avec 14 ajouts et 7 suppressions
  1. 14 7
      start.sh

+ 14 - 7
start.sh

@@ -37,9 +37,18 @@ if [[ ! -f "/app/data/.dbsetup" ]]; then
         --admin_email="${admin_email}"
     echo "WP is now installed"
 
-    # install and backup the plugins. mu plugins are a "flat" structure"
-    # sadly mu-plugins can still be re-configured, just not uninstallable
-    echo "Unpacking plugins on first run"
+    touch "/app/data/.dbsetup"
+else
+    # Update wordpress
+    echo "Updating wordpress database"
+    $WP core update-db
+fi
+
+# install and backup the plugins. mu plugins are a "flat" structure
+# sadly mu-plugins can still be re-configured, just not uninstallable
+# We have to do this on every run to get plugin updates
+if [[ ! -f "/run/wordpress/plugins_unpacked" ]]; then
+    echo "Unpacking plugins"
     unzip -d /app/data/wp-content/mu-plugins/ /app/code/disable-wordpress-updates.zip
     mv /app/data/wp-content/mu-plugins/disable-wordpress-updates/* /app/data/wp-content/mu-plugins/
     rm -rf /app/data/wp-content/mu-plugins/disable-wordpress-updates/
@@ -52,11 +61,9 @@ if [[ ! -f "/app/data/.dbsetup" ]]; then
     mv /app/data/wp-content/mu-plugins/authLdap-*/* /app/data/wp-content/mu-plugins/
     rm -rf /app/data/wp-content/mu-plugins/authLdap-*/
 
-    touch "/app/data/.dbsetup"
+    touch /run/wordpress/plugins_unpacked
 else
-    # Update wordpress
-    echo "Updating wordpress database"
-    $WP core update-db
+    echo "Plugins already unpacked from previous run" # restarts
 fi
 
 # configure WP mail smtp plugin (smtp_user, smtp_pass can be set when supported)