]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions.php
Fix added for extension update with always active extensions, thanks to profi-concept
[mailer.git] / inc / extensions.php
index fee99ba7a616044fd2c7f32970a484b32fd1e0f2..722fa681cbe2cecdc501c63d0e8a414005f22ea3 100644 (file)
@@ -89,20 +89,25 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false)
                        $SQLs  = array();
                        $test  = false;
 
                        $SQLs  = array();
                        $test  = false;
 
-                       // Backup language as well
-                       $LANG_BCK = $EXT_LANG_PREFIX;
-                       $EXT_ALWAYS_ACTIVE = "N";
-
                        // Load required extension also in update mode
                        $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $EXT_UPDATE_DEPENDS);
 
                        // Check for required file
                        if (FILE_READABLE($file)) {
                        // Load required extension also in update mode
                        $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $EXT_UPDATE_DEPENDS);
 
                        // Check for required file
                        if (FILE_READABLE($file)) {
-                               // File exists so let's load it
+                               // Bacup version number
                                $VER_BACKUP = $EXT_VERSION;
                                $VER_BACKUP = $EXT_VERSION;
+
+                               // Backup language as well
+                               $LANG_BCK = $EXT_LANG_PREFIX;
+
+                               // Save the Parrent $EXT_ALWAYS_ACTIVE for later!
+                               $EXT_ALWAYS_ACTIVE_PARRENT = $EXT_ALWAYS_ACTIVE;
+
+                               // Set EXT_ALWAYS_ACTIVE for update
                                $EXT_ALWAYS_ACTIVE = "N";
                                $EXT_ALWAYS_ACTIVE = "N";
+
+                               // File exists so let's load it
                                require($file);
                                require($file);
-                               $EXT_VERSION = $VER_BACKUP;
 
                                // If versions mismatch update extension first
                                $ext_ver = GET_EXT_VERSION($EXT_UPDATE_DEPENDS);
 
                                // If versions mismatch update extension first
                                $ext_ver = GET_EXT_VERSION($EXT_UPDATE_DEPENDS);
@@ -134,6 +139,15 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false)
                                        // Nothing to register / update before...
                                        $test = true;
                                }
                                        // Nothing to register / update before...
                                        $test = true;
                                }
+
+                               // Restore version number
+                               $EXT_VERSION = $VER_BACKUP;
+
+                               // Restore language back
+                               $EXT_LANG_PREFIX = $LANG_BCK;
+
+                               // Restore $EXT_ALWAYS_ACTIVE with the value from parrent
+                               $EXT_ALWAYS_ACTIVE = $EXT_ALWAYS_ACTIVE_PARRENT;
                        } else {
                                // Required file for update does not exists!
                                $test = true;
                        } else {
                                // Required file for update does not exists!
                                $test = true;
@@ -142,7 +156,6 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false)
 
                        // Finally restore previous SQLs
                        $SQLs = $SQLs2; unset($SQLs2);
 
                        // Finally restore previous SQLs
                        $SQLs = $SQLs2; unset($SQLs2);
-                       $EXT_LANG_PREFIX = $LANG_BCK;
                } else {
                        // Does not depend on an other extension
                        $test = true;
                } else {
                        // Does not depend on an other extension
                        $test = true;