private function init() { if (!$this->initialized) { $this->initialized = true; $this->lpa = ModuleManager::get_load_priority_array(); $this->lpa_count = count($this->lpa); ModulesAutoloader::enable(); } }
public static final function create_common_cache() { if (!FORCE_CACHE_COMMON_FILES) { return; } $installed_modules = ModuleManager::get_load_priority_array(true); $ret = ''; foreach ($installed_modules as $row) { $module = $row['name']; $version = $row['version']; $path = self::get_module_dir_path($module); $file = self::get_module_file_name($module); $file_url = 'modules/' . $path . '/' . $file . 'Common_' . $version . '.php'; if (file_exists($file_url)) { $ret .= file_get_contents($file_url); $ret .= '<?php $x = \'' . $module . 'Common\';' . 'if(class_exists($x, false)){ ' . 'if(!array_key_exists(\'ModuleCommon\',class_parents($x)))' . 'trigger_error(\'Module ' . $path . ': Common class should extend ModuleCommon class.\',E_USER_ERROR);' . 'call_user_func(array($x,\'Instance\'),\'' . $module . '\');' . '} ?>'; } } $cache_dir = DATA_DIR . '/cache/'; if (!file_exists($cache_dir)) { mkdir($cache_dir, 0777, true); } file_put_contents($cache_dir . 'common.php', $ret); }