Commit ce2fb905 by Seldaek

No more double-slashes in template paths since this seemed to cause slight performance issues

git-svn-id: svn://dwoo.org/dwoo/trunk@268 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent dd288f0c
......@@ -30,6 +30,8 @@
* For can now iterate backwards if you input numbers, it won't work with
variables though
* Slight performance improvement with big inheritance trees
* No more double-slashes in template paths since this seemed to cause
slight performance issues
* Fixed a bug with parsing AND/OR keywords in conditionals when they were
followed by round brackets
* Fixed assignments not handling multi-line values correctly
......
......@@ -45,7 +45,7 @@ class Dwoo_Loader implements Dwoo_ILoader
public function __construct($cacheDir)
{
$this->corePluginDir = DWOO_DIRECTORY . 'plugins';
$this->cacheDir = $cacheDir . DIRECTORY_SEPARATOR;
$this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
// include class paths or rebuild paths if the cache file isn't there
$foo = @file_get_contents($this->cacheDir.'classpath.cache.d'.Dwoo::RELEASE_TAG.'.php');
......@@ -70,7 +70,7 @@ class Dwoo_Loader implements Dwoo_ILoader
}
// iterates over all files/folders
$list = glob($path.DIRECTORY_SEPARATOR.'*');
$list = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*');
if (is_array($list)) {
foreach ($list as $f) {
if (is_dir($f)) {
......
......@@ -99,8 +99,6 @@ class Dwoo_Template_File extends Dwoo_Template_String
return $this->includePath;
}
/**
* Checks if compiled file is valid (exists and it's the modification is greater or
* equal to the modification time of the template file)
......@@ -145,6 +143,7 @@ class Dwoo_Template_File extends Dwoo_Template_String
return $this->file;
} else {
foreach ($this->includePath as $path) {
$path = rtrim($path, DIRECTORY_SEPARATOR);
if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) {
$this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
return $this->resolvedPath;
......
......@@ -289,7 +289,7 @@ class Dwoo_Template_String implements Dwoo_ITemplate
// thanks for his help on avoiding concurency issues
$temp = tempnam($cacheDir, 'temp');
if (!($file = @fopen($temp, 'wb'))) {
$temp = $cacheDir . DIRECTORY_SEPARATOR . uniqid('temp');
$temp = $cacheDir . uniqid('temp');
if (!($file = @fopen($temp, 'wb'))) {
trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING);
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment