1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 01:04:16 +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; if(parent::isChanged($what)) return true;
$changed = false; $changed = false;
if($what) { if($what) {
$value = $this->get($what); $data = array_key_exists($what, $this->data) ? array($this->data[$what]) : array();
if(is_object($value) && $value instanceof Wire)
$changed = $value->isChanged();
} else { } else {
foreach($this->data as $key => $value) { $data = &$this->data;
if(is_object($value) && $value instanceof Wire) }
foreach($data as $key => $value) {
if(is_object($value) && $value instanceof Wire) {
$changed = $value->isChanged(); $changed = $value->isChanged();
}
if($changed) break; if($changed) break;
} }
}
return $changed; return $changed;
} }