mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Improve providers. Renders now use bulk checks via ::verify
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user