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


PHP xPDO::setLogTarget方法代码示例

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


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

示例1: _connect

 /**
  * Creates the database connection for the installation process.
  *
  * @access private
  * @return xPDO The xPDO instance to be used by the installation.
  */
 public function _connect($dsn, $user = '', $password = '', $prefix = '', array $options = array())
 {
     if (include_once MODX_CORE_PATH . 'xpdo/xpdo.class.php') {
         $this->xpdo = new xPDO($dsn, $user, $password, array_merge(array(xPDO::OPT_CACHE_PATH => MODX_CORE_PATH . 'cache/', xPDO::OPT_TABLE_PREFIX => $prefix, xPDO::OPT_SETUP => true), $options), array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT));
         $this->xpdo->setLogTarget(array('target' => 'FILE', 'options' => array('filename' => 'install.' . MODX_CONFIG_KEY . '.' . strftime('%Y%m%dT%H%M%S') . '.log')));
         $this->xpdo->setLogLevel(xPDO::LOG_LEVEL_ERROR);
         return $this->xpdo;
     } else {
         return $this->lexicon('xpdo_err_nf', array('path' => MODX_CORE_PATH . 'xpdo/xpdo.class.php'));
     }
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:17,代码来源:modinstall.class.php

示例2: array

/* get properties */
$properties = array();
$f = dirname(__FILE__) . '/build.properties.php';
$included = false;
if (file_exists($f)) {
    $included = @(include $f);
}
if (!$included) {
    die('build.properties.php was not found. Please make sure you have created one using the template of build.properties.sample.php.');
}
unset($f, $included);
/* instantiate xpdo instance */
$xpdo = new xPDO(XPDO_DSN, XPDO_DB_USER, XPDO_DB_PASS, array(xPDO::OPT_TABLE_PREFIX => XPDO_TABLE_PREFIX, xPDO::OPT_CACHE_PATH => MODX_CORE_PATH . 'cache/'), array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
$cacheManager = $xpdo->getCacheManager();
$xpdo->setLogLevel(xPDO::LOG_LEVEL_INFO);
$xpdo->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$xpdo->loadClass('transport.xPDOTransport', XPDO_CORE_PATH, true, true);
$packageDirectory = MODX_CORE_PATH . 'packages/';
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Beginning build script processes...');
flush();
/* remove pre-existing package files and directory */
if (file_exists($packageDirectory . 'core.transport.zip')) {
    @unlink($packageDirectory . 'core.transport.zip');
}
if (file_exists($packageDirectory . 'core') && is_dir($packageDirectory . 'core')) {
    $cacheManager->deleteTree($packageDirectory . 'core', array('deleteTop' => true, 'skipDirs' => false, 'extensions' => '*'));
}
if (!file_exists($packageDirectory . 'core') && !file_exists($packageDirectory . 'core.transport.zip')) {
    $xpdo->log(xPDO::LOG_LEVEL_INFO, 'Removed pre-existing core/ and core.transport.zip.');
    flush();
} else {
开发者ID:OptimusCrime,项目名称:revolution,代码行数:31,代码来源:transport.core.php

示例3: array

 /**
  * Create or grab a reference to a static xPDO/modX instance.
  *
  * The instances can be reused by multiple tests and test suites.
  *
  * @param string $class A fixture class to get an instance of.
  * @param string $name A unique identifier for the fixture.
  * @param boolean $new
  * @param array $options An array of configuration options for the fixture.
  * @return object|null An instance of the specified fixture class or null on failure.
  */
 public static function &getFixture($class, $name, $new = false, array $options = array())
 {
     if (!$new && array_key_exists($name, self::$fixtures) && self::$fixtures[$name] instanceof $class) {
         $fixture =& self::$fixtures[$name];
     } else {
         $properties = array();
         include_once dirname(dirname(dirname(__FILE__))) . '/core/model/modx/modx.class.php';
         include dirname(__FILE__) . '/properties.inc.php';
         self::$properties = $properties;
         if (array_key_exists('debug', self::$properties)) {
             self::$debug = (bool) self::$properties['debug'];
         }
         $fixture = null;
         $driver = self::$properties['xpdo_driver'];
         switch ($class) {
             case 'modX':
                 if (!defined('MODX_REQP')) {
                     define('MODX_REQP', false);
                 }
                 if (!defined('MODX_CONFIG_KEY')) {
                     define('MODX_CONFIG_KEY', array_key_exists('config_key', self::$properties) ? self::$properties['config_key'] : 'test');
                 }
                 $fixture = new modX(null, self::$properties["{$driver}_array_options"]);
                 if ($fixture instanceof modX) {
                     $logLevel = array_key_exists('logLevel', self::$properties) ? self::$properties['logLevel'] : modX::LOG_LEVEL_WARN;
                     $logTarget = array_key_exists('logTarget', self::$properties) ? self::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
                     $fixture->setLogLevel($logLevel);
                     $fixture->setLogTarget($logTarget);
                     if (!empty(self::$debug)) {
                         $fixture->setDebug(self::$properties['debug']);
                     }
                     $fixture->initialize(self::$properties['context']);
                     $fixture->user = $fixture->newObject('modUser');
                     $fixture->user->set('id', $fixture->getOption('modx.test.user.id', null, 1));
                     $fixture->user->set('username', $fixture->getOption('modx.test.user.username', null, 'test'));
                     $fixture->getRequest();
                     $fixture->getParser();
                     $fixture->request->loadErrorHandler();
                 }
                 break;
             case 'xPDO':
                 $fixture = new xPDO(self::$properties["{$driver}_string_dsn_test"], self::$properties["{$driver}_string_username"], self::$properties["{$driver}_string_password"], self::$properties["{$driver}_array_options"], self::$properties["{$driver}_array_driverOptions"]);
                 if ($fixture instanceof xPDO) {
                     $logLevel = array_key_exists('logLevel', self::$properties) ? self::$properties['logLevel'] : xPDO::LOG_LEVEL_WARN;
                     $logTarget = array_key_exists('logTarget', self::$properties) ? self::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
                     $fixture->setLogLevel($logLevel);
                     $fixture->setLogTarget($logTarget);
                     if (!empty(self::$debug)) {
                         $fixture->setDebug(self::$properties['debug']);
                     }
                 }
                 break;
             default:
                 $fixture = new $class($options);
                 break;
         }
         if ($fixture !== null && $fixture instanceof $class) {
             self::$fixtures[$name] = $fixture;
         } else {
             die("Error setting fixture {$name} of expected class {$class}.");
         }
     }
     return $fixture;
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:75,代码来源:MODxTestHarness.php

示例4: _connect

 /**
  * Creates the database connection for the installation process.
  *
  * @access private
  * @return xPDO The xPDO instance to be used by the installation.
  */
 public function _connect($dsn, $user = '', $password = '', $prefix = '', array $options = array())
 {
     if (include_once MODX_CORE_PATH . 'xpdo/xpdo.class.php') {
         $xpdo = new xPDO($dsn, $user, $password, array_merge(array(xPDO::OPT_CACHE_PATH => MODX_CORE_PATH . 'cache/', xPDO::OPT_TABLE_PREFIX => $prefix, xPDO::OPT_LOADER_CLASSES => array('modAccessibleObject'), xPDO::OPT_SETUP => true), $options), array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT => false, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
         $xpdo->setLogTarget(array('target' => 'FILE', 'options' => array('filename' => 'install.' . MODX_CONFIG_KEY . '.' . strftime('%Y%m%dT%H%M%S') . '.log')));
         $xpdo->setLogLevel(xPDO::LOG_LEVEL_ERROR);
         return $xpdo;
     } else {
         return $this->lexicon('xpdo_err_nf', array('path' => MODX_CORE_PATH . 'xpdo/xpdo.class.php'));
     }
 }
开发者ID:JoeBlow,项目名称:revolution,代码行数:17,代码来源:modinstall.class.php


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