]> git.mxchange.org Git - mailer.git/commitdiff
Fixes for extension problems while installing/removing (still double-registration...
authorRoland Häder <roland@mxchange.org>
Fri, 31 Jul 2009 22:04:06 +0000 (22:04 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 31 Jul 2009 22:04:06 +0000 (22:04 +0000)
inc/extensions.php
inc/extensions/ext-admins.php
inc/modules/admin/admin-inc.php
inc/mysql-manager.php

index 5eb14f67ad7f43e8aaa1163807ee7a20897780ce..5f3a704895bc1a7588896fdbecb018a6e5c2158b 100644 (file)
@@ -238,6 +238,9 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
                                                // Try to register the extension
                                                //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":ext_update=".$ext_update.",taskId=".$task."<br />\n";
                                                $test = REGISTER_EXTENSION($ext_update, $task, $dry_run, false);
+
+                                               // Reset extension name
+                                               EXT_SET_CURR_NAME($ext_name);
                                                //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
                                        } // END - if
                                } elseif ($ext_ver != EXT_GET_VERSION()) {
@@ -289,7 +292,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
                                // Register extension
                                //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:insert=".EXT_GET_CURR_NAME().'/'.EXT_GET_VERSION()." - INSERT!<br />\n";
                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_extensions` (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
-                               array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
+                                       array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
 
                                // Remove cache file(s) if extension is active
                                runFilterChain('post_extension_installed', array('ext_name' => EXT_GET_CURR_NAME(), 'task_id' => $task_id));
@@ -545,21 +548,38 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
 
                // And load SQL queries in order of version history
                for ($idx = ($start + 1); $idx < count($history); $idx++) {
+                       // Set current extension name
+                       //* DEBUG: */ print __FUNCTION__.'['.__LINE__.':] ext_name='.$ext_name.'<br />';
+                       EXT_SET_CURR_NAME($ext_name);
+
                        // Set extension version
                        $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()] = $history[$idx];
 
                        // Load again...
                        LOAD_EXTENSION(EXT_GET_CURR_NAME(), 'update', $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], $dry_run);
 
-                       if (EXT_GET_UPDATE_DEPENDS() != '') {
-                               // Is the extension there?
-                               if (GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()) != '') {
-                                       // Update another extension first!
-                                       $test = EXTENSION_UPDATE(EXT_GET_UPDATE_DEPENDS(), GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()), $dry_run);
-                               } else {
-                                       // Register new extension
-                                       $test = REGISTER_EXTENSION(EXT_GET_UPDATE_DEPENDS(), 0, $dry_run, false);
-                               }
+                       // Get all depencies
+                       $depencies = EXT_GET_UPDATE_DEPENDS();
+
+                       // Nothing to apply?
+                       if (count($depencies) > 0) {
+                               // Apply all extension depencies
+                               foreach ($depencies as $ext_depend) {
+                                       // Set it as current
+                                       EXT_SET_CURR_NAME($ext_depend);
+
+                                       // Is the extension there?
+                                       if (GET_EXT_VERSION($ext_depend) != '') {
+                                               // Update another extension first!
+                                               $test = EXTENSION_UPDATE($ext_depend, GET_EXT_VERSION($ext_depend), $dry_run);
+                                       } else {
+                                               // Register new extension
+                                               $test = REGISTER_EXTENSION($ext_depend, 0, $dry_run, false);
+                                       }
+                               } // END - foreach
+
+                               // Set name back
+                               EXT_SET_CURR_NAME($ext_name);
                        } // END - if
 
                        // Add notes
index 80ccceb242e7d734642886d15a10192aed80377c..695d2800756e230cd66de5b5fdc4989854da5899 100644 (file)
@@ -297,10 +297,10 @@ PRIMARY KEY (id)
                                break;
 
                        case '0.7.2': // SQL queries for v0.7.2
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` DROP login_failtures");
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` DROP last_failture");
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` ADD login_failures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` ADD last_failure TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` DROP `login_failtures`");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` DROP `last_failture`");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` ADD `login_failures` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` ADD `last_failure` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
 
                                // Update notes (these will be set as task text!)
                                EXT_SET_UPDATE_NOTES("Schreibweise korregiert.");
index 0903d1311ab4b072d8bf6c045a39252cecc757e3..1353ad3d10da2d8b9c733016b2c1dc9fdac96d65 100644 (file)
@@ -95,7 +95,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) {
                $add = runFilterChain('sql_admin_extra_data');
 
                // Get password from DB
-               $result = SQL_QUERY_ESC("SELECT password" . $add . " FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `password`" . $add . " FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
                        array($aid), __FUNCTION__, __LINE__);
 
                // Entry found?
index a50e4e23fa8707ca9bd448082fc1cd1a6363cb18..7137be73f1506e172de78d16de92b78503ed3168 100644 (file)
@@ -217,7 +217,7 @@ function checkModulePermissions ($mod) {
        } // END - if
 
        // Still no luck or not found?
-       if ((($ret == 'cache_miss') || ($found === false)) && (getOutputMode() == '0')) {
+       if (($ret == 'cache_miss') || ($found === false)) {
                //              ----- Legacy module -----                                               ---- Module in base folder  ----                       --- Module with extension's name ---
                if ((isFileReadable(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
                        // Data is missing so we add it