Merge branch 'master' into tests
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
abstract class AjaxAction extends Action
|
||||
{
|
||||
public $data = 1;
|
||||
|
||||
protected $encode = true;
|
||||
|
||||
function __construct()
|
||||
|
@ -12,8 +12,11 @@
|
||||
class PagerAction extends Action
|
||||
{
|
||||
public $page = 1;
|
||||
|
||||
public $last_page = 1;
|
||||
|
||||
protected $offset = 0;
|
||||
|
||||
protected $limit;
|
||||
|
||||
public function __construct($limit = 20)
|
||||
|
1
cache/CacheKey.php
vendored
1
cache/CacheKey.php
vendored
@ -21,6 +21,7 @@ class CacheKey
|
||||
* @var CacheKey
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
protected $expire = 0;
|
||||
|
||||
/**
|
||||
|
1
cache/Cacher.php
vendored
1
cache/Cacher.php
vendored
@ -19,7 +19,6 @@ class Cacher
|
||||
*/
|
||||
static protected $caches = array();
|
||||
|
||||
|
||||
static public function get($cacher, $config = null)
|
||||
{
|
||||
if (!isset(self::$caches[$cacher])) {
|
||||
|
@ -13,7 +13,9 @@ class Captcha
|
||||
{
|
||||
|
||||
protected $font_size = 38;
|
||||
|
||||
protected $width = 200;
|
||||
|
||||
protected $height = 70;
|
||||
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Обработчик эксепшенов
|
||||
*
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link
|
||||
* @package Majestic
|
||||
* @subpackage Core
|
||||
* @since
|
||||
* @version SVN: $Id$
|
||||
* @filesource $URL$
|
||||
*/
|
||||
class MJException extends Exception
|
||||
{
|
||||
private $line_range = 6;
|
||||
|
||||
public function terminate()
|
||||
{
|
||||
if (!DEBUG_ENABLE) {
|
||||
trigger_error($this->getMessage());
|
||||
throw new StaticPageException(500);
|
||||
}
|
||||
|
||||
$return = "<b>MJ Error:</b> ";
|
||||
$return .= str_replace("\n", "<br/>\n", $this->getMessage())."<br>\n";
|
||||
|
||||
$trace = $this->getTrace();
|
||||
|
||||
$file = reset($trace);
|
||||
|
||||
//смещение в трейсе, указаное при вызове эксепшена (2й параметр). Нужно для более инофрмативного вывода
|
||||
if ($shift = abs($this->getCode())) {
|
||||
while($shift--) {
|
||||
$file = next($trace);
|
||||
}
|
||||
}
|
||||
|
||||
if ($fp = fopen($file['file'], 'r')) {
|
||||
$error_line = $file['line'];
|
||||
$start = $error_line - $this->line_range;
|
||||
$end = $error_line + $this->line_range;
|
||||
$i = 1;
|
||||
$return .= "<pre style=\"background-color:#e4e4e4\">";
|
||||
while ($line = fgets($fp, 4096) and $i<=$end) {
|
||||
$line = htmlspecialchars($line);
|
||||
if ($i >= $start && $i <= $end) {
|
||||
if ($i == $error_line) $return .= '<div style="background-color:#cccccc">'.$i.' '.$line.'</div>';
|
||||
else $return .= $i.' '.$line;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$return .= "</pre>";
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$return .= '<table border="1" cellpadding="2" cellspacing="0"> <caption><b>Backtrace</b></caption>';
|
||||
$return .= "\n<tr><td><b>".$this->getFile().'</b></td><td><b>'.$this->getLine().'</b></td></tr>';
|
||||
foreach($trace as $row) {
|
||||
if (isset($row['file'])) { //throwing exception from __call method will not return file and line
|
||||
$return .= "\n<tr".($file['file'] == $row['file'] ? ' style="background-color:#ffcccc"': '')."><td>".$row['file'].'</td><td>'.$row['line'].'</td></tr>';
|
||||
}
|
||||
}
|
||||
return $return . '</table>';
|
||||
}
|
||||
}
|
||||
?>
|
@ -16,7 +16,7 @@ class RedisDebug
|
||||
public function __construct($redis)
|
||||
{
|
||||
if (!is_a($redis, 'Redis')) {
|
||||
throw new MJException();
|
||||
throw new GeneralException();
|
||||
}
|
||||
$this->redis = $redis;
|
||||
}
|
||||
|
@ -101,4 +101,20 @@ class Profiler
|
||||
}
|
||||
FB::table('Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]', $table);
|
||||
}
|
||||
|
||||
public function getCli()
|
||||
{
|
||||
$this->end = microtime(true);
|
||||
$queriesTime = 0;
|
||||
$temp = str_pad(PHP_EOL, 60, '-', STR_PAD_LEFT);
|
||||
foreach ($this->queries as $query) {
|
||||
$temp .= sprintf('%-25s[% 10sms] %s', '(' . $query->getType() .')', round($query->getElapsed() * 1000, 2), $query->getCommand()) . PHP_EOL;
|
||||
$queriesTime += $query->getElapsed();
|
||||
}
|
||||
$html = str_pad(PHP_EOL, 60, '-', STR_PAD_LEFT);
|
||||
$html .= 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.' . PHP_EOL
|
||||
. 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms] ' . PHP_EOL;
|
||||
$html .= $temp;
|
||||
return $html;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user