Improve providers. Renders now use bulk checks via ::verify

This commit is contained in:
bzick
2013-07-13 12:00:19 +04:00
parent 3583a2cdfd
commit 617fc7324c
6 changed files with 93 additions and 42 deletions

View File

@@ -76,7 +76,7 @@ class Render extends \ArrayObject {
$this->_fenom = $fenom;
$props += self::$_props;
$this->_name = $props["name"];
$this->_provider = $this->_fenom->getProvider($props["scm"]);
// $this->_provider = $this->_fenom->getProvider($props["scm"]);
$this->_scm = $props["scm"];
$this->_time = $props["time"];
$this->_depends = $props["depends"];
@@ -100,7 +100,7 @@ class Render extends \ArrayObject {
}
public function getProvider() {
return $this->_provider;
return $this->_fenom->getProvider($this->_scm);
}
public function getBaseName() {
@@ -136,14 +136,18 @@ class Render extends \ArrayObject {
* @return bool
*/
public function isValid() {
$provider = $this->_fenom->getProvider(strstr($this->_name, ":"), true);
if($provider->getLastModified($this->_name) >= $this->_time) {
return false;
}
foreach($this->_depends as $tpl => $time) {
if($this->_fenom->getTemplate($tpl)->getTime() !== $time) {
if(count($this->_depends) === 1) { // if no external dependencies, only self
$provider = $this->_fenom->getProvider($this->_scm);
if($provider->getLastModified($this->_name) !== $this->_time) {
return false;
}
} else {
foreach($this->_depends as $scm => $templates) {
$provider = $this->_fenom->getProvider($scm);
if(!$provider->verify($templates)) {
return false;
}
}
}
return true;
}