diff --git a/wire/core/Page.php b/wire/core/Page.php index ac35404f..4c1deae4 100644 --- a/wire/core/Page.php +++ b/wire/core/Page.php @@ -1654,8 +1654,10 @@ class Page extends WireData implements \Countable, WireMatchable { protected function setTemplate($tpl) { if(!is_object($tpl)) $tpl = $this->wire('templates')->get($tpl); if(!$tpl instanceof Template) throw new WireException("Invalid value sent to Page::setTemplate"); - if($this->template && $this->template->id != $tpl->id) { - if($this->settings['status'] & Page::statusSystem) throw new WireException("Template changes are disallowed on this page"); + if($this->template && $this->template->id != $tpl->id && $this->isLoaded) { + if($this->settings['status'] & Page::statusSystem) { + throw new WireException("Template changes are disallowed on this page"); + } if(is_null($this->templatePrevious)) $this->templatePrevious = $this->template; $this->trackChange('template', $this->template, $tpl); } @@ -1680,10 +1682,14 @@ class Page extends WireData implements \Countable, WireMatchable { if($parent->id && $this->id == $parent->id || $parent->parents->has($this)) { throw new WireException("Page cannot be its own parent"); } - $this->trackChange('parent', $this->parent, $parent); - if(($this->parent && $this->parent->id) && $this->parent->id != $parent->id) { - if($this->settings['status'] & Page::statusSystem) throw new WireException("Parent changes are disallowed on this page"); - $this->parentPrevious = $this->parent; + if($this->isLoaded) { + $this->trackChange('parent', $this->parent, $parent); + if(($this->parent && $this->parent->id) && $this->parent->id != $parent->id) { + if($this->settings['status'] & Page::statusSystem) { + throw new WireException("Parent changes are disallowed on this page"); + } + if(is_null($this->parentPrevious)) $this->parentPrevious = $this->parent; + } } $this->parent = $parent; return $this; diff --git a/wire/core/PagesEditor.php b/wire/core/PagesEditor.php index 71ce01ea..ce8e2a59 100644 --- a/wire/core/PagesEditor.php +++ b/wire/core/PagesEditor.php @@ -879,7 +879,10 @@ class PagesEditor extends Wire { } while(1); if($insertSql) { - $sql = "INSERT INTO pages_parents (pages_id, parents_id) VALUES" . rtrim($insertSql, ","); + $sql = + 'INSERT INTO pages_parents (pages_id, parents_id) ' . + 'VALUES' . rtrim($insertSql, ',') . ' ' . + 'ON DUPLICATE KEY UPDATE parents_id=VALUES(parents_id)'; $database->exec($sql); } diff --git a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module index 263b4cf9..4923fa64 100755 --- a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module +++ b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module @@ -16,6 +16,7 @@ * @property int|string $minHeight Min height for uploaded images, smaller will be refused (default='') * @property string $itemClass Space separated CSS classes for items rendered by this Inputfield. Generally you should append rather than replace. * @property int|bool $useImageEditor Whether or not the modal image editor is allowed for this field (default=true) + * @property int $adminThumbScale for backwards compatibility only * * The following properties default values are pulled from $config->adminThumbOptions and can be overridden * by setting directly to an instance of this Inputfield: @@ -969,6 +970,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList { * Return whether or not admin thumbs should be scaled * * @return bool + * @deprecated * */ protected function getAdminThumbScale() { diff --git a/wire/modules/PageRender.module b/wire/modules/PageRender.module index b6807c13..74f8fee4 100644 --- a/wire/modules/PageRender.module +++ b/wire/modules/PageRender.module @@ -245,6 +245,7 @@ class PageRender extends WireData implements Module, ConfigurableModule { * */ public function ___clearCacheFilePages(PageArray $items, Page $page) { + if($page) {} foreach($items as $p) { if(((int) $p->template->cache_time) < 1) continue; $cf = $this->getCacheFile($p); @@ -306,7 +307,6 @@ class PageRender extends WireData implements Module, ConfigurableModule { )); } - $items = array(); if(count($pageIDs)) { $items = $this->wire('pages')->getById($pageIDs, array( 'cache' => false, @@ -343,7 +343,9 @@ class PageRender extends WireData implements Module, ConfigurableModule { if(!is_string($file)) $file = null; $event->cancelHooks = true; $event->replace = true; - $event->return = $event->object->renderField($fieldName, $file); + /** @var Page $page */ + $page = $event->object; + $event->return = $page->renderField($fieldName, $file); } } @@ -390,6 +392,7 @@ class PageRender extends WireData implements Module, ConfigurableModule { $_page = $this->wire('page'); // just in case one page is rendering another, save the previous $config = $this->wire('config'); $compiler = null; + $compilerOptions = array(); if($config->templateCompile && $template->compile) { $compilerOptions = array( 'namespace' => strlen(__NAMESPACE__) > 0, @@ -664,10 +667,14 @@ class PageRender extends WireData implements Module, ConfigurableModule { /** * Provide a disk cache clearing capability within the module's configuration screen + * + * @param array $data + * @return InputfieldWrapper * */ public function getModuleConfigInputfields(array $data) { + if($data) {} $path = $this->wire('config')->paths->cache . self::cacheDirName . '/'; $numPages = 0; $numFiles = 0;