本文整理汇总了PHP中modX::setDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::setDebug方法的具体用法?PHP modX::setDebug怎么用?PHP modX::setDebug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modX
的用法示例。
在下文中一共展示了modX::setDebug方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getConnection
/**
* Grab a persistent instance of the xPDO class to share connection data
* across multiple tests and test suites.
*
* @param array $options An array of configuration parameters.
* @return xPDO An xPDO object instance.
*/
public static function _getConnection($options = array())
{
$modx = FiTestHarness::$modx;
if (is_object($modx)) {
if (!$modx->request) {
$modx->getRequest();
}
if (!$modx->error) {
$modx->request->loadErrorHandler();
}
$modx->error->reset();
FiTestHarness::$modx = $modx;
return FiTestHarness::$modx;
}
/* include config.core.php */
$properties = array();
$config = array();
include strtr(realpath(dirname(__FILE__)) . '/config.inc.php', '\\', '/');
require_once $config['modx_base_path'] . 'config.core.php';
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
include_once strtr(realpath(dirname(__FILE__)) . '/properties.inc.php', '\\', '/');
if (!defined('MODX_REQP')) {
define('MODX_REQP', false);
}
$modx = new modX(null, $properties);
$ctx = !empty($options['ctx']) ? $options['ctx'] : 'web';
$modx->initialize($ctx);
$debug = !empty($options['debug']);
$modx->setDebug($debug);
if (!empty($properties['logTarget'])) {
$modx->setLogTarget($properties['logTarget']);
}
if (!empty($properties['logLevel'])) {
$modx->setLogLevel($properties['logLevel']);
}
$modx->user = $modx->newObject('modUser');
$modx->user->set('id', $modx->getOption('modx.test.user.id', null, 1));
$modx->user->set('username', $modx->getOption('modx.test.user.username', null, 'test'));
$modx->getRequest();
$modx->getParser();
$modx->request->loadErrorHandler();
@error_reporting(E_ALL);
@ini_set('display_errors', true);
FiTestHarness::$modx = $modx;
return $modx;
}
示例2: _getConnection
/**
* Grab a persistent instance of the xPDO class to share connection data
* across multiple tests and test suites.
*
* @param array $options An array of configuration parameters.
* @return xPDO An xPDO object instance.
*/
public static function _getConnection($options = array())
{
if (is_object(MODxTestHarness::$modx)) {
return MODxTestHarness::$modx;
}
/* include config.core.php */
$properties = array();
require_once strtr(realpath(dirname(dirname(dirname(__FILE__)))) . '/config.core.php', '\\', '/');
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
include_once strtr(realpath(dirname(__FILE__)) . '/properties.inc.php', '\\', '/');
$modx = new modX(null, $properties);
$ctx = !empty($options['ctx']) ? $options['ctx'] : 'web';
$modx->initialize($ctx);
$debug = !empty($options['debug']);
$modx->setDebug($debug);
$modx->user = $modx->newObject('modUser');
$modx->user->set('id', $modx->getOption('modx.test.user.id', 1));
$modx->user->set('username', $modx->getOption('modx.test.user.username', 'test'));
MODxTestHarness::$modx = $modx;
return $modx;
}
示例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;
}
示例4: dirname
if (is_array($vaporConfigOptions)) {
$vaporOptions = array_merge($vaporOptions, $vaporConfigOptions);
}
}
include dirname(dirname(__FILE__)) . '/config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
if (!XPDO_CLI_MODE && !ini_get('safe_mode')) {
set_time_limit(0);
}
$options = array('log_level' => xPDO::LOG_LEVEL_INFO, 'log_target' => array('target' => 'FILE', 'options' => array('filename' => 'vapor-' . strftime('%Y%m%dT%H%M%S', $startTime) . '.log')), xPDO::OPT_CACHE_DB => false, xPDO::OPT_SETUP => true);
$modx = new modX('', $options);
$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modx->startTime = $startTime;
$modx->getVersionData();
$modxVersion = $modx->version['full_version'];
if (version_compare($modxVersion, '2.2.1-pl', '>=')) {
$modx->initialize('mgr', $options);
} else {
$modx->initialize('mgr');
}
if (!$modx->hasPermission('Vapor')) {
die('Access denied');
}
$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
示例5: microtime
* @subpackage Build
* @author S. Hamblett <steve.hamblett@linux.com>
* @copyright 2010 S. Hamblett
* @license GPLv3 http://www.gnu.org/licenses/gpl.html
* @link none
*/
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
set_time_limit(0);
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setDebug(false);
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
echo '<pre>';
$modx->setLogTarget('ECHO');
error_reporting(E_ALL);
ini_set('display_errors', true);
$name = 'provisioner';
$version = '1.1.0';
$release = 'pl';
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage($name, $version, $release);
$builder->registerNamespace('provisioner', false, true, '{core_path}components/provisioner/');
$base = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $base, 'assets' => $base . 'assets/components/provisioner/', 'docs' => $base . 'assets/components/provisioner/docs/', 'core' => $base . 'core/components/provisioner/', 'lexicon' => $base . 'core/components/provisioner/lexicon/', 'model' => $base . 'core/components/provisioner/model/', 'templates' => $base . 'core/components/provisioner/templates/', 'build' => $base . '_build/', 'data' => $base . '_build/data/', 'resolvers' => $base . '_build/resolvers/', 'source_core' => $base . 'core/components/provisioner', 'source_assets' => $base . 'assets/components/provisioner');
unset($base);
示例6: define
mysql_close($modxConn);
unset($modxConn, $result, $sessid, $sessionTable, $sql);
/* Unset the variables we introduced from the config.inc.php
* that are not MODx specific, ie dont start with modx_ so we don't
* contaminate downstream. Not database variables, see below.
*/
unset($table_prefix, $lastInstallTime, $site_id, $site_sessionname, $https_port, $isSecureRequest, $url_scheme, $http_host, $site_url);
/* Caller specific initialisation */
/* Create a MODx object */
if (isset($modx_create_object)) {
/* Create a MODx object as a manager */
define('IN_MANAGER_MODE', true);
include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$options = array();
$modx = new modX('', $options);
$modx->setDebug(E_ALL & ~E_NOTICE);
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
$modx->setLogTarget('FILE');
$modx->initialize('mgr');
$modxConfig = $modx->GetConfig();
}
/* Preserve database variables */
if (isset($modx_preserve_database_variables)) {
/* Preserve them as modx_ variables */
$modx_database_type = $database_type;
$modx_database_server = $database_server;
$modx_database_user = $database_user;
$modx_database_password = $database_password;
$modx_database_connection_charset = $database_connection_charset;
$modx_dbase = $dbase;
}
示例7: modX
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @package modx
* @subpackage connectors
*/
@include(dirname(__FILE__) . '/config.core.php');
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(dirname(__FILE__)) . '/core/');
if (!include_once(MODX_CORE_PATH . 'model/modx/modx.class.php')) die();
$modx= new modX();
/* set debugging/logging options */
$modx->setDebug(E_ALL | E_STRICT);
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
$modx->setLogTarget('FILE');
/* initialize the proper context */
$ctx = isset($_REQUEST['ctx']) && !empty($_REQUEST['ctx']) ? $_REQUEST['ctx'] : 'mgr';
$modx->initialize($ctx);
if (defined('MODX_REQP') && MODX_REQP === false) {
} else if (!$modx->context->checkPolicy('load')) {
@session_write_close();
die();
}
if ($ctx == 'mgr') {
$ml = $modx->getOption('manager_language',null,'en');
if ($ml != 'en') {
示例8: process
public function process()
{
//$startTime = microtime(true);
try {
$vaporOptions = array('excludeExtraTablePrefix' => array(), 'excludeExtraTables' => array(), 'excludeFiles' => array(MODX_BASE_PATH . 'vapor', MODX_BASE_PATH . 'phpmyadmin', MODX_BASE_PATH . 'assets', MODX_BASE_PATH . 'core'));
if (is_readable(VAPOR_DIR . 'config.php')) {
$vaporConfigOptions = @(include VAPOR_DIR . 'config.php');
if (is_array($vaporConfigOptions)) {
$vaporOptions = array_merge($vaporOptions, $vaporConfigOptions);
}
}
if (!XPDO_CLI_MODE && !ini_get('safe_mode')) {
set_time_limit(0);
}
$options = array('log_level' => xPDO::LOG_LEVEL_INFO, 'log_target' => array('target' => 'FILE', 'options' => array('filename' => 'vapor-' . strftime('%Y%m%dT%H%M%S', $this->getProperty('startTime')) . '.log')), xPDO::OPT_CACHE_DB => false, xPDO::OPT_SETUP => true);
$modx = new modX('', $options);
$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modx->startTime = $this->getProperty('startTime');
$modx->getVersionData();
$modxVersion = $modx->version['full_version'];
if (version_compare($modxVersion, '2.2.1-pl', '>=')) {
$modx->initialize('mgr', $options);
} else {
$modx->initialize('mgr');
}
/*$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);*/
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modxDatabase = $modx->getOption('dbname', $options, $modx->getOption('database', $options));
$modxTablePrefix = $modx->getOption('table_prefix', $options, '');
$core_path = realpath($modx->getOption('core_path', $options, MODX_CORE_PATH)) . '/';
$assets_path = realpath($modx->getOption('assets_path', $options, MODX_ASSETS_PATH)) . '/';
$manager_path = realpath($modx->getOption('manager_path', $options, MODX_MANAGER_PATH)) . '/';
$base_path = realpath($modx->getOption('base_path', $options, MODX_BASE_PATH)) . '/';
$modx->log(modX::LOG_LEVEL_INFO, "core_path=" . $core_path);
$modx->log(modX::LOG_LEVEL_INFO, "assets_path=" . $assets_path);
$modx->log(modX::LOG_LEVEL_INFO, "manager_path=" . $manager_path);
$modx->log(modX::LOG_LEVEL_INFO, "base_path=" . $base_path);
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
/** @var modWorkspace $workspace */
$workspace = $modx->getObject('modWorkspace', 1);
if (!$workspace) {
$modx->log(modX::LOG_LEVEL_FATAL, "no workspace!");
}
$package = $builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
/* Defines the classes to extract (also used for truncation) */
$classes = $this->getClassesList();
$attributes = array('vehicle_class' => 'xPDOFileVehicle');
/* get all files from the components directory */
/*$modx->log(modX::LOG_LEVEL_INFO, "Packaging " . MODX_CORE_PATH . 'components');
$package->put(
array(
'source' => MODX_CORE_PATH . 'components',
'target' => 'return MODX_CORE_PATH;'
),
array(
'vehicle_class' => 'xPDOFileVehicle'
)
);*/
/* get all files from the assets directory */
/*$modx->log(modX::LOG_LEVEL_INFO, "Packaging " . MODX_BASE_PATH . 'assets');
$package->put(
array(
'source' => MODX_BASE_PATH . 'assets',
'target' => 'return MODX_BASE_PATH;'
),
array(
'vehicle_class' => 'xPDOFileVehicle'
)
);*/
/* get all files from the manager/components directory */
/*$modx->log(modX::LOG_LEVEL_INFO, "Packaging " . MODX_MANAGER_PATH . 'components');
$package->put(
array(
'source' => MODX_MANAGER_PATH . 'components',
'target' => 'return MODX_MANAGER_PATH;'
),
array(
'vehicle_class' => 'xPDOFileVehicle'
)
);*/
/* find other files/directories in the MODX_BASE_PATH */
$excludes = array('_build', 'setup', 'assets', 'ht.access', 'index.php', 'config.core.php', dirname(MODX_CORE_PATH) . '/' === MODX_BASE_PATH ? basename(MODX_CORE_PATH) : 'core', dirname(MODX_CONNECTORS_PATH) . '/' === MODX_BASE_PATH ? basename(MODX_CONNECTORS_PATH) : 'connectors', dirname(MODX_MANAGER_PATH) . '/' === MODX_BASE_PATH ? basename(MODX_MANAGER_PATH) : 'manager');
if (isset($vaporOptions['excludeFiles']) && is_array($vaporOptions['excludeFiles'])) {
$excludes = array_unique($excludes + $vaporOptions['excludeFiles']);
}
/*if ($dh = opendir(MODX_BASE_PATH)) {
$includes = array();
while (($file = readdir($dh)) !== false) {
/* ignore files/dirs starting with . or matching an exclude */
/*if (strpos($file, '.') === 0 || in_array(strtolower($file), $excludes)) {
continue;
}
//.........这里部分代码省略.........