1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +02:00

Adjustment to Page::isChanged() method to reduce Pages::save() overhead

This commit is contained in:
Ryan Cramer
2017-01-09 08:12:42 -05:00
parent 43986173fb
commit 307d7c9e7d

View File

@@ -2561,17 +2561,16 @@ class Page extends WireData implements \Countable, WireMatchable {
if(parent::isChanged($what)) return true;
$changed = false;
if($what) {
$value = $this->get($what);
if(is_object($value) && $value instanceof Wire)
$changed = $value->isChanged();
$data = array_key_exists($what, $this->data) ? array($this->data[$what]) : array();
} else {
foreach($this->data as $key => $value) {
if(is_object($value) && $value instanceof Wire)
$data = &$this->data;
}
foreach($data as $key => $value) {
if(is_object($value) && $value instanceof Wire) {
$changed = $value->isChanged();
}
if($changed) break;
}
}
return $changed;
}