/** * Check caches * * @return @e void * @author MattMecham */ protected function checkCaches() { //----------------------------------------- // Check app cache data //----------------------------------------- # Apps $app_cache = self::$handles['caches']->getCache('app_cache'); # Modules... self::$modules = self::$handles['caches']->getCache('module_cache'); if (!count($app_cache) or !count(self::$modules)) { self::$handles['caches']->rebuildCache('app_cache', 'global'); self::$handles['caches']->rebuildCache('module_cache', 'global'); $app_cache = self::$handles['caches']->getCache('app_cache'); self::$modules = self::$handles['caches']->getCache('module_cache'); } //----------------------------------------- // Build app data and APP specific load requests //----------------------------------------- foreach ($app_cache as $_app_dir => $_app_data) { if (!IPS_IS_TASK and IPS_AREA == 'public' && !$_app_data['app_public_title']) { continue; } $_app_data['app_public_title'] = $_app_data['app_public_title'] ? $_app_data['app_public_title'] : $_app_data['app_title']; self::$applications[$_app_dir] = $_app_data; } /* Sort by position */ uasort(self::$applications, 'ipsRegistry::_appPositionSort'); # Modules by section... foreach (self::$modules as $_app_dir => $_modules) { foreach ($_modules as $_data) { self::$modules_by_section[$_app_dir][$_data['sys_module_key']] = $_data; } } //----------------------------------------- // System vars and group //----------------------------------------- $systemvars_cache = self::$handles['caches']->getCache('systemvars'); if (!isset($systemvars_cache) or !isset($systemvars_cache['task_next_run'])) { $update = array('task_next_run' => time()); $update['loadlimit'] = $systemvars_cache['loadlimit'] ? $systemvars_cache['loadlimit'] : 0; $update['mail_queue'] = $systemvars_cache['mail_queue'] ? $systemvars_cache['mail_queue'] : 0; $update['last_virus_check'] = $systemvars_cache['last_virus_check'] ? $systemvars_cache['last_virus_check'] : 0; $update['last_deepscan_check'] = $systemvars_cache['last_deepscan_check'] ? $systemvars_cache['last_deepscan_check'] : 0; self::$handles['caches']->setCache('systemvars', $update, array('donow' => 1, 'array' => 1)); } $group_cache = self::$handles['caches']->getCache('group_cache'); if (!is_array($group_cache) or !count($group_cache)) { $this->cache()->rebuildCache('group_cache', 'global'); } //----------------------------------------- // User agent caches //----------------------------------------- $useragent_cache = $this->cache()->getCache('useragents'); if (!is_array($useragent_cache) or !count($useragent_cache)) { $this->cache()->rebuildCache('useragents', 'global'); } //----------------------------------------- // Output formats //----------------------------------------- $outputformats_cache = $this->cache()->getCache('outputformats'); if (!is_array($outputformats_cache) or !count($outputformats_cache)) { $this->cache()->rebuildCache('outputformats', 'global'); } //----------------------------------------- // Hooks cache //----------------------------------------- if ($this->cache()->exists('hooks') !== TRUE) { $this->cache()->rebuildCache('hooks', 'global'); } //----------------------------------------- // Version numbers //----------------------------------------- $version_numbers = $this->cache()->getCache('vnums'); if (!is_array($version_numbers) or !count($version_numbers)) { $this->cache()->rebuildCache('vnums', 'global'); $version_numbers = $this->cache()->getCache('vnums'); } /* Set them */ if (!defined('IPB_VERSION')) { define('IPB_VERSION', $version_numbers['human']); ipsRegistry::$version = IPB_VERSION; } if (!defined('IPB_LONG_VERSION')) { define('IPB_LONG_VERSION', $version_numbers['long']); ipsRegistry::$acpversion = IPB_LONG_VERSION; ipsRegistry::$vn_full = IPB_LONG_VERSION; } //----------------------------------------- // Any to rebuild? //----------------------------------------- if (count($this->cache()->fetchRebuildList())) { foreach ($this->cache()->fetchRebuildList() as $_toRebuild) { $this->cache()->rebuildCache($_toRebuild); } } }