]> git.mxchange.org Git - mailer.git/blobdiff - inc/loader/load-modules.php
Added update_year.sh (still not fully flexible) and updated all years with it.
[mailer.git] / inc / loader / load-modules.php
index 727844519641170dab8f5918a1a53c8c3308f209..6a076d2b3bcedcee87180d71fca60d5f43d1b7b2 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Mehr Cache-Dateien nachladen                     *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-} elseif (isInstallationPhase()) {
-       // Use this code if you don't want to run this cache loader on installation phase
-       return;
+} elseif (isInstaller()) {
+       // Do not run in installation phase
+       //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Run from installation phase.');
+       return FALSE;
+} elseif (!isExtensionInstalled('mods')) {
+       // Do not run if ext-mods is missing
+       return FALSE;
 }
 
 // Next cached table is the module registry (mod_reg)...
@@ -57,18 +56,18 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i
                $GLOBALS['cache_instance']->removeCacheFile();
 
                // We should fix this
-               debug_report_bug(__FILE__, __LINE__, 'modArray=<pre>' . print_r($modArray, true) . '</pre>Please try to reload to fix this.');
+               reportBug(__FILE__, __LINE__, 'modArray=<pre>' . print_r($modArray, TRUE) . '</pre>Please try to reload to fix this.');
        } // END - if
 
        // Rewrite some parts
        foreach ($modArray['module'] as $key => $mod) {
                // Default without sql_patches
-               $entries = array('id','title','locked','hidden','admin_only','mem_only');
+               $entries = array('id', 'title', 'locked', 'admin_only', 'mem_only');
 
                // Is ext-sql_patches newer or equal 0.3.6?
                if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) {
                        // Add 'has_menu'
-                       $entries[] = 'has_menu';
+                       array_push($entries, 'has_menu');
                } // END - if
 
                // Add all
@@ -87,37 +86,50 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i
                } // END - foreach
        } // END - foreach
        unset($modArray);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isAjaxOutputMode()) || (isRawOutputMode())) {
        // Create cache file here
        $GLOBALS['cache_instance']->init();
 
-       // Load all modules and their data
+       // Is there up-to-date ext-sql_patches?
        if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) {
-               // Load has_menu
-               $result = SQL_QUERY('SELECT
-       `id`,`module`,`title`,`locked`,`hidden`,`admin_only`,`title`,`mem_only`,`has_menu`
+               // Yes, has_menu shall be there
+               $result = sqlQuery('SELECT
+       `id`,
+       `module`,
+       `title`,
+       `locked`,
+       `admin_only`,
+       `title`,
+       `mem_only`,
+       `has_menu`
 FROM
        `{?_MYSQL_PREFIX?}_mod_reg`
 ORDER BY
        `module` ASC', __FILE__, __LINE__);
        } else {
-               // Don't load has_menu
-               $result = SQL_QUERY('SELECT
-       `id`,`module`,`title`,`locked`,`hidden`,`admin_only`,`title`,`mem_only`
+               // Not recent enough ext-sql_patches ...
+               $result = sqlQuery('SELECT
+       `id`,
+       `module`,
+       `title`,
+       `locked`,
+       `admin_only`,
+       `title`,
+       `mem_only`
 FROM
        `{?_MYSQL_PREFIX?}_mod_reg`
 ORDER BY
        `module` ASC', __FILE__, __LINE__);
        }
 
-       // Cache all data
-       while ($content = SQL_FETCHARRAY($result)) {
+       // ... and load all entries
+       while ($content = sqlFetchArray($result)) {
                // Add row to cache file
                $GLOBALS['cache_instance']->addRow($content);
        } // END - while
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Close the cache
        $GLOBALS['cache_instance']->storeExtensionVersion('mods');