-}
-
-// Checks if the module has a menu
-function ifModuleHasMenu ($mod, $forceDb = false) {
- // All is false by default
- $ret = false;
-
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "mod={$mod},cache=".getExtensionVersion('cache'));
- if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
- // Cache version is okay, so let's check the cache!
- if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) {
- // Check module cache and count hit
- $ret = ($GLOBALS['cache_array']['modules']['has_menu'][$mod] == 'Y');
- incrementStatsEntry('cache_hits');
- } elseif (isset($GLOBALS['cache_array']['extension']['ext_menu'][$mod])) {
- // Check cache and count hit
- $ret = ($GLOBALS['cache_array']['extension']['ext_menu'][$mod] == 'Y');
- incrementStatsEntry('cache_hits');
- } elseif ($mod == 'admin') {
- // Admin module has always a menu!
- $ret = true;
- }
- } elseif ((isExtensionInstalled('sql_patches')) && (getExtensionVersion('sql_patches') >= '0.3.6') && ((!isExtensionActive('cache')) || ($forceDb === true))) {
- // Check database for entry
- $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
- array($mod), __FUNCTION__, __LINE__);
-
- // Entry found?
- if (SQL_NUMROWS($result) == 1) {
- // Load "has_menu" column
- list($has_menu) = SQL_FETCHROW($result);
-
- // Fake cache... ;-)
- $GLOBALS['cache_array']['extension']['ext_menu'][$mod] = $has_menu;