Commit 358484fa by seldaek

* The core Dwoo class doesn't need writable compile/cache dirs in the…

* The core Dwoo class doesn't need writable compile/cache dirs in the constructor anymore so you can provide custom ones later through ->setCompile(/Cache)Dir - thanks to Denis Arh for the patch git-svn-id: svn://dwoo.org/dwoo/trunk@201 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent be3fb1b8
......@@ -5,8 +5,13 @@
IPluginProxy interface, that's it
+ Compiler: the modifier syntax (|foo) can now be applied on functions and on
complex variables i.e. {$obj->getStuff()|upper} or {lower('foo')|upper}
* The core Dwoo class doesn't need writable compile/cache dirs in the
constructor anymore so you can provide custom ones later through
->setCompile(/Cache)Dir - thanks to Denis Arh for the patch
* Adapters: Zend: major overhaul thanks to Denis Arh, templates files should
probably be moved in the scripts subfolder after this update though
probably be moved in the scripts subfolder after this update though, and
the settings array has changed a bit, you will get warnings if you don't
update the code anyway
* Plugins: improved the dump plugin, it now displays object's properties
and optionally public methods (if the new show_methods arg is set to true)
- thanks to Stephan Wentz for the patch
......
......@@ -264,22 +264,12 @@ class Dwoo
*/
public function __construct($compileDir = null, $cacheDir = null)
{
if ($cacheDir === null) {
$this->cacheDir = dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
} else {
$this->cacheDir = $cacheDir.DIRECTORY_SEPARATOR;
if ($compileDir !== null) {
$this->setCompileDir($compileDir);
}
if ($compileDir === null) {
$this->compileDir = dirname(__FILE__).DIRECTORY_SEPARATOR.'compiled'.DIRECTORY_SEPARATOR;
} else {
$this->compileDir = $compileDir.DIRECTORY_SEPARATOR;
if ($cacheDir !== null) {
$this->setCacheDir($cacheDir);
}
if (is_writable($this->cacheDir) === false)
throw new Dwoo_Exception('Dwoo cache directory must be writable, chmod "'.$this->cacheDir.'" to make it writable');
if (is_writable($this->compileDir) === false)
throw new Dwoo_Exception('Dwoo compile directory must be writable, chmod "'.$this->compileDir.'" to make it writable');
}
/**
......@@ -631,7 +621,7 @@ class Dwoo
public function getLoader()
{
if ($this->loader === null) {
$this->loader = new Dwoo_Loader($this->compileDir);
$this->loader = new Dwoo_Loader($this->getCompileDir());
}
return $this->loader;
......@@ -656,6 +646,10 @@ class Dwoo
*/
public function getCacheDir()
{
if ($this->cacheDir === null) {
$this->setCacheDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR);
}
return $this->cacheDir;
}
......@@ -679,6 +673,10 @@ class Dwoo
*/
public function getCompileDir()
{
if ($this->compileDir === null) {
$this->setCompileDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'compiled'.DIRECTORY_SEPARATOR);
}
return $this->compileDir;
}
......@@ -837,7 +835,7 @@ class Dwoo
*/
public function clearCache($olderThan=-1)
{
$cacheDirs = new RecursiveDirectoryIterator($this->cacheDir);
$cacheDirs = new RecursiveDirectoryIterator($this->getCacheDir());
$cache = new RecursiveIteratorIterator($cacheDirs);
$expired = time() - $olderThan;
$count = 0;
......
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