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


PHP KTUtil::running_user方法代码示例

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


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

示例1: KTCache

 function KTCache()
 {
     require_once "Cache/Lite.php";
     require_once KT_LIB_DIR . '/config/config.inc.php';
     $aOptions = array();
     $oKTConfig = KTConfig::getSingleton();
     $this->bEnabled = $oKTConfig->get('cache/cacheEnabled', false);
     if (empty($this->bEnabled)) {
         return;
     }
     $aOptions['cacheDir'] = $oKTConfig->get('cache/cacheDirectory') . "/";
     $user = KTUtil::running_user();
     if ($user) {
         $aOptions['cacheDir'] .= $user . '/';
     }
     if (!file_exists($aOptions['cacheDir'])) {
         mkdir($aOptions['cacheDir']);
     }
     // See thirdparty/pear/Cache/Lite.php to customize cache
     $aOptions['lifeTime'] = 60;
     $aOptions['memoryCaching'] = true;
     $aOptions['automaticSerialization'] = true;
     /* Patched line */
     // Disable fileCaching (when cache > 5Mo)
     $aOptions['onlyMemoryCaching'] = true;
     $this->cacheDir = $aOptions['cacheDir'];
     $this->oLite = new Cache_Lite($aOptions);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:cache.inc.php

示例2: setupLogging

 function setupLogging()
 {
     global $default;
     $oKTConfig =& KTConfig::getSingleton();
     if (!defined('APP_NAME')) {
         define('APP_NAME', $oKTConfig->get('ui/appName', 'KnowledgeTree'));
     }
     define('KT_LOG4PHP_DIR', KT_DIR . '/thirdparty/apache-log4php/src/main/php' . DIRECTORY_SEPARATOR);
     define('LOG4PHP_CONFIGURATION', KT_DIR . '/config/ktlog.ini');
     define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true);
     require_once KT_LOG4PHP_DIR . 'LoggerManager.php';
     require_once KT_LOG4PHP_DIR . 'LoggerPropertyConfigurator.php';
     $configurator = new LoggerPropertyConfigurator();
     $repository = LoggerManager::getLoggerRepository();
     $properties = @parse_ini_file(LOG4PHP_CONFIGURATION);
     $properties['log4php.appender.default'] = 'LoggerAppenderDailyFile';
     $properties['log4php.appender.default.layout'] = 'LoggerPatternLayout';
     $properties['log4php.appender.default.layout.conversionPattern'] = '%d{Y-m-d | H:i:s} | %p | %t | %r | %X{userid} | %X{db} | %c | %M | %m%n';
     $properties['log4php.appender.default.datePattern'] = 'Y-m-d';
     $logDir = $oKTConfig->get('urls/logDirectory');
     $properties['log4php.appender.default.file'] = $logDir . '/kt%s.' . KTUtil::running_user() . '.log.txt';
     // get the log level set in the configuration settings to override the level set in ktlog.ini
     // for the default / main logging. Additional logging can be configured through the ini file
     $logLevel = $oKTConfig->get('KnowledgeTree/logLevel');
     $properties['log4php.rootLogger'] = $logLevel . ', default';
     session_start();
     $configurator->doConfigureProperties($properties, $repository);
     $userId = isset($_SESSION['userID']) ? $_SESSION['userID'] : 'n/a';
     LoggerMDC::put('userid', $userId);
     LoggerMDC::put('db', $oKTConfig->get('db/dbName'));
     $default->log = LoggerManager::getLogger('default');
     $default->queryLog = LoggerManager::getLogger('sql');
     $default->timerLog = LoggerManager::getLogger('timer');
     $default->phpErrorLog = LoggerManager::getLogger('php');
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:35,代码来源:dmsDefaults.php

示例3: _deleteProxyFiles

 function _deleteProxyFiles()
 {
     $oKTConfig =& KTConfig::getSingleton();
     // from ktentityutil::_proxyCreate
     $sDirectory = $oKTConfig->get('cache/proxyCacheDirectory');
     if (!file_exists($sDirectory)) {
         return;
     }
     $sRunningUser = KTUtil::running_user();
     if ($sRunningUser) {
         $sDirectory = sprintf("%s/%s", $sDirectory, $sRunningUser);
     }
     if (!file_exists($sDirectory)) {
         return;
     }
     $dh = @opendir($sDirectory);
     if (empty($dh)) {
         return;
     }
     $aFiles = array();
     while (false !== ($sFilename = readdir($dh))) {
         if (substr($sFilename, -8) == ".inc.php") {
             $aFiles[] = sprintf('%s/%s', $sDirectory, $sFilename);
         }
     }
     foreach ($aFiles as $sFile) {
         @unlink($sFile);
     }
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:29,代码来源:UpgradeItems.inc.php


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