public static function load($configPath) { $files = Dir::tree($configPath, "/.php\$/"); $config = array(); if (!empty($files)) { foreach ($files as $file) { $config += (include "{$file}"); } } self::$config = $config; return $config; }
public function gc($time) { $path = $this->getPath(); $files = \ZPHP\Common\Dir::tree($path); foreach ($files as $file) { if (false !== strpos($file, 'sess_')) { if (fileatime($file) < time() - $this->gcTime) { unlink($file); } } } return true; }
public static function info($type, $params = array()) { $t = \date("Ymd"); $logPath = Config::getField('project', 'log_path', ''); if (empty($logPath)) { $dir = ZPHP::getRootPath() . DS . 'log' . DS . $t; } else { $dir = $logPath . DS . $t; } Dir::make($dir); $str = \date('Y-m-d H:i:s', Config::get('now_time', time())) . self::SEPARATOR . \implode(self::SEPARATOR, array_map('ZPHP\\Common\\Log::myJson', $params)); $logFile = $dir . \DS . $type . '.log'; \file_put_contents($logFile, $str . "\n", FILE_APPEND | LOCK_EX); }
public static function info($type, $params = array()) { $t = \date("Ymd"); $logPath = Config::get('log_path', ''); if (empty($logPath)) { $dir = ZPHP::getRootPath() . DS . 'log' . DS . $t; } else { $dir = $logPath . DS . $t; } Dir::make($dir); $str = \date('Y-m-d H:i:s', Config::get('now_time', time())) . self::SEPARATOR . \implode(self::SEPARATOR, array_map('json_encode', $params)); $logFile = $dir . \DS . $type . '.log'; \error_log($str . "\n", 3, $logFile); }
public static function load($configPath) { $files = Dir::tree($configPath, "/.php\$/"); $config = array(); if (!empty($files)) { foreach ($files as $file) { $config += (include "{$file}"); } } self::$config = $config; if (Request::isLongServer()) { self::$configPath = $configPath; self::$nextCheckTime = time() + empty($config['project']['config_check_time']) ? 5 : $config['project']['config_check_time']; self::$lastModifyTime = \filectime($configPath); } return $config; }