public function __construct() { $logDir = Directory::sitePath('log'); $this->logFileName = $logDir . DIRECTORY_SEPARATOR . str_replace('{site}', $_SERVER['HTTP_HOST'], str_replace('{date}', date("Ymd"), $this->logFileName)); if (is_dir($logDir) == false) { mkdir($logDir, 0777); } }
public function setPidFilePath($cmd) { $this->setLogFilePath(); $logDir = Directory::sitePath('log'); if (!preg_match("/^\\/(.+)/i", $cmd, $tmpMatch)) { $cmd = "/" . $cmd; } $this->cmdFile = $logDir . $cmd; $this->pidFile = $logDir . $this->pidFile; $cmdPid = md5($cmd); $this->pidFile = str_replace('{pid}', $cmdPid, $this->pidFile); }
/** * Image, Javascript, CSS 파일등 정적파일 출력 * @param string $staticUri * @throws ConfigureException * @throws DirectoryException */ protected function staticFiles($staticUri = '') { $charset = Configure::site('charset'); if (preg_match('/^(js|css|images|fonts){1}\\/(.+)/i', $staticUri, $tmpMimeMatch)) { $mimeFilePath = ''; switch ($tmpMimeMatch[1]) { case 'images': $mimeFilePath = Directory::sitePath('view.image') . DIRECTORY_SEPARATOR . $tmpMimeMatch[2]; $imageInfo = getimagesize($mimeFilePath); header("Content-type: {$imageInfo['mime']}; charset=" . strtoupper($charset)); break; case 'js': $mimeFilePath = Directory::sitePath('view.js') . DIRECTORY_SEPARATOR . $tmpMimeMatch[2]; header("Content-Type: application/javascript; charset=" . strtoupper($charset)); break; case 'css': $mimeFilePath = Directory::sitePath('view.css') . DIRECTORY_SEPARATOR . $tmpMimeMatch[2]; header("Content-type: text/css; charset=" . strtoupper($charset)); break; case 'fonts': $mimeFilePath = Directory::sitePath('view.fonts') . DIRECTORY_SEPARATOR . $tmpMimeMatch[2]; header("Content-type: application/octet-stream; charset=" . strtoupper($charset)); break; default: //$mimeFilePath = $arrDirs['html'] . '/' .$ctrFileName; break; } if (is_file($mimeFilePath)) { echo file_get_contents($mimeFilePath); } else { $this->error("Not Found File. {$mimeFilePath}", 404); } exit; } }