|
|
@ -56,7 +56,7 @@ class Debug extends Model |
|
|
|
public function rules() |
|
|
|
public function rules() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
[['tag', 'ip', 'method', 'ajax', 'url','statusCode','sqlCount'], 'safe'], |
|
|
|
[['tag', 'ip', 'method', 'ajax', 'url', 'statusCode', 'sqlCount'], 'safe'], |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -78,8 +78,8 @@ class Debug extends Model |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns data provider with filled models. Filter applied if needed. |
|
|
|
* Returns data provider with filled models. Filter applied if needed. |
|
|
|
* @param type $params |
|
|
|
* @param array $params |
|
|
|
* @param type $models |
|
|
|
* @param array $models |
|
|
|
* @return \yii\data\ArrayDataProvider |
|
|
|
* @return \yii\data\ArrayDataProvider |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function search($params, $models) |
|
|
|
public function search($params, $models) |
|
|
@ -87,7 +87,7 @@ class Debug extends Model |
|
|
|
$dataProvider = new ArrayDataProvider([ |
|
|
|
$dataProvider = new ArrayDataProvider([ |
|
|
|
'allModels' => $models, |
|
|
|
'allModels' => $models, |
|
|
|
'sort' => [ |
|
|
|
'sort' => [ |
|
|
|
'attributes' => ['method', 'ip','tag','time','statusCode','sqlCount'], |
|
|
|
'attributes' => ['method', 'ip', 'tag', 'time', 'statusCode', 'sqlCount'], |
|
|
|
], |
|
|
|
], |
|
|
|
'pagination' => [ |
|
|
|
'pagination' => [ |
|
|
|
'pageSize' => 10, |
|
|
|
'pageSize' => 10, |
|
|
@ -121,23 +121,27 @@ class Debug extends Model |
|
|
|
return in_array($code, $this->criticalCodes); |
|
|
|
return in_array($code, $this->criticalCodes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function addCondition($filter,$attribute,$partial=false) |
|
|
|
/** |
|
|
|
|
|
|
|
* @param Filter $filter |
|
|
|
|
|
|
|
* @param string $attribute |
|
|
|
|
|
|
|
* @param boolean $partial |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function addCondition($filter, $attribute, $partial = false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$value = $this->$attribute; |
|
|
|
$value = $this->$attribute; |
|
|
|
|
|
|
|
|
|
|
|
if (mb_strpos($value, '>') !== false) |
|
|
|
if (mb_strpos($value, '>') !== false) { |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$value = intval(str_replace('>', '', $value)); |
|
|
|
$value = intval(str_replace('>', '', $value)); |
|
|
|
$filter->addMatch($attribute,new matches\Greater(['value' => $value])); |
|
|
|
$filter->addMatch($attribute, new matches\Greater(['value' => $value])); |
|
|
|
|
|
|
|
|
|
|
|
} elseif (mb_strpos($value, '<') !== false) { |
|
|
|
} elseif (mb_strpos($value, '<') !== false) { |
|
|
|
|
|
|
|
|
|
|
|
$value = intval(str_replace('<', '', $value)); |
|
|
|
$value = intval(str_replace('<', '', $value)); |
|
|
|
$filter->addMatch($attribute,new matches\Lower(['value' => $value])); |
|
|
|
$filter->addMatch($attribute, new matches\Lower(['value' => $value])); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$filter->addMatch($attribute,new matches\Exact(['value' => $value, 'partial' => $partial])); |
|
|
|
$filter->addMatch($attribute, new matches\Exact(['value' => $value, 'partial' => $partial])); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|