]> git.mxchange.org Git - mailer.git/blobdiff - inc/loader/load-extension.php
Fix for #223
[mailer.git] / inc / loader / load-extension.php
index aad9cd0ab782e5fac67a1cd14bf99c64592449d4..9d2d351d83af0b2541bc713468c77400af702508 100644 (file)
@@ -19,7 +19,7 @@
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -61,7 +61,9 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache
                // Loop through all
                foreach ($EXT_DUMMY['ext_name'] as $k => $ext_name) {
                        // Load CSS file
-                       if ($EXT_DUMMY['ext_css'][$k] == 'Y') addExtensionCssFile($ext_name . '.css');
+                       if ($EXT_DUMMY['ext_css'][$k] == 'Y') {
+                               addExtensionCssFile($ext_name . '.css');
+                       } // END - if
 
                        // Load extension file itself
                        if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y')) {
@@ -136,34 +138,32 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache
 
        // Add more if sql_patches is recent enougth
        $add = '';
-       if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) $add = ", `ext_has_css` AS ext_css";
+       if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
+               $add = ',`ext_has_css` AS `ext_css`';
+       } // END - if
 
-       // Load all modules and their data
-       $result = SQL_QUERY('SELECT `id` AS ext_id, `ext_name`, `ext_active`, `ext_version`'.$add.' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__);
+       // Query for all extensions
+       $result = SQL_QUERY('SELECT `id` AS `ext_id`,`ext_name`,`ext_active`,`ext_version`' . $add . ' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__);
+
+       // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
                // Load extension
-               loadExtension($content['ext_name'], 'test');
+               if (!loadExtension($content['ext_name'], 'test')) {
+                       // Didn't load so deactivate it
+                       doDeactivateExtension($content['ext_name'], true);
 
-               // Get menu entry
-               $content['ext_menu'] = 'N';
-               if (ifModuleHasMenu($content['ext_name'], true)) {
-                       // Extension is a module and has menu... pew!
-                       $content['ext_menu'] = 'Y';
+                       // ... and skip it
+                       continue;
                } // END - if
 
+               // Get menu entry
+               $content['ext_menu'] = convertBooleanToYesNo(ifModuleHasMenu($content['ext_name'], true));
+
                // Get language entry
-               $content['ext_lang'] = 'N';
-               if (isLanguageIncludeReadable($content['ext_name'])) {
-                       // Readable
-                       $content['ext_lang'] = 'Y';
-               } // END - if
+               $content['ext_lang'] = convertBooleanToYesNo(isLanguageIncludeReadable($content['ext_name']));
 
                // Get function entry
-               $content['ext_func'] = 'N';
-               if (isExtensionFunctionFileReadable($content['ext_name'])) {
-                       // Readable
-                       $content['ext_func'] = 'Y';
-               } // END - if
+               $content['ext_func'] = convertBooleanToYesNo(isExtensionFunctionFileReadable($content['ext_name']));
 
                // Transfer EXT_ALWAYS_ACTIVE flag
                $content['ext_keep'] = getThisExtensionAlwaysActive();