当前位置: 首页>>代码示例>>PHP>>正文


PHP jApp::logPath方法代码示例

本文整理汇总了PHP中jApp::logPath方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::logPath方法的具体用法?PHP jApp::logPath怎么用?PHP jApp::logPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jApp的用法示例。


在下文中一共展示了jApp::logPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logMessage

 /**
  * @param jILogMessage $message the message to log
  */
 function logMessage($message)
 {
     global $gJConfig, $gJCoord;
     if (!is_writable(jApp::logPath())) {
         return;
     }
     $type = $message->getCategory();
     if ($gJCoord && $gJCoord->request) {
         $conf =& $gJConfig->fileLogger;
         if (!isset($conf[$type])) {
             return;
         }
         $f = $conf[$type];
         $ip = $gJCoord->request->getIP();
         $f = str_replace('%ip%', $ip, $f);
         $f = str_replace('%m%', date("m"), $f);
         $f = str_replace('%Y%', date("Y"), $f);
         $f = str_replace('%d%', date("d"), $f);
         $f = str_replace('%H%', date("H"), $f);
     } else {
         // if there isn't a request, so jLog is called for an error during the construction
         // of the coordinator
         $f = 'errors.log';
         $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
     }
     try {
         $sel = new jSelectorLog($f);
         $file = $sel->getPath();
         @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\t{$type}\t" . $message->getFormatedMessage() . "\n", 3, $file);
     } catch (Exception $e) {
         $file = jApp::logPath('errors.log');
         @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\terror\t" . $e->getMessage() . "\n", 3, $file);
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:37,代码来源:jFileLogger.class.php

示例2: read

 public static function read($configFile, $allModuleInfo = false, $isCli = false, $pseudoScriptName = '')
 {
     $tempPath = jApp::tempBasePath();
     $configPath = jApp::configPath();
     if ($tempPath == '/') {
         throw new Exception('Application temp directory doesn\'t exist !', 3);
     }
     if (!is_writable($tempPath)) {
         throw new Exception('Application temp base directory is not writable -- (' . $tempPath . ')', 4);
     }
     if (!is_writable(jApp::logPath())) {
         throw new Exception('Application log directory is not writable -- (' . jApp::logPath() . ')', 4);
     }
     self::$commonConfig = jIniFile::read($configPath . 'defaultconfig.ini.php', true);
     $config = jIniFile::read(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     if (self::$commonConfig) {
         self::_mergeConfig($config, self::$commonConfig);
     }
     if ($configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Configuration file is missing -- {$configFile} ", 5);
         }
         if (false === ($userConfig = parse_ini_file($configPath . $configFile, true))) {
             throw new Exception("Syntax error in the configuration file -- {$configFile}", 6);
         }
         self::_mergeConfig($config, $userConfig);
     }
     $config = (object) $config;
     self::prepareConfig($config, $allModuleInfo, $isCli, $pseudoScriptName);
     self::$commonConfig = null;
     return $config;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:32,代码来源:jConfigCompiler.class.php

示例3: read

 /**
  * read the given ini file, for the current entry point, or for the entrypoint given
  * in $pseudoScriptName. Merge it with the content of defaultconfig.ini.php
  * It also calculates some options.
  * If you are in a CLI script but you want to load a configuration file for a web entry point
  * or vice-versa, you need to indicate the $pseudoScriptName parameter with the name of the entry point
  * @param string $configFile the config file name
  * @param boolean $allModuleInfo may be true for the installer, which needs all informations
  *                               else should be false, these extra informations are
  *                               not needed to run the application
  * @param boolean $isCli  indicate if the configuration to read is for a CLI script or no
  * @param string $pseudoScriptName the name of the entry point, relative to the base path,
  *              corresponding to the readed configuration
  * @return object an object which contains configuration values
  */
 public static function read($configFile, $allModuleInfo = false, $isCli = false, $pseudoScriptName = '')
 {
     $tempPath = jApp::tempBasePath();
     $configPath = jApp::configPath();
     if ($tempPath == '/') {
         // if it equals to '/', this is because realpath has returned false in the application.init.php
         // so this is because the path doesn't exist.
         throw new Exception('Application temp directory doesn\'t exist !', 3);
     }
     if (!is_writable($tempPath)) {
         throw new Exception('Application temp base directory is not writable -- (' . $tempPath . ')', 4);
     }
     if (!is_writable(jApp::logPath())) {
         throw new Exception('Application log directory is not writable -- (' . jApp::logPath() . ')', 4);
     }
     $config = jelix_read_ini(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     self::$commonConfig = clone $config;
     @jelix_read_ini($configPath . 'defaultconfig.ini.php', $config);
     if ($configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Configuration file is missing -- {$configFile}", 5);
         }
         if (false === @jelix_read_ini($configPath . $configFile, $config)) {
             throw new Exception("Syntax error in the configuration file -- {$configFile}", 6);
         }
     }
     self::prepareConfig($config, $allModuleInfo, $isCli, $pseudoScriptName);
     self::$commonConfig = null;
     return $config;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:45,代码来源:jConfigCompiler.class.php

示例4: testContext

 function testContext()
 {
     $appPath = jApp::appPath();
     $varPath = jApp::varPath();
     $logPath = jApp::logPath();
     $configPath = jApp::configPath();
     $wwwPath = jApp::wwwPath();
     $scriptsPath = jApp::scriptsPath();
     $tempPath = jApp::tempPath();
     // first save
     jApp::saveContext();
     // verify that we still have the current path
     $this->assertEquals($appPath, jApp::appPath());
     $this->assertEquals($varPath, jApp::varPath());
     $this->assertEquals($logPath, jApp::logPath());
     $this->assertEquals($configPath, jApp::configPath());
     $this->assertEquals($wwwPath, jApp::wwwPath());
     $this->assertEquals($scriptsPath, jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // change the path
     jApp::initPaths('/myapp/');
     $this->assertEquals('/myapp/', jApp::appPath());
     $this->assertEquals('/myapp/var/', jApp::varPath());
     $this->assertEquals('/myapp/var/log/', jApp::logPath());
     $this->assertEquals('/myapp/var/config/', jApp::configPath());
     $this->assertEquals('/myapp/www/', jApp::wwwPath());
     $this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // second save
     jApp::saveContext();
     jApp::initPaths('/myapp2/');
     $this->assertEquals('/myapp2/', jApp::appPath());
     $this->assertEquals('/myapp2/var/', jApp::varPath());
     $this->assertEquals('/myapp2/var/log/', jApp::logPath());
     $this->assertEquals('/myapp2/var/config/', jApp::configPath());
     $this->assertEquals('/myapp2/www/', jApp::wwwPath());
     $this->assertEquals('/myapp2/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // pop the second save, we should be with the first saved values
     jApp::restoreContext();
     $this->assertEquals('/myapp/', jApp::appPath());
     $this->assertEquals('/myapp/var/', jApp::varPath());
     $this->assertEquals('/myapp/var/log/', jApp::logPath());
     $this->assertEquals('/myapp/var/config/', jApp::configPath());
     $this->assertEquals('/myapp/www/', jApp::wwwPath());
     $this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // pop the first save, we should be with initial paths
     jApp::restoreContext();
     $this->assertEquals($appPath, jApp::appPath());
     $this->assertEquals($varPath, jApp::varPath());
     $this->assertEquals($logPath, jApp::logPath());
     $this->assertEquals($configPath, jApp::configPath());
     $this->assertEquals($wwwPath, jApp::wwwPath());
     $this->assertEquals($scriptsPath, jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:57,代码来源:jAppContextTest.php

示例5: initPaths

 /**
  * initialize the application paths
  *
  * Warning: given paths should be ended by a directory separator.
  * @param string $appPath  application directory
  * @param string $wwwPath  www directory
  * @param string $varPath  var directory
  * @param string $logPath log directory
  * @param string $configPath config directory
  * @param string $scriptPath scripts directory
  */
 public static function initPaths($appPath, $wwwPath = null, $varPath = null, $logPath = null, $configPath = null, $scriptPath = null)
 {
     self::$appPath = $appPath;
     self::$wwwPath = is_null($wwwPath) ? $appPath . 'www/' : $wwwPath;
     self::$varPath = is_null($varPath) ? $appPath . 'var/' : $varPath;
     self::$logPath = is_null($logPath) ? self::$varPath . 'log/' : $logPath;
     self::$configPath = is_null($configPath) ? self::$varPath . 'config/' : $configPath;
     self::$scriptPath = is_null($scriptPath) ? $appPath . 'scripts/' : $scriptPath;
     self::$_isInit = true;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:21,代码来源:jApp.class.php

示例6: run

 public function run()
 {
     $paths = array();
     $paths[] = jApp::tempBasePath();
     $paths[] = jApp::logPath();
     $paths[] = jApp::varPath('mails');
     $paths[] = jApp::varPath('db');
     foreach ($paths as $path) {
         $this->setRights($path);
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:11,代码来源:resetfilesrights.cmd.php

示例7: initPaths

 /**
  * initialize the application paths
  *
  * Warning: given paths should be ended by a directory separator.
  * @param string $appPath  application directory
  * @param string $wwwPath  www directory
  * @param string $varPath  var directory
  * @param string $logPath log directory
  * @param string $configPath config directory
  * @param string $scriptPath scripts directory
  */
 public static function initPaths($appPath, $wwwPath = null, $varPath = null, $logPath = null, $configPath = null, $scriptPath = null)
 {
     self::$appPath = $appPath;
     self::$wwwPath = is_null($wwwPath) ? $appPath . 'www/' : $wwwPath;
     self::$varPath = is_null($varPath) ? $appPath . 'var/' : $varPath;
     self::$logPath = is_null($logPath) ? self::$varPath . 'log/' : $logPath;
     self::$configPath = is_null($configPath) ? self::$varPath . 'config/' : $configPath;
     self::$scriptPath = is_null($scriptPath) ? $appPath . 'scripts/' : $scriptPath;
     self::$_isInit = true;
     self::$_coord = null;
     self::$_config = null;
     self::$configAutoloader = null;
     self::$_mainConfigFile = null;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:25,代码来源:jApp.class.php

示例8: testLogFile

 public function testLogFile()
 {
     $file = jApp::logPath('test.log');
     if (file_exists($file)) {
         file_put_contents($file, '');
     }
     global $gJConfig;
     $gJConfig->logger['test'] = 'file';
     $gJConfig->fileLogger['test'] = 'test.log';
     jLog::log('aaa', 'test');
     $this->assertTrue(file_exists($file));
     $this->assertTrue(strpos(file_get_contents($file), 'aaa') !== false);
     jLog::log('bbb', 'test');
     $this->assertTrue(strpos(file_get_contents($file), 'aaa') !== false);
     $this->assertTrue(strpos(file_get_contents($file), 'bbb') !== false);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:16,代码来源:utils.jlog.html_cli.php

示例9: logMessage

 /**
  * @param jILogMessage $message the message to log
  */
 function logMessage($message)
 {
     if (!is_writable(jApp::logPath())) {
         return;
     }
     $type = $message->getCategory();
     $appConf = jApp::config();
     if ($appConf) {
         $conf =& jApp::config()->fileLogger;
         if (!isset($conf[$type])) {
             return;
         }
         $f = $conf[$type];
         $f = str_replace('%m%', date("m"), $f);
         $f = str_replace('%Y%', date("Y"), $f);
         $f = str_replace('%d%', date("d"), $f);
         $f = str_replace('%H%', date("H"), $f);
     } else {
         $f = 'errors.log';
     }
     $coord = jApp::coord();
     if ($coord && $coord->request) {
         $ip = $coord->request->getIP();
     } else {
         $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
     }
     $f = str_replace('%ip%', $ip, $f);
     try {
         $sel = new jSelectorLog($f);
         $file = $sel->getPath();
         @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\t{$type}\t" . $message->getFormatedMessage() . "\n", 3, $file);
         @chmod($file, jApp::config()->chmodFile);
     } catch (Exception $e) {
         $file = jApp::logPath('errors.log');
         @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\terror\t" . $e->getMessage() . "\n", 3, $file);
         @chmod($file, jApp::config()->chmodFile);
     }
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:41,代码来源:jFileLogger.class.php

示例10: checkAppPaths

 function checkAppPaths()
 {
     $ok = true;
     if (!defined('JELIX_LIB_PATH') || !jApp::isInit()) {
         throw new Exception($this->messages->get('path.core'));
     }
     if (!file_exists(jApp::tempBasePath()) || !is_writable(jApp::tempBasePath())) {
         $this->error('path.temp');
         $ok = false;
     }
     if (!file_exists(jApp::logPath()) || !is_writable(jApp::logPath())) {
         $this->error('path.log');
         $ok = false;
     }
     if (!file_exists(jApp::varPath())) {
         $this->error('path.var');
         $ok = false;
     }
     if (!file_exists(jApp::configPath())) {
         $this->error('path.config');
         $ok = false;
     } elseif ($this->checkForInstallation) {
         if (!is_writable(jApp::configPath())) {
             $this->error('path.config.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('profiles.ini.php')) && !is_writable(jApp::configPath('profiles.ini.php'))) {
             $this->error('path.profiles.writable');
             $ok = false;
         }
         if (file_exists(jApp::mainConfigFile()) && !is_writable(jApp::mainConfigFile())) {
             $this->error('path.mainconfig.writable');
             $ok = false;
         } elseif (file_exists(jApp::configPath('defaultconfig.ini.php')) && !is_writable(jApp::configPath('defaultconfig.ini.php'))) {
             $this->error('path.mainconfig.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('installer.ini.php')) && !is_writable(jApp::configPath('installer.ini.php'))) {
             $this->error('path.installer.writable');
             $ok = false;
         }
     }
     if (!file_exists(jApp::wwwPath())) {
         $this->error('path.www');
         $ok = false;
     }
     foreach ($this->otherPaths as $path) {
         $realPath = jFile::parseJelixPath($path);
         if (!file_exists($realPath)) {
             $this->error('path.custom.not.exists', array($path));
             $ok = false;
         } else {
             if (!is_writable($realPath)) {
                 $this->error('path.custom.writable', array($path));
                 $ok = false;
             } else {
                 $this->ok('path.custom.ok', array($path));
             }
         }
     }
     if ($ok) {
         $this->ok('paths.ok');
     } else {
         throw new Exception($this->messages->get('too.critical.error'));
     }
     /*if(!isset($GLOBALS['config_file']) ||
          empty($GLOBALS['config_file']) ||
          !file_exists(jApp::configPath($GLOBALS['config_file']))){
           throw new Exception($this->messages->get('config.file'));
       }*/
     return $ok;
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:72,代码来源:jInstallChecker.class.php

示例11: handleError

 static function handleError($type, $code, $message, $file, $line, $trace)
 {
     $errorLog = new jLogErrorMessage($type, $code, $message, $file, $line, $trace);
     // for non fatal error appeared during init, let's just store it for loggers later
     if ($type != 'error') {
         self::$initErrorMessages[] = $errorLog;
         return;
     } else {
         if (jServer::isCLI()) {
             // fatal error appeared during init, in a CLI context
             while (ob_get_level() && @ob_end_clean()) {
             }
             // log into file and output message in the console
             echo 'Error during initialization: \\n';
             foreach (self::$initErrorMessages as $err) {
                 @error_log($err->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
                 echo '* ' . $err->getMessage() . ' (' . $err->getFile() . ' ' . $err->getLine() . ")\n";
             }
             @error_log($errorLog->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
             echo '* ' . $message . ' (' . $file . ' ' . $line . ")\n";
         } else {
             // fatal error appeared during init, let's display an HTML page
             // since we don't know the request, we cannot return a response
             // corresponding to the expected protocol
             while (ob_get_level() && @ob_end_clean()) {
             }
             // log into file
             foreach (self::$initErrorMessages as $err) {
                 @error_log($err->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
             }
             @error_log($errorLog->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
             $msg = $errorLog->getMessage();
             if (strpos($msg, '--') !== false) {
                 list($msg, $bin) = explode('--', $msg, 2);
                 // remove confidential data
             }
             // if accept text/html
             if (isset($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'text/html')) {
                 if (file_exists(jApp::appPath('responses/error.en_US.php'))) {
                     $file = jApp::appPath('responses/error.en_US.php');
                 } else {
                     $file = JELIX_LIB_CORE_PATH . 'response/error.en_US.php';
                 }
                 $HEADTOP = '';
                 $HEADBOTTOM = '';
                 $BODYTOP = '';
                 $BODYBOTTOM = htmlspecialchars($msg);
                 $BASEPATH = jApp::urlBasePath();
                 if ($BASEPATH == '') {
                     $BASEPATH = '/';
                 }
                 header("HTTP/1.1 500 Internal jelix error");
                 header('Content-type: text/html');
                 include $file;
             } else {
                 // output text response
                 header("HTTP/1.1 500 Internal jelix error");
                 header('Content-type: text/plain');
                 echo 'Error during initialization. ' . $msg;
             }
         }
     }
     exit(1);
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:64,代码来源:jBasicErrorHandler.class.php

示例12: handleError

 /**
  * Handle an error event. Called by error handler and exception handler.
  * @param string  $type    error type : 'error', 'warning', 'notice'
  * @param integer $code    error code
  * @param string  $message error message
  * @param string  $file    the file name where the error appear
  * @param integer $line    the line number where the error appear
  * @param array   $trace   the stack trace
  * @since 1.1
  */
 public function handleError($type, $code, $message, $file, $line, $trace)
 {
     global $gJConfig;
     $errorLog = new jLogErrorMessage($type, $code, $message, $file, $line, $trace);
     if ($this->request) {
         // we have config, so we can process "normally"
         $errorLog->setFormat($gJConfig->error_handling['messageLogFormat']);
         jLog::log($errorLog, $type);
         // if non fatal error, it is finished
         if ($type != 'error') {
             return;
         }
         $this->errorMessage = $errorLog;
         while (ob_get_level()) {
             ob_end_clean();
         }
         $resp = $this->request->getErrorResponse($this->response);
         $resp->outputErrors();
         jSession::end();
     } elseif ($type != 'error') {
         $this->initErrorMessages[] = $errorLog;
         return;
     } else {
         // fatal error appeared during init, let's display an HTML page
         // since we don't know the request, we cannot return a response
         // corresponding to the expected protocol
         while (ob_get_level()) {
             ob_end_clean();
         }
         // log into file
         @error_log($errorLog->getFormatedMessage(), 3, jApp::logPath('errors.log'));
         // if accept text/html
         if (isset($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'text/html')) {
             if (file_exists(jApp::appPath('responses/error.en_US.php'))) {
                 $file = jApp::appPath('responses/error.en_US.php');
             } else {
                 $file = JELIX_LIB_CORE_PATH . 'response/error.en_US.php';
             }
             $HEADBOTTOM = '';
             $BODYTOP = '';
             $BODYBOTTOM = '';
             $basePath = '';
             header("HTTP/1.1 500 Internal jelix error");
             header('Content-type: text/html');
             include $file;
         } else {
             // output text response
             header("HTTP/1.1 500 Internal jelix error");
             header('Content-type: text/plain');
             echo 'Error during initialization.';
         }
     }
     exit(1);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:64,代码来源:jCoordinator.class.php

示例13: checkAppPaths

 function checkAppPaths()
 {
     $ok = true;
     if (!defined('JELIX_LIB_PATH') || !jApp::isInit()) {
         throw new Exception($this->messages->get('path.core'));
     }
     if (!file_exists(jApp::tempBasePath()) || !is_writable(jApp::tempBasePath())) {
         $this->error('path.temp');
         $ok = false;
     }
     if (!file_exists(jApp::logPath()) || !is_writable(jApp::logPath())) {
         $this->error('path.log');
         $ok = false;
     }
     if (!file_exists(jApp::varPath())) {
         $this->error('path.var');
         $ok = false;
     }
     if (!file_exists(jApp::configPath())) {
         $this->error('path.config');
         $ok = false;
     } elseif ($this->checkForInstallation) {
         if (!is_writable(jApp::configPath())) {
             $this->error('path.config.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('profiles.ini.php')) && !is_writable(jApp::configPath('profiles.ini.php'))) {
             $this->error('path.profiles.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('defaultconfig.ini.php')) && !is_writable(jApp::configPath('defaultconfig.ini.php'))) {
             $this->error('path.defaultconfig.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('installer.ini.php')) && !is_writable(jApp::configPath('installer.ini.php'))) {
             $this->error('path.installer.writable');
             $ok = false;
         }
     }
     if (!file_exists(jApp::wwwPath())) {
         $this->error('path.www');
         $ok = false;
     }
     foreach ($this->otherPaths as $path) {
         $realPath = str_replace(array('app:', 'lib:', 'var:', 'www:'), array(jApp::appPath(), LIB_PATH, jApp::varPath(), jApp::wwwPath()), $path);
         if (!file_exists($realPath)) {
             $this->error('path.custom.not.exists', array($path));
             $ok = false;
         } else {
             if (!is_writable($realPath)) {
                 $this->error('path.custom.writable', array($path));
                 $ok = false;
             } else {
                 $this->ok('path.custom.ok', array($path));
             }
         }
     }
     if ($ok) {
         $this->ok('paths.ok');
     } else {
         throw new Exception($this->messages->get('too.critical.error'));
     }
     return $ok;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:64,代码来源:jInstallChecker.class.php

示例14: run

 public function run()
 {
     require_once LIB_PATH . 'clearbricks/jelix.inc.php';
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     $appPath = $this->getParam('path');
     $appPath = $this->getRealPath($appPath);
     $appName = basename($appPath);
     $appPath .= '/';
     if (file_exists($appPath)) {
         throw new Exception("this application is already created");
     }
     $this->config = JelixScript::loadConfig($appName);
     $this->config->infoIDSuffix = $this->config->newAppInfoIDSuffix;
     $this->config->infoWebsite = $this->config->newAppInfoWebsite;
     $this->config->infoLicence = $this->config->newAppInfoLicence;
     $this->config->infoLicenceUrl = $this->config->newAppInfoLicenceUrl;
     $this->config->infoLocale = $this->config->newAppInfoLocale;
     $this->config->infoCopyright = $this->config->newAppInfoCopyright;
     $this->config->initAppPaths($appPath);
     jApp::setEnv('jelix-scripts');
     jApp::initLegacy();
     JelixScript::checkTempPath();
     if ($p = $this->getOption('-wwwpath')) {
         $wwwpath = path::real($appPath . $p, false) . '/';
     } else {
         $wwwpath = jApp::wwwPath();
     }
     $this->createDir($appPath);
     $this->createDir(jApp::tempBasePath());
     $this->createDir($wwwpath);
     $varPath = jApp::varPath();
     $configPath = jApp::configPath();
     $this->createDir($varPath);
     $this->createDir(jApp::logPath());
     $this->createDir($configPath);
     $this->createDir($configPath . 'index/');
     $this->createDir($varPath . 'overloads/');
     $this->createDir($varPath . 'themes/');
     $this->createDir($varPath . 'themes/default/');
     $this->createDir($varPath . 'uploads/');
     $this->createDir($varPath . 'sessions/');
     $this->createDir($varPath . 'mails/');
     $this->createDir($appPath . 'install');
     $this->createDir($appPath . 'modules');
     $this->createDir($appPath . 'plugins');
     $this->createDir($appPath . 'plugins/coord/');
     $this->createDir($appPath . 'plugins/tpl/');
     $this->createDir($appPath . 'plugins/tpl/common');
     $this->createDir($appPath . 'plugins/tpl/html');
     $this->createDir($appPath . 'plugins/tpl/text');
     $this->createDir($appPath . 'plugins/db/');
     $this->createDir($appPath . 'plugins/auth/');
     $this->createDir($appPath . 'responses');
     $this->createDir($appPath . 'tests');
     $this->createDir(jApp::scriptsPath());
     $param = array();
     $param['default_id'] = $appName . $this->config->infoIDSuffix;
     if ($this->getOption('-nodefaultmodule')) {
         $param['tplname'] = 'jelix~defaultmain';
         $param['modulename'] = 'jelix';
     } else {
         // note: since module name are used for name of generated name,
         // only this characters are allowed
         $param['modulename'] = preg_replace('/([^a-zA-Z_0-9])/', '_', $appName);
         $param['tplname'] = $param['modulename'] . '~main';
     }
     $param['config_file'] = 'index/config.ini.php';
     $param['rp_temp'] = $this->getRelativePath($appPath, jApp::tempBasePath());
     $param['rp_var'] = $this->getRelativePath($appPath, jApp::varPath());
     $param['rp_log'] = $this->getRelativePath($appPath, jApp::logPath());
     $param['rp_conf'] = $this->getRelativePath($appPath, $configPath);
     $param['rp_www'] = $this->getRelativePath($appPath, $wwwpath);
     $param['rp_cmd'] = $this->getRelativePath($appPath, jApp::scriptsPath());
     $param['rp_jelix'] = $this->getRelativePath($appPath, JELIX_LIB_PATH);
     $param['rp_app'] = $this->getRelativePath($wwwpath, $appPath);
     $this->createFile(jApp::logPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'mails/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'sessions/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'overloads/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'themes/default/.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . 'plugins/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::scriptsPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::tempBasePath() . '.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . '.htaccess', 'htaccess_deny', $param, "Configuration file for Apache");
     $this->createFile($appPath . 'project.xml', 'project.xml.tpl', $param, "Project description file");
     $this->createFile($appPath . 'cmd.php', 'cmd.php.tpl', $param, "Script for developer commands");
     $this->createFile($configPath . 'defaultconfig.ini.php', 'var/config/defaultconfig.ini.php.tpl', $param, "Main configuration file");
     $this->createFile($configPath . 'defaultconfig.ini.php.dist', 'var/config/defaultconfig.ini.php.tpl', $param, "Main configuration file for your repository");
     $this->createFile($configPath . 'profiles.ini.php', 'var/config/profiles.ini.php.tpl', $param, "Profiles file");
     $this->createFile($configPath . 'profiles.ini.php.dist', 'var/config/profiles.ini.php.tpl', $param, "Profiles file for your repository");
     $this->createFile($configPath . 'preferences.ini.php', 'var/config/preferences.ini.php.tpl', $param, "Preferences file");
     $this->createFile($configPath . 'urls.xml', 'var/config/urls.xml.tpl', $param, "URLs mapping file");
     //$this->createFile(JELIX_APP_CONFIG_PATH.'installer.ini.php', 'var/config/installer.ini.php.tpl', $param);
     $this->createFile($configPath . 'index/config.ini.php', 'var/config/index/config.ini.php.tpl', $param, "Entry point configuration file");
     $this->createFile($appPath . 'responses/myHtmlResponse.class.php', 'responses/myHtmlResponse.class.php.tpl', $param, "Main response class");
     $this->createFile($appPath . 'install/installer.php', 'installer/installer.php.tpl', $param, "Installer script");
     $this->createFile($appPath . 'tests/runtests.php', 'tests/runtests.php', $param, "Tests script");
     $temp = dirname(jApp::tempBasePath());
     if (file_exists($temp . '/.gitignore')) {
         $gitignore = file_get_contents($temp . '/.gitignore') . "\n" . $appName . "/*\n";
//.........这里部分代码省略.........
开发者ID:havefnubb,项目名称:havefnubb,代码行数:101,代码来源:createapp.cmd.php

示例15: handleError

 /**
  * Handle an error event. Called by error handler and exception handler.
  * @param string  $type    error type : 'error', 'warning', 'notice'
  * @param integer $code    error code
  * @param string  $message error message
  * @param string  $file    the file name where the error appear
  * @param integer $line    the line number where the error appear
  * @param array   $trace   the stack trace
  * @since 1.1
  */
 public function handleError($type, $code, $message, $file, $line, $trace)
 {
     global $gJConfig;
     $errorLog = new jLogErrorMessage($type, $code, $message, $file, $line, $trace);
     if ($this->request) {
         // we have config, so we can process "normally"
         $errorLog->setFormat($gJConfig->error_handling['messageLogFormat']);
         jLog::log($errorLog, $type);
         $this->allErrorMessages[] = $errorLog;
         // if non fatal error, it is finished
         if ($type != 'error') {
             return;
         }
         $this->errorMessage = $errorLog;
         while (ob_get_level()) {
             ob_end_clean();
         }
         if ($this->response) {
             $resp = $this->response;
         } else {
             $resp = $this->response = new jResponseCmdline();
         }
         $resp->outputErrors();
         jSession::end();
     } elseif ($type != 'error') {
         $this->allErrorMessages[] = $errorLog;
         $this->initErrorMessages[] = $errorLog;
         return;
     } else {
         // fatal error appeared during init, let's display a single message
         while (ob_get_level()) {
             ob_end_clean();
         }
         // log into file
         @error_log($errorLog->getFormatedMessage(), 3, jApp::logPath('errors.log'));
         // output text response
         echo 'Error during initialization: ' . $message . ' (' . $file . ' ' . $line . ")\n";
     }
     exit(1);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:50,代码来源:jCmdlineCoordinator.class.php


注:本文中的jApp::logPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。