Commit 04c8b0ec by Seldaek

* Fixes REQUEST_URI not being available in CLI

git-svn-id: svn://dwoo.org/dwoo/trunk@26 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent 918408ef
......@@ -57,10 +57,13 @@ class DwooTemplateFile extends DwooTemplateString
}
$this->compileId = $compileId;
// no cache id provided, use request_uri
// no cache id provided, use request_uri if available
if($cacheId === null)
{
$cacheId = strtr($_SERVER['REQUEST_URI'], '\\/%?=!:;', '--------');
if(isset($_SERVER['REQUEST_URI']) === true)
$cacheId = strtr($_SERVER['REQUEST_URI'], '\\/%?=!:;', '--------');
elseif(isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['argv']))
$cacheId = strtr($_SERVER['SCRIPT_FILENAME'].'-'.implode('-', $_SERVER['argv']), '\\/%?=!:;', '--------');
}
$this->cacheId = $this->compileId . $cacheId;
}
......
......@@ -109,7 +109,10 @@ class DwooTemplateString implements DwooITemplate
// no cache id provided, use request_uri
if($cacheId === null)
{
$cacheId = strtr($_SERVER['REQUEST_URI'], '\\/%?=!:;*"<>|', '-------------');
if(isset($_SERVER['REQUEST_URI']) === true)
$cacheId = strtr($_SERVER['REQUEST_URI'], '\\/%?=!:;*"<>|', '-------------');
elseif(isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['argv']))
$cacheId = strtr($_SERVER['SCRIPT_FILENAME'].'-'.implode('-', $_SERVER['argv']), '\\/%?=!:;', '--------');
}
$this->cacheId = $this->compileId . $cacheId;
}
......
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