/** * Prepare the page and it's fields for removal from runtime memory, called primarily by Pages::uncache() * */ public function uncache() { $trackChanges = $this->trackChanges(); if ($trackChanges) { $this->setTrackChanges(false); } if ($this->template) { foreach ($this->template->fieldgroup as $field) { $value = parent::get($field->name); if ($value != null && is_object($value)) { if (method_exists($value, 'uncache') && $value !== $this) { $value->uncache(); } parent::set($field->name, null); } } } if ($this->filesManager) { $this->filesManager->uncache(); } $this->filesManager = null; if ($trackChanges) { $this->setTrackChanges(true); } }