本文整理汇总了PHP中DB_DataObject::debugLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_DataObject::debugLevel方法的具体用法?PHP DB_DataObject::debugLevel怎么用?PHP DB_DataObject::debugLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_DataObject
的用法示例。
在下文中一共展示了DB_DataObject::debugLevel方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debugLevel
public static function debugLevel($v = null)
{
// avoid those annoying PEAR::DB strict standards warnings it causes
$old = error_reporting();
error_reporting(error_reporting() & ~E_STRICT);
$res = parent::debugLevel($v);
// reset
error_reporting($old);
return $res;
}
示例2: parseArgs
function parseArgs(&$opts)
{
if ($opts['debug']) {
DB_DataObject::debugLevel($opts['debug']);
print_r($opts);
}
$this->opts = $opts;
if (!empty($opts['poolsize'])) {
$this->max_pool_size = $opts['poolsize'];
}
if (empty($opts['limit'])) {
$opts['limit'] = '1000';
// not sure why it's not picking up the defautl..
}
if (!empty($opts['old'])) {
$opts['list'] = 1;
// force listing..
}
$this->force = empty($opts['force']) ? 0 : 1;
if (!empty($opts['send-to'])) {
$this->send_to = $opts['send-to'];
}
}
示例3: debug
/**
* DB_DataObject_FormBuilder::debug()
*
* Outputs a debug message, if the debug setting in the DataObject.ini file is
* set to 1 or higher.
*
* @param string $message The message to printed to the browser
* @access public
* @see DB_DataObject::debugLevel()
*/
function debug($message)
{
if (DB_DataObject::debugLevel() > 0) {
echo '<pre><b>FormBuilder:</b> ' . $message . "</pre>\n";
}
}
示例4: define
//
// $Id: createTables.php 277015 2009-03-12 05:51:03Z alan_k $
//
// since this version doesnt use overload,
// and I assume anyone using custom generators should add this..
define('DB_DATAOBJECT_NO_OVERLOAD', 1);
//require_once 'DB/DataObject/Generator.php';
require_once 'DB/DataObject/Generator.php';
if (!ini_get('register_argc_argv')) {
PEAR::raiseError("\nERROR: You must turn register_argc_argv On in you php.ini file for this to work\neg.\n\nregister_argc_argv = On\n\n", null, PEAR_ERROR_DIE);
exit;
}
if (!@$_SERVER['argv'][1]) {
PEAR::raiseError("\nERROR: createTable.php usage:\n\nC:\\php\\pear\\DB\\DataObjects\\createTable.php example.ini\n\n", null, PEAR_ERROR_DIE);
exit;
}
$config = parse_ini_file($_SERVER['argv'][1], true);
foreach ($config as $class => $values) {
$options = PEAR::getStaticProperty($class, 'options');
$options = $values;
}
$options = PEAR::getStaticProperty('DB_DataObject', 'options');
if (empty($options)) {
PEAR::raiseError("\nERROR: could not read ini file\n\n", null, PEAR_ERROR_DIE);
exit;
}
set_time_limit(0);
// use debug level from file if set..
DB_DataObject::debugLevel(isset($options['debug']) ? $options['debug'] : 1);
$generator = new DB_DataObject_Generator();
$generator->start();
示例5: error_reporting
<?php
// -*- C++ -*-
error_reporting(E_ALL);
// Test for: DB::parseDSN()
require_once '../DataObject.php';
require_once '../DataObject/Generator.php';
require_once 'PEAR.php';
$options =& PEAR::getStaticProperty('DB_DataObject', 'options');
//$options['schema_location'] = dirname(__FILE__);
$options['database'] = 'mysql://alan@localhost/test';
$options['debug_force_updates'] = TRUE;
$options['proxy'] = 'light';
$options['class_prefix'] = '';
DB_DataObject::debugLevel(1);
示例6: run
public function run()
{
$this->ajaxAuth = true;
if ($this->getOption('auth')) {
$this->ajaxAuth = false;
$subController = new M_Office_Auth($_REQUEST['database']);
if (!key_exists('adminPrivileges', $_SESSION) || key_exists('logout', $_REQUEST)) {
$this->assign('username', User::getInstance('office')->getProperty('username'));
$this->ajaxAuth = true;
} elseif (!User::getInstance('office')->isLoggedIn()) {
$this->ajaxAuth = false;
} else {
$subController->initOptions();
$this->assign('username', User::getInstance('office')->getProperty('username'));
}
}
$not = Notifier::getInstance();
$not->addListener($this);
if ($this->getOption('auth') && !User::getInstance('office')->isLoggedIn()) {
if (self::isAjaxRequest()) {
$this->assign('__action', 'ajaxlogin');
}
return;
}
if (key_exists('updateSuccess', $_REQUEST)) {
$this->say(__('Record was successfully updated'));
M_Office_Util::clearRequest(array('updateSuccess' => 1));
}
if (isset($_REQUEST['module'])) {
$info = M_Office_Util::getModuleInfo($_REQUEST['module']);
$module = $_REQUEST['module'];
if (!$info) {
if (strpos($_REQUEST['module'], ':')) {
$info = array('type' => 'dyn', 'title' => 'Plugin');
$module = $tab[1];
} elseif (preg_match('`^(.+)helper$`', $_REQUEST['module'], $tab)) {
$info = array('type' => 'dyn', 'title' => __("modules.{$tab[1]}helper.title"));
$module = $_REQUEST['module'];
} else {
throw new NotFoundException(__('error.module_not_found', array($_REQUEST['module'])));
}
}
}
if ($this->isAjaxRequest() && $this->ajaxAuth && $info['type'] != 'dyn') {
$this->output = '';
unset($this->localOutput);
}
if (isset($_REQUEST['debug']) && MODE == 'development') {
$debug = (int) $_REQUEST['debug'] % 3;
DB_DataObject::debugLevel($debug);
ini_set('display_errors', 1);
}
if ($_REQUEST['livesearch']) {
$aj = new M_Office_livesearch($_REQUEST['searchtext'], $_REQUEST['expand']);
$this->output = $aj->processRequest();
return;
} elseif ($_REQUEST['treesort']) {
$aj = new M_Office_treesort();
$this->output = $aj->processRequest();
return;
} elseif ($_REQUEST['liveedit']) {
$aj = new M_Office_liveedit($_REQUEST['liveedit']);
$this->output = $aj->processRequest();
return;
} elseif (key_exists('ajaxfromtable', $_REQUEST)) {
$table = $_REQUEST['module'];
$do = DB_DataObject::factory($table);
$do->get($_REQUEST['filterField'], $_REQUEST['filterValue']);
$aj = new M_Office_ajaxFromTable($do, $_REQUEST['module'], $_REQUEST['module'], $_REQUEST['filterField'], $_REQUEST['filterValue']);
$this->output = $aj->processRequest();
return;
}
if (isset($_REQUEST['module'])) {
if (!$info) {
$info = M_Office_Util::getModuleInfo($_REQUEST['module']);
}
switch ($info['type']) {
case 'db':
// TODO ajouter ce path en avant-dernier et non en dernier
Mreg::get('tpl')->addPath(APP_ROOT . 'app/' . APP_NAME . '/templates/' . $info['table'] . '/', 'after');
Mreg::get('tpl')->addPath(APP_ROOT . 'app/' . APP_NAME . '/templates/' . $_REQUEST['module'] . '/', 'after');
$subController = new M_Office_ShowTable($_REQUEST['module'], $filter);
break;
case 'dyn':
// home module = available for everyone
$allowAccess = $_REQUEST['module'] == 'home' || M_Office_Util::getGlobalOption('view', 'showtable', $_REQUEST['module']);
if (!$allowAccess) {
Log::warn('User is NOT allowed to access ' . $_REQUEST['module']);
M_Office_Util::refresh(M_Office::URL(array(), array_keys($_REQUEST)));
} else {
Log::info('User is allowed to access ' . $_REQUEST['module']);
}
$subController = Module::factory($_REQUEST['module'], M::getPaths('module'));
$subController->executeAction($_REQUEST['action'] ? $_REQUEST['action'] : 'index');
$this->assign('__action', 'dyn');
$layout = $subController->getConfig('layout', $_REQUEST['action'] ? $_REQUEST['action'] : 'index');
if ($layout == '__self') {
M_Office::$dsp = '__defaut/ajaxindex';
} elseif ($layout) {
M_Office::$dsp = $layout;
//.........这里部分代码省略.........
示例7: get
function get($s = '')
{
$this->sessionState(0);
$lbits = $this->guessUsersLanguage();
if ($this->authUser && !empty($_REQUEST['_debug'])) {
DB_DataObject::debugLevel(1);
}
$i = DB_DataObject::Factory('I18n');
switch ($s) {
case 'Lang':
$i->ltype = 'l';
$i->applyFilters($_REQUEST, $this->authUser, $this);
$this->jdata($i->toTransList('l', implode('_', $lbits)));
break;
case 'Country':
$i->ltype = 'c';
$i->applyFilters($_REQUEST, $this->authUser, $this);
$this->jdata($i->toTransList('c', implode('_', $lbits)));
break;
case 'Currency':
$i->ltype = 'm';
$i->applyFilters($_REQUEST, $this->authUser, $this);
$this->jdata($i->toTransList('m', implode('_', $lbits)));
break;
case 'Timezone':
$ar = DateTimeZone::listAbbreviations();
$ret = array();
$tza = array();
foreach ($ar as $tl => $sar) {
foreach ($sar as $tz) {
$tza[] = $tz['timezone_id'];
}
}
$tza = array_unique($tza);
sort($tza);
foreach ($tza as $tz) {
//filtering..
if (empty($_REQUEST['q']) || 0 === strcasecmp(substr($tz, 0, strlen($_REQUEST['q'])), $_REQUEST['q'])) {
$ret[] = array('tz' => $tz);
}
}
$this->jdata($ret);
}
if (!empty($_REQUEST['debug'])) {
DB_DataObject::debugLevel(1);
}
$i = DB_DataObject::Factory('I18n');
$i->buildDB();
$i = DB_DataObject::Factory('I18n');
$cfg = $i->cfg();
$langs = $cfg['t'];
// var_dump($langs);exit;
$ar = array();
foreach ($langs as $lang) {
//$rlang = array_shift(explode('_', strtoupper($lang)));
$rlang = array_shift(explode('_', $lang));
$ar[$lang] = array();
$i = DB_DataObject::Factory('I18n');
$ar[$lang]['l'] = $i->toTransList('l', $rlang);
$i = DB_DataObject::Factory('I18n');
$ar[$lang]['c'] = $i->toTransList('c', $rlang);
$i = DB_DataObject::Factory('I18n');
$ar[$lang]['m'] = $i->toTransList('m', $rlang);
}
//echo '<PRE>';print_r($ar);
header('Content-type: text/javascript');
echo 'Pman.I18n.Data = ' . json_encode($ar);
exit;
}
示例8: get
function get($args, $opts)
{
$this->opts = $opts;
if (!empty($this->opts['debug'])) {
DB_DataObject::debugLevel(1);
}
if (!empty($this->opts['list'])) {
$this->listTypes();
}
if (empty($this->opts['group'])) {
$this->jerr('Missing group - try add [-t {group name}]');
}
$min = 0;
if ($this->opts['uid'] != 'STD') {
$events = DB_DataObject::factory('Events');
$events->action = 'ERROR-REPORT-' . $this->opts['uid'];
$events->orderBy('id DESC');
$events->limit(1);
if ($events->find(true)) {
$min = $events->id;
}
}
$events = DB_DataObject::factory('Events');
$events->selectAdd();
$events->selectAdd("\n DISTINCT(Events.action) AS action,\n COUNT(Events.id) AS total\n ");
$events->whereAdd('Events.id > ' . $min);
$events->whereAdd("Events.action NOT LIKE 'ERROR-REPORT-%'");
$events->whereAdd("Events.event_when > NOW() - INTERVAL 1 DAY");
if (!empty($this->opts['exclude'])) {
$exclude = array_unique(array_filter(array_map('trim', explode(',', $this->opts['exclude']))));
if (!empty($exclude)) {
$events->whereAddIn('!Events.action', $exclude, 'string');
}
}
if (!empty($this->opts['only'])) {
$only = array_unique(array_filter(array_map('trim', explode(',', $this->opts['only']))));
if (!empty($only)) {
$events->whereAddIn('Events.action', $only, 'string');
}
}
$events->groupBy('Events.action');
$events->orderBy('Events.action ASC');
$summary = $events->fetchAll('action', 'total');
if (empty($summary)) {
$this->jerror('ERROR-REPORT-' . $this->opts['uid'], 'Nothing to be sent');
}
$subject = array();
foreach ($summary as $k => $v) {
$subject[] = "{$v} {$k}";
}
$subject = implode(', ', $subject);
if (!empty($this->opts['subject'])) {
$subject = "{$this->opts['subject']} {$subject}";
}
$events = DB_DataObject::factory('Events');
$events->autoJoin();
$events->selectAdd();
$events->selectAdd("\n Events.id AS id,\n Events.event_when AS event_when,\n Events.action AS action,\n Events.remarks AS remarks\n \n ");
$events->selectAddPersonEmail();
$events->whereAdd("Events.action NOT LIKE 'ERROR-REPORT-%'");
$events->whereAdd('Events.id > ' . $min);
$events->whereAdd("Events.event_when > NOW() - INTERVAL 1 DAY");
$exclude = array_unique(array_filter(array_map('trim', explode(',', $this->opts['exclude']))));
if (!empty($exclude)) {
$events->whereAddIn('!Events.action', $exclude, 'string');
}
if (!empty($only)) {
$events->whereAddIn('Events.action', $only, 'string');
}
if (!$events->count()) {
// this is the second count we are doing...
$this->jerr('Nothing to be sent');
}
$this->addEvent('ERROR-REPORT-' . $this->opts['uid'], false, $subject);
$errors = $events->fetchAll();
if (!empty($this->opts['host'])) {
// reset the mail settings..
HTML_FlexyFramework::get()->Mail = array('host' => $this->opts['host']);
}
if (!empty($this->opts['helo'])) {
HTML_FlexyFramework::get()->Mail['helo'] = $this->opts['helo'];
}
$content = array('template' => 'EVENT_ERRORS_REPORT', 'rcpts_group' => $this->opts['group'], 'errors' => $errors, 'subject' => $subject);
$sent = DB_DataObject::factory('core_email')->send($content);
if (!is_object($sent)) {
$this->jok("Done");
}
$this->jerr($sent);
}
示例9: get
function get($id, $opts)
{
//print_r($opts);
if (!empty($opts['DB_DataObject-debug'])) {
DB_DataObject::debugLevel($opts['DB_DataObject-debug']);
}
//DB_DataObject::debugLevel(1);
//date_default_timezone_set('UTC');
// phpinfo();exit;
$force = empty($opts['force']) ? 0 : 1;
$w = DB_DataObject::factory($this->table);
if (!$w->get($id)) {
$this->errorHandler("invalid id\n");
}
if (!$force && strtotime($w->act_when) < strtotime($w->sent)) {
$this->errorHandler("send repeat to early\n");
}
if (!empty($opts['debug'])) {
print_r($w);
$ff = HTML_FlexyFramework::get();
if (!isset($ff->Core_Mailer)) {
$ff->Core_Mailer = array();
}
HTML_FlexyFramework::get()->Core_Mailer['debug'] = true;
}
$sent = empty($w->sent) || preg_match('/^0000/', $w->sent) ? false : true;
if (!$force && (!empty($w->msgid) || $sent)) {
$ww = clone $w;
if (!$sent) {
$w->sent = $w->sqlValue("NOW()");
$w->update($ww);
}
$this->errorHandler("message has been sent already.\n");
}
$o = $w->object();
if ($o === false) {
$ev = $this->addEvent('NOTIFY', $w, "Notification event cleared (underlying object does not exist)");
$ww = clone $w;
$w->sent = date('Y-m-d H:i:s');
$w->msgid = '';
$w->event_id = $ev->id;
$w->update($ww);
$this->errorHandler(date('Y-m-d h:i:s ') . "Notification event cleared (underlying object does not exist)" . "\n");
}
$p = $w->person();
if (isset($p->active) && empty($p->active)) {
$ev = $this->addEvent('NOTIFY', $w, "Notification event cleared (not user not active any more)");
$ww = clone $w;
$w->sent = date('Y-m-d H:i:s');
$w->msgid = '';
$w->event_id = $ev->id;
$w->update($ww);
$this->errorHandler(date('Y-m-d h:i:s ') . "Notification event cleared (not user not active any more)" . "\n");
$this->errorHandler("message has been sent already.\n");
}
// let's work out the last notification sent to this user..
$l = DB_DataObject::factory($this->table);
$lar = array('ontable' => $w->ontable, 'onid' => $w->onid);
// only newer version of the database us this..
$personid_col = strtolower($w->person_table) . '_id';
if (isset($w->{$personid_col})) {
$lar[$personid_col] = $w->{$personid_col};
}
$l->setFrom($lar);
$l->whereAdd('id != ' . $w->id);
$l->orderBy('sent DESC');
$l->limit(1);
$ar = $l->fetchAll('sent');
$last = empty($ar) ? date('Y-m-d H:i:s', 0) : $ar[0];
// find last event..
$ev = DB_DataObject::factory('Events');
$ev->on_id = $w->id;
// int(11)
$ev->on_table = $this->table;
$ev->limit(1);
$ev->orderBy('event_when DESC');
$ar = $ev->fetchAll('event_when');
$last_event = empty($ar) ? 0 : $ar[0];
$next_try_min = 5;
if ($last_event) {
$next_try_min = floor((time() - strtotime($last_event)) / 60) * 2;
}
$next_try = $next_try_min . ' MINUTES';
// this may modify $p->email. (it will not update it though)
$email = $this->makeEmail($o, $p, $last, $w, $force);
if ($email === true) {
$ev = $this->addEvent('NOTIFY', $w, "Notification event cleared (not required any more)");
$ww = clone $w;
$w->sent = date('Y-m-d H:i:s');
$w->msgid = '';
$w->event_id = $ev->id;
$w->update($ww);
$this->errorHandler(date('Y-m-d h:i:s ') . "Notification event cleared (not required any more)" . "\n");
}
if (is_a($email, 'PEAR_Error')) {
$email = array('error' => $email->toString());
}
if (empty($p) && !empty($email['recipients'])) {
// make a fake person..
$p = (object) array('email' => $email['recipients']);
//.........这里部分代码省略.........
示例10: get
function get($path)
{
ini_set('memory_limit', '256M');
// we need alot of memory
set_time_limit(0);
$argv = $_SERVER['argv'];
array_shift($argv);
array_shift($argv);
$opts = explode(',', 'table==,where==,dump-dir==,debug=');
require_once 'Console/Getopt.php';
$go = Console_Getopt::getopt2($argv, '', $opts);
if (is_object($go)) {
die($go->toString());
}
foreach ($go[0] as $ar) {
$args[substr($ar[0], 2)] = $ar[1];
}
$errs = array();
foreach ($opts as $req) {
if (substr($req, -2, 2) != '==') {
// skip optional arguments
continue;
}
if (empty($args[substr($req, 0, -2)])) {
$errs[] = "--" . substr($req, 0, -2) . ' is required';
}
}
if (!empty($errs)) {
die(print_R($errs, true));
}
if (!empty($args['debug'])) {
DB_DataObject::debugLevel($args['debug']);
}
$this->args = $args;
$this->out = array();
$this->discoverChildren($this->args['table'], $this->args['where'], true);
//print_R($this->deletes);
//print_r($this->dumps);
//exit;
$this->discover($this->args['table'], $this->args['where'], true);
if (!file_exists($args['dump-dir'])) {
mkdir($args['dump-dir'], 0777, true);
}
$this->generateInsert();
$this->generateDelete();
$this->generateShell();
echo "DELETING:\n";
foreach ($this->deletes as $tbl => $ar) {
if (empty($ar)) {
continue;
}
echo " " . $tbl . ' -> ' . count(array_keys($ar)) . " Records\n";
}
echo "DUMPING:\n";
foreach ($this->dumps as $tbl => $ar) {
if (empty($ar)) {
continue;
}
echo " " . $tbl . ' -> ' . count(array_keys($ar)) . " Records\n";
}
echo "FILES:\n";
echo " Total : " . $this->filetotal . " files using " . floor($this->filesize / 1000000) . "Mb\n";
echo "GENERATED FILES:\n";
// summary
echo " " . implode("\n ", $this->out) . "\n";
exit;
}
示例11: picture
public function picture($marca)
{
$obj = DB_DataObject::Factory('MpBrand');
DB_DataObject::debugLevel(1);
printVar($obj);
$obj->name = $marca;
$find = $obj->find();
if ($find < 0) {
while ($obj->fetch()) {
echo $obj->picture;
}
} else {
echo 'ni mir..';
}
$obj->free();
}
示例12: debug
/**
* Debugger. - use this in your extended classes to output debugging information.
*
* Uses DB_DataObject::DebugLevel(x) to turn it on
*
* @param string $message - message to output
* @param string $logtype - bold at start
* @param string $level - output level
* @access public
* @return none
*/
function debug($message, $logtype = 0, $level = 1)
{
global $_DB_DATAOBJECT;
if (DB_DataObject::debugLevel() < $level) {
return;
}
if (!ini_get('html_errors')) {
echo "{$logtype} : {$message}\n";
flush();
return;
}
echo "<PRE><B>{$logtype}</B> {$message}</PRE>\n";
flush();
}
示例13: get
function get($path)
{
ini_set('memory_limit', '256M');
// we need alot of memory
set_time_limit(0);
$argv = $_SERVER['argv'];
array_shift($argv);
array_shift($argv);
$opts = explode(',', 'table==,where==,dump-dir==,debug=');
require_once 'Console/Getopt.php';
$go = Console_Getopt::getopt2($argv, '', $opts);
if (is_object($go)) {
die($go->toString());
}
foreach ($go[0] as $ar) {
$args[substr($ar[0], 2)] = $ar[1];
}
$errs = array();
foreach ($opts as $req) {
if (substr($req, -2, 2) != '==') {
// skip optional arguments
continue;
}
if (empty($args[substr($req, 0, -2)])) {
$errs[] = "--" . substr($req, 0, -2) . ' is required';
}
}
if (!empty($errs)) {
die(print_R($errs, true));
}
if (!empty($args['debug'])) {
DB_DataObject::debugLevel($args['debug']);
}
$this->args = $args;
$this->out = array();
$this->discoverChildren($this->args['table'], $this->args['where'], true);
//print_R($this->deletes);
//print_r($this->dumps);
//exit;
$this->discover($this->args['table'], $this->args['where'], true);
if (!file_exists($args['dump-dir'])) {
mkdir($args['dump-dir'], 0777, true);
}
// create uid's
// dump items..
echo "GENERATED FILES:\n";
// summary
echo " " . implode("\n ", $this->out) . "\n";
exit;
}
示例14: debug
function debug($n)
{
return DB_DataObject::debugLevel($n);
}