mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-20 04:01:42 +01:00
Optimize index and fix delete older checks from hist
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
* 2.4.4 (2017-09-27)
|
||||
|
||||
* added Twig_Profiler_Profile::reset()
|
||||
* fixed use TokenParser to return an empty Node
|
||||
* added RuntimeExtensionInterface
|
||||
* added circular reference detection when loading templates
|
||||
* added support for runtime loaders in IntegrationTestCase
|
||||
* fixed deprecation when using Twig_Profiler_Dumper_Html
|
||||
* removed @final from Twig_Profiler_Dumper_Text
|
||||
|
||||
* 2.4.3 (2017-06-07)
|
||||
|
||||
* fixed namespaces introduction
|
||||
@@ -69,9 +79,17 @@
|
||||
* improved the performance of the filesystem loader
|
||||
* removed features that were deprecated in 1.x
|
||||
|
||||
* 1.34.4 (2017-XX-XX)
|
||||
* 1.35.0 (2017-XX-XX)
|
||||
|
||||
* n/a
|
||||
* added Twig_Profiler_Profile::reset()
|
||||
* fixed use TokenParser to return an empty Node
|
||||
* added RuntimeExtensionInterface
|
||||
* added circular reference detection when loading templates
|
||||
|
||||
* 1.34.4 (2017-07-04)
|
||||
|
||||
* added support for runtime loaders in IntegrationTestCase
|
||||
* fixed deprecation when using Twig_Profiler_Dumper_Html
|
||||
|
||||
* 1.34.3 (2017-06-07)
|
||||
|
||||
@@ -212,7 +230,7 @@
|
||||
|
||||
* fixed reserved keywords (forbids true, false, null and none keywords for variables names)
|
||||
* fixed support for PHP7 (Throwable support)
|
||||
* marked the following methods as being internals on Twig_Environment:
|
||||
* marked the following methods as being internals on Twig_Environment:
|
||||
getFunctions(), getFilters(), getTests(), getFunction(), getFilter(), getTest(),
|
||||
getTokenParsers(), getTags(), getNodeVisitors(), getUnaryOperators(), getBinaryOperators(),
|
||||
getFunctions(), getFilters(), getGlobals(), initGlobals(), initExtensions(), and initExtension()
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
class Twig_Environment
|
||||
{
|
||||
const VERSION = '2.4.3';
|
||||
const VERSION_ID = 20403;
|
||||
const VERSION = '2.4.4';
|
||||
const VERSION_ID = 20404;
|
||||
const MAJOR_VERSION = 2;
|
||||
const MINOR_VERSION = 4;
|
||||
const RELEASE_VERSION = 3;
|
||||
const RELEASE_VERSION = 4;
|
||||
const EXTRA_VERSION = '';
|
||||
|
||||
private $charset;
|
||||
@@ -42,6 +42,7 @@ class Twig_Environment
|
||||
private $runtimeLoaders = array();
|
||||
private $runtimes = array();
|
||||
private $optionsHash;
|
||||
private $loading = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -308,6 +309,10 @@ class Twig_Environment
|
||||
*
|
||||
* @param string|Twig_TemplateWrapper|Twig_Template $name The template name
|
||||
*
|
||||
* @throws Twig_Error_Loader When the template cannot be found
|
||||
* @throws Twig_Error_Runtime When a previously generated cache is corrupted
|
||||
* @throws Twig_Error_Syntax When an error occurred during compilation
|
||||
*
|
||||
* @return Twig_TemplateWrapper
|
||||
*/
|
||||
public function load($name)
|
||||
@@ -382,7 +387,19 @@ class Twig_Environment
|
||||
// to be removed in 3.0
|
||||
$this->extensionSet->initRuntime($this);
|
||||
|
||||
return $this->loadedTemplates[$cls] = new $cls($this);
|
||||
if (isset($this->loading[$cls])) {
|
||||
throw new Twig_Error_Runtime(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, array($name)))));
|
||||
}
|
||||
|
||||
$this->loading[$cls] = $name;
|
||||
|
||||
try {
|
||||
$this->loadedTemplates[$cls] = new $cls($this);
|
||||
} finally {
|
||||
unset($this->loading[$cls]);
|
||||
}
|
||||
|
||||
return $this->loadedTemplates[$cls];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1430,8 +1430,6 @@ function twig_array_batch($items, $size, $fill = null)
|
||||
*/
|
||||
function twig_get_attribute(Twig_Environment $env, Twig_Source $source, $object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
|
||||
{
|
||||
static $cache = array();
|
||||
|
||||
// array
|
||||
if (Twig_Template::METHOD_CALL !== $type) {
|
||||
$arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
|
||||
@@ -1518,6 +1516,8 @@ function twig_get_attribute(Twig_Environment $env, Twig_Source $source, $object,
|
||||
}
|
||||
}
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$class = get_class($object);
|
||||
|
||||
// object method
|
||||
|
||||
62
lib/Twig/lib/Twig/Profiler/Dumper/Base.php
Normal file
62
lib/Twig/lib/Twig/Profiler/Dumper/Base.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Twig.
|
||||
*
|
||||
* (c) Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class Twig_Profiler_Dumper_Base
|
||||
{
|
||||
private $root;
|
||||
|
||||
public function dump(Twig_Profiler_Profile $profile)
|
||||
{
|
||||
return $this->dumpProfile($profile);
|
||||
}
|
||||
|
||||
abstract protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix);
|
||||
|
||||
abstract protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix);
|
||||
|
||||
abstract protected function formatTime(Twig_Profiler_Profile $profile, $percent);
|
||||
|
||||
private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false)
|
||||
{
|
||||
if ($profile->isRoot()) {
|
||||
$this->root = $profile->getDuration();
|
||||
$start = $profile->getName();
|
||||
} else {
|
||||
if ($profile->isTemplate()) {
|
||||
$start = $this->formatTemplate($profile, $prefix);
|
||||
} else {
|
||||
$start = $this->formatNonTemplate($profile, $prefix);
|
||||
}
|
||||
$prefix .= $sibling ? '│ ' : ' ';
|
||||
}
|
||||
|
||||
$percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0;
|
||||
|
||||
if ($profile->getDuration() * 1000 < 1) {
|
||||
$str = $start."\n";
|
||||
} else {
|
||||
$str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent));
|
||||
}
|
||||
|
||||
$nCount = count($profile->getProfiles());
|
||||
foreach ($profile as $i => $p) {
|
||||
$str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Profiler_Dumper_Base', 'Twig\Profiler\Dumper\BaseDumper', false);
|
||||
class_exists('Twig_Profiler_Profile');
|
||||
@@ -12,7 +12,7 @@
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
final class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Text
|
||||
final class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Base
|
||||
{
|
||||
private static $colors = array(
|
||||
'block' => '#dfd',
|
||||
|
||||
@@ -11,18 +11,9 @@
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Twig_Profiler_Dumper_Text
|
||||
final class Twig_Profiler_Dumper_Text extends Twig_Profiler_Dumper_Base
|
||||
{
|
||||
private $root;
|
||||
|
||||
public function dump(Twig_Profiler_Profile $profile)
|
||||
{
|
||||
return $this->dumpProfile($profile);
|
||||
}
|
||||
|
||||
protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix)
|
||||
{
|
||||
return sprintf('%s└ %s', $prefix, $profile->getTemplate());
|
||||
@@ -37,36 +28,6 @@ class Twig_Profiler_Dumper_Text
|
||||
{
|
||||
return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
|
||||
}
|
||||
|
||||
private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false)
|
||||
{
|
||||
if ($profile->isRoot()) {
|
||||
$this->root = $profile->getDuration();
|
||||
$start = $profile->getName();
|
||||
} else {
|
||||
if ($profile->isTemplate()) {
|
||||
$start = $this->formatTemplate($profile, $prefix);
|
||||
} else {
|
||||
$start = $this->formatNonTemplate($profile, $prefix);
|
||||
}
|
||||
$prefix .= $sibling ? '│ ' : ' ';
|
||||
}
|
||||
|
||||
$percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0;
|
||||
|
||||
if ($profile->getDuration() * 1000 < 1) {
|
||||
$str = $start."\n";
|
||||
} else {
|
||||
$str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent));
|
||||
}
|
||||
|
||||
$nCount = count($profile->getProfiles());
|
||||
foreach ($profile as $i => $p) {
|
||||
$str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Profiler_Dumper_Text', 'Twig\Profiler\Dumper\TextDumper', false);
|
||||
|
||||
@@ -149,6 +149,12 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
);
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->starts = $this->ends = $this->profiles = array();
|
||||
$this->enter();
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->profiles);
|
||||
|
||||
@@ -24,6 +24,14 @@ abstract class Twig_Test_IntegrationTestCase extends TestCase
|
||||
*/
|
||||
abstract protected function getFixturesDir();
|
||||
|
||||
/**
|
||||
* @return Twig_RuntimeLoaderInterface[]
|
||||
*/
|
||||
protected function getRuntimeLoaders()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_ExtensionInterface[]
|
||||
*/
|
||||
@@ -143,6 +151,10 @@ abstract class Twig_Test_IntegrationTestCase extends TestCase
|
||||
), $match[2] ? eval($match[2].';') : array());
|
||||
$twig = new Twig_Environment($loader, $config);
|
||||
$twig->addGlobal('global', 'global');
|
||||
foreach ($this->getRuntimeLoaders() as $runtimeLoader) {
|
||||
$twig->addRuntimeLoader($runtimeLoader);
|
||||
}
|
||||
|
||||
foreach ($this->getExtensions() as $extension) {
|
||||
$twig->addExtension($extension);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ final class Twig_TokenParser_Use extends Twig_TokenParser
|
||||
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
|
||||
$this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
|
||||
|
||||
return new Twig_Node();
|
||||
}
|
||||
|
||||
public function getTag()
|
||||
|
||||
@@ -49,14 +49,20 @@ function dbw_escape_string($conn,$string){
|
||||
|
||||
/** Make query */
|
||||
function dbw_query($conn,$query){
|
||||
$time = microtime(true);
|
||||
switch ($conn[1]){
|
||||
case "mysqli":
|
||||
return mysqli_query($conn[0],$query);
|
||||
$ret = mysqli_query($conn[0],$query);
|
||||
break;
|
||||
case "sqlite":
|
||||
return $conn[0]->query($query);
|
||||
$ret = $conn[0]->query($query);
|
||||
break;
|
||||
case "PgSQL":
|
||||
return pg_query($query); //Last error (pg_last_error()) not implemented
|
||||
$ret = pg_query($query);
|
||||
break;
|
||||
}
|
||||
//echo "<p>".$query."->".(microtime(true)-$time)." milisegundos</p>";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/** Fetch array from query */
|
||||
@@ -83,23 +89,27 @@ function dbw_fetch_array($conn,$result,$typearray = NULL){
|
||||
|
||||
/** Make query and fetch array */
|
||||
function dbw_query_fetch_array($conn,$query){
|
||||
$time = microtime(true);
|
||||
|
||||
switch ($conn[1]){
|
||||
case "mysqli":
|
||||
$query = mysqli_query($conn[0],$query);
|
||||
if ($query == false || $query == NULL){return false;}
|
||||
return mysqli_fetch_array($query);
|
||||
$result = mysqli_query($conn[0],$query);
|
||||
if (!$result){return false;}
|
||||
$ret = mysqli_fetch_array($result);
|
||||
break;
|
||||
case "sqlite":
|
||||
$query = $conn[0]->query($query);
|
||||
if ($query == false || $query == NULL){return false;}
|
||||
return $query->fetchArray();
|
||||
$result = $conn[0]->query($query);
|
||||
if (!$result){return false;}
|
||||
$ret = $result->fetchArray();
|
||||
break;
|
||||
case "PgSQL":
|
||||
$query = pg_query($query);
|
||||
if ($query == false || $query == NULL){return false;}
|
||||
return pg_fetch_array($query); //Last error (pg_last_error()) not implemented
|
||||
$result = pg_query($query);
|
||||
if (!$result){return false;}
|
||||
$ret = pg_fetch_array($result); //Last error (pg_last_error()) not implemented
|
||||
break;
|
||||
}
|
||||
//echo "<p>".$query."->".(microtime(true)-$time)." milisegundos</p>";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/** Goes a query to $row. $row starts in 0 as first row as if not specified */
|
||||
@@ -155,7 +165,8 @@ function dbw_num_rows($conn,$result){
|
||||
case "mysqli":
|
||||
return mysqli_num_rows($result);
|
||||
case "sqlite":
|
||||
return $result->numRows();
|
||||
die("Sqlite3 not supports numRows, use query with COUNT(*)");
|
||||
return $result->numRows(); //ERROR
|
||||
case "PgSQL":
|
||||
return pg_num_rows ($result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user