Пример #1
0
    /**
     * start to build folders
     *
     * @return void
     */
    protected function startBuild()
    {
        if (is_dir($this->_appPath)) {
            return;
        }
        foreach ($this->_folders as $folder) {
            Helper::mkdirs($this->_appPath . '/' . $folder);
        }
        if (!is_file($this->_appPath . '/common.php')) {
            file_put_contents($this->_appPath . '/common.php', '<?php
// common functions');
        }
    }
Пример #2
0
 /**
  * Write Log File
  *
  * Support Sina App Engine
  *
  * @param string $msg Message
  * @param string $level Log level
  * @return void
  */
 protected static function write($msg, $level = '')
 {
     if (Config::getSoul()->APP_DEBUG == false) {
         return;
     }
     if (function_exists('saeAutoLoader')) {
         $msg = "[{$level}]" . $msg;
         sae_set_display_errors(false);
         sae_debug(trim($msg));
         sae_set_display_errors(true);
     } else {
         $msg = date('[ Y-m-d H:i:s ]') . "[{$level}]" . $msg . "\r\n";
         $logPath = Config::getSoul()->APP_FULL_PATH . '/logs';
         if (!file_exists($logPath)) {
             Helper::mkdirs($logPath);
         }
         file_put_contents($logPath . '/' . date('Ymd') . '.log', $msg, FILE_APPEND);
     }
 }