public function init() { $underMVC = false; if (isset($this->option["proj_dir"]) && !empty($this->option["proj_dir"])) { $this->proj_dir = rtrim($this->option["proj_dir"], '\\/') . '/'; if (isset($this->option["app_name"]) && !empty($this->option["app_name"])) { $this->app_dir = $this->proj_dir . "app/" . $this->option["app_name"] . "/"; $this->data_dir = $this->proj_dir . "data/" . $this->option["app_name"] . "/"; $underMVC = true; } else { trigger_error("Lotus option [app_name] is missing."); } } /** * Load core component */ require_once $this->lotusRuntimeDir . "Store.php"; require_once $this->lotusRuntimeDir . "StoreMemory.php"; require_once $this->lotusRuntimeDir . "StoreFile.php"; if ($this->defaultStoreDir) { if ($defaultStoreDir = realpath($this->defaultStoreDir)) { LtStoreFile::$defaultStoreDir = $defaultStoreDir; } else { trigger_error("invalid [default store dir]: " . $this->defaultStoreDir); } } if (!$this->devMode) { /** * accelerate LtAutoloader, LtConfig */ $this->coreCacheHandle = new LtStoreFile(); $prefix = sprintf("%u", crc32(serialize($this->app_dir))); $this->coreCacheHandle->prefix = 'Lotus-' . $prefix; $this->coreCacheHandle->useSerialize = true; $this->coreCacheHandle->init(); } /** * Init Autoloader, do this before init all other lotusphp component. */ $this->prepareAutoloader(); /** * init Config */ $this->prepareConfig(); /** * Run dispatcher when under MVC mode */ if ($underMVC) { $this->runMVC(); } }
/** * 设置默认存储目录 * @param string $dir * @return boolean */ public static function setDefaultStoreDir($dir = null) { if (null === $dir) { $dir = sys_get_temp_dir(); } self::$defaultStoreDir = $dir; return true; }