本文整理汇总了PHP中Debugger类的典型用法代码示例。如果您正苦于以下问题:PHP Debugger类的具体用法?PHP Debugger怎么用?PHP Debugger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Debugger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate()
{/*{{{*/
$debugger = new Debugger();
$memcacheTime = $msg = '';
foreach ($this->hosts as $memcache)
{
$start = $debugger->getTimeStamp();
$m = new Memcached;
$m->addServer($memcache['host'], $memcache['port']);
$m->set('monitortest', 'haha', 10);
$res = $m->get('monitortest');
$end = $debugger->getTimeStamp();
$diff = $debugger->timeDiff($start, $end);
$key = $memcache['host'].':'.$memcache['port'];
if (false == $res || 'haha' != $res)
{
$msg .= $key.'memcacheʧЧ,';
}
if ($this->maxConnectTime < $diff)
{
$msg .= $key.'Á¬½Ó'.substr($diff, 0, 6).'ms,';
}
$memcacheTime .= "$diff ";
}
error_log(date('Y-m-d H:i:s').' '.rtrim($memcacheTime)."\n", 3, '/tmp/memcache_time.log');
if ($msg)
{
error_log(date('Y-m-d H:i:s').' '.$msg."\n", 3, '/tmp/memcache.log');
}
return $msg;
}/*}}}*/
示例2: setDebugEnabled
/**
* @param bool|false $flag
* @return $this
*/
public function setDebugEnabled($flag = false)
{
if (!$this->_debugger) {
//只有在debug开启时才实例化debugger,并且不能置于构造方法中,否则形成死循环
$this->_debugger = Debugger::getInstance();
}
$this->_debugger->setEnabled($flag);
return $this;
}
示例3: add
/**
* add method
*
* @return void
*/
public function add()
{
if ($this->request->is('post')) {
//Check to see if the user has selected a file
$this->Upload->set($this->request->data);
if ($this->Upload->validates()) {
//http://milesj.me/code/cakephp/uploader
$this->Uploader = new Uploader(array('tempDir' => TMP, 'baseDir' => WWW_ROOT, 'uploadDir' => 'files/uploads/' . $userFolder . '/', 'maxNameLength' => 200));
if ($data = $this->Uploader->upload('fileName')) {
// Upload successful, do whatever
//debug($data);
//Add pertinent data to the array
$this->request->data['Upload'] = $data;
$this->request->data['Upload']['active'] = 1;
//Disable until the user pays
$this->request->data['Upload']['user_id'] = $this->Upload->User->getLastInsertID();
//$this->request->data['Upload']['caption'] = $this->request->data['Upload']['custom_name'];
$this->Upload->create();
if ($this->Upload->save($this->request->data)) {
//Set the upload id
$this->request->data['Upload']['id'] = $this->Upload->getLastInsertID();
} else {
$this->Session->setFlash(__('Bummer :( Your file could NOT be uploaded.'));
$this->log('The file could not be uploaded.', 'upload_debug');
Debugger::log($data);
}
}
}
}
$works = $this->Upload->Work->find('list');
$this->set(compact('works'));
}
示例4: openChartWithId
static function openChartWithId($_cid)
{
require_once '../config.php';
require_once 'charts/PieChart.php';
require_once 'charts/Column.php';
global $db;
$sql = "select * from colfusion_charts where id = " . $_cid;
$rst = $db->get_result($sql);
$obj = $rst[0];
$datainfo = str_replace('\\"', '"', $obj->datainfo);
include_once 'Debug/Debugger.php';
Debugger::var_dump_value('cid', $_cid, null);
if ($obj->type == "pie") {
return new PieChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
}
if ($obj->type == "column") {
return new ColumnChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
}
if ($_type == "table") {
return new TableChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
}
if ($_type == "combo") {
return new ComboChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
}
if ($_type == "map") {
return new MapChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
}
if ($_type == "motion") {
return new MotionChart($_cid, $obj->name, $obj->canvas, $obj->type, $obj->left, $obj->top, $obj->depth, $obj->height, $obj->width, $obj->datainfo, $obj->note);
}
}
示例5: getDebugger
public function getDebugger(array $config = [])
{
if (null === $this->debugger) {
$this->debugger = Debugger::get(get_class($this), $config);
}
return $this->debugger;
}
示例6: main
public function main()
{
$aUser = $this->User->find('all');
foreach ($aUser as $user) {
$currTime = time();
$lastTime = strtotime(Hash::get($user, 'User.last_update'));
//TODO дата с нынешней до last_update
//если last_update давнее 12 часов, то брать последние 12 часов
$id = $user['User']['id'];
$date1 = $lastTime > $currTime - 43200 ? date("Y-m-d H:i:s", $lastTime) : date("Y-m-d H:00:00", $currTime - 43200);
$date2 = date("Y-m-d H:i:s");
$data = $this->User->getTimeline($id, $date1, $date2, 0, true);
//$this->set('data', $data);
//$this->set('timeFrom', strtotime($date1));
//$this->set('timeTo', strtotime($date2));
if (count($data['events'])) {
Debugger::dump($user['User']['id'] . ' ' . $user['User']['full_name'] . ' from: ' . $date1 . ' to: ' . $date2);
//Debugger::dump($data['events']);
/*
$Email = new CakeEmail('postmark');
$Email->template('updates_mailer', 'mail')->viewVars( array('data' => $data, 'timeFrom' => strtotime($date1), 'timeTo' => strtotime($date2), 'userID' => $user['User']['id']))
->to(Hash::get($user, 'User.username'))
->subject('Last updates on Konstruktor.com')
->send();
*/
}
}
}
示例7: actionCallback
public function actionCallback($oauth_token)
{
try {
$login_secret = $this->getSession('oauth')->login_secret;
if (!$oauth_token) {
echo "Error! There is no OAuth token!";
exit;
}
if (!$login_secret) {
echo "Error! There is no OAuth secret!";
exit;
}
$this->oauth->enableDebug();
$this->oauth->setToken($oauth_token, $login_secret);
$access_token_info = $this->oauth->getAccessToken(self::ACCESS_TOKEN_URL);
$this->getSession('oauth')->login_secret = false;
$this->getSession('oauth')->token = $access_token_info['oauth_token'];
$this->getSession('oauth')->secret = $access_token_info['oauth_token_secret'];
$this->getUserDetailsAndLoginUser();
} catch (OAuthException $E) {
Debugger::log($E);
//zalogujeme for sichr
echo "OAuth login failed. Please, contact administrator.";
$this->terminate();
}
}
示例8: detect
/**
* Detect available adapter
* @return string
*/
private static function detect()
{
static $autoDetected = null;
if ($autoDetected) {
return $autoDetected;
}
if (!Debugger::isCachesEnabled()) {
Debugger::addLine('Caching disabled by Debug Mode settings');
return self::INST_NONE;
}
if (Cache\APCu::isAvailable()) {
Debugger::addLine('Auto-detected cache type: APCu');
return $autoDetected = self::INST_APCU;
}
if (Cache\XCache::isAvailable()) {
Debugger::addLine('Auto-detected cache type: XCache');
return $autoDetected = self::INST_XCACHE;
} elseif (Cache\MemCached::isAvailable()) {
Debugger::addLine('Auto-detected cache type: MemCached');
return $autoDetected = self::INST_MEMCACHED;
} elseif (Cache\MemCache::isAvailable()) {
Debugger::addLine('Auto-detected cache type: Memcache');
return $autoDetected = self::INST_MEMCACHE;
// } elseif (Cache\SharedMemory::isAvailable()) {
// Debugger::getInstance()->addLine('Auto-detected cache type: Shared Memory');
// return $autoDetected = self::INST_SHAREDMEM;
}
Debugger::addLine('No cache detected');
return $autoDetected = self::INST_NONE;
}
示例9: beforeRenderFile
/**
* Sets a timer point before rendering a file.
*
* @param string $viewFile The view being rendered
*/
public function beforeRenderFile($viewFile)
{
if ($this->_renderComplete) {
return;
}
DebugTimer::start('render_' . basename($viewFile), __d('debug_kit', 'Rendering %s', Debugger::trimPath($viewFile)));
}
示例10: activate
function activate()
{
$setup = Config::get('RPC');
$class = URL::getPathPart($setup['class']);
$method = URL::getPathPart($setup['method']);
list($action, $type) = explode('.', URL::getPathPart($setup['action']), 2);
$path = $setup["path"] . "/" . $class . "/" . ucwords($method) . ucwords($action) . "Controller";
if (file_exists(Loader::getPath("controller", $path))) {
Debugger::log("CONTROLLER: <span style=\"color: #990000\">" . ucwords($method) . ucwords($action) . "Controller</span>");
$controller = Loader::loadNew("controller", $path);
$controller->activate();
if (is_callable(array($controller, $type))) {
echo $controller->{$type}();
}
return;
}
$controller_class = ucwords($class) . ucwords($method) . ucwords($action) . "Controller";
Debugger::log("CONTROLLER: <span style=\"color: #990000\">{$controller_class}</span>");
if (file_exists(Loader::getPath("controller", "{$setup['path']}/{$controller_class}"))) {
$controller = Loader::loadNew("controller", "{$setup['path']}/{$controller_class}");
$controller->activate();
} else {
Loader::load("utility", "Server");
$ip = Server::getIP();
$self = Server::getSelf();
Debugger::log("Possible RPC Injection: RPC call to non-existent controller at path {$setup["path"]}/{$controller_class} {$ip} {$self}");
error_log("Possible RPC Injection: RPC call to non-existent controller at path {$setup['path']}/{$controller_class} {$ip} {$self}");
}
}
示例11: getInstance
/**
*
* singletone pattern
* @param array
* @return Debugger instance
*/
public static function getInstance(array $params = array())
{
if (!self::$instance) {
self::$instance = new self($params);
}
return self::$instance;
}
示例12: Resize
public function Resize($image, $newWidth, $targetName)
{
if (!file_exists(PUBLIC_ROOT . $image)) {
$image = '/assets/images/not-found.gif';
}
$imgInfo = getimagesize(PUBLIC_ROOT . $image);
$oldWidth = $imgInfo[0];
$oldHeight = $imgInfo[1];
$changeRatio = $oldWidth / $newWidth;
$newHeight = round($oldHeight / $changeRatio);
$newImage = imagecreatetruecolor($newWidth, $newHeight);
$source = $this->load(PUBLIC_ROOT . $image);
if ($this->imageType == IMAGETYPE_PNG) {
imagealphablending($newImage, false);
imagesavealpha($newImage, true);
$transparent = imagecolorallocatealpha($newImage, 255, 255, 255, 127);
imagefilledrectangle($newImage, 0, 0, $newWidth, $newHeight, $transparent);
}
imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $newWidth, $newHeight, $oldWidth, $oldHeight);
header('Content-Type: image/jpeg');
imagejpeg($newImage, $targetName, 100);
Debugger::debug($targetName, 'TARGET');
//$this->save($targetName);
$this->image = $newImage;
imagedestroy($newImage);
}
示例13: dump
/**
* Debugger::dump shortcut.
*/
function dump($var)
{
foreach (func_get_args() as $arg) {
Debugger::dump($arg);
}
return $var;
}
示例14: GetInstance
public static function GetInstance()
{
if (self::$instance == null) {
self::$instance = new Debugger();
}
return self::$instance;
}
示例15: start
/**
* Start an benchmarking timer.
*
* @param string $name The name of the timer to start.
* @param string $message A message for your timer
* @return bool Always true
*/
public static function start($name = null, $message = null)
{
$start = microtime(true);
if (!$name) {
$named = false;
$calledFrom = debug_backtrace();
$name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line'];
} else {
$named = true;
}
if (!$message) {
$message = $name;
}
$_name = $name;
$i = 1;
while (isset(self::$_timers[$name])) {
$i++;
$name = $_name . ' #' . $i;
}
if ($i > 1) {
$message .= ' #' . $i;
}
self::$_timers[$name] = array('start' => $start, 'message' => $message, 'named' => $named);
return true;
}