mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
- optimization of smarty_cachereource_keyvaluestore.php code
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.25-dev===== (xx.xx.2015)
|
===== 3.1.25-dev===== (xx.xx.2015)
|
||||||
|
15.06.2015
|
||||||
|
- optimization of smarty_cachereource_keyvaluestore.php code
|
||||||
|
|
||||||
14.06.2015
|
14.06.2015
|
||||||
- bugfix a relative sub template path could fail if template_dir path did contain /../ https://github.com/smarty-php/smarty/issues/50
|
- bugfix a relative sub template path could fail if template_dir path did contain /../ https://github.com/smarty-php/smarty/issues/50
|
||||||
- optimization rework of path normalization
|
- optimization rework of path normalization
|
||||||
|
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.25-dev/8';
|
const SMARTY_VERSION = '3.1.25-dev/9';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -36,6 +36,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $contents = array();
|
protected $contents = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cache for timestamps
|
* cache for timestamps
|
||||||
*
|
*
|
||||||
@@ -53,10 +54,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
$cached->filepath = $_template->source->uid
|
$cached->filepath = $_template->source->uid . '#' . $this->sanitize($cached->source->resource) . '#' . $this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id);
|
||||||
. '#' . $this->sanitize($cached->source->resource)
|
|
||||||
. '#' . $this->sanitize($cached->cache_id)
|
|
||||||
. '#' . $this->sanitize($cached->compile_id);
|
|
||||||
|
|
||||||
$this->populateTimestamp($cached);
|
$this->populateTimestamp($cached);
|
||||||
}
|
}
|
||||||
@@ -148,7 +146,6 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty cache
|
* Empty cache
|
||||||
* {@internal the $exp_time argument is ignored altogether }}
|
* {@internal the $exp_time argument is ignored altogether }}
|
||||||
@@ -298,11 +295,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
protected function getMetaTimestamp(&$content)
|
protected function getMetaTimestamp(&$content)
|
||||||
{
|
{
|
||||||
$s = unpack("N", $content[0] . $content[1] . $content[2] . $content[3]);
|
extract(unpack('N1s/N1m/a*content', $content));
|
||||||
$m = unpack("N", $content[4] . $content[5] . $content[6] . $content[7]);
|
return $s + ($m / 100000000);
|
||||||
$content = substr($content, 8);
|
|
||||||
|
|
||||||
return $s[1] + ($m[1] / 100000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user