diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 9b957ea5..770f2110 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -577,14 +577,14 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $page = parent::duplicate(false); $page->Sort = 0; - $this->extend('onBeforeDuplicate', $page); + $this->invokeWithExtensions('onBeforeDuplicate', $page); if($doWrite) { $page->write(); $page = $this->duplicateManyManyRelations($this, $page); } - $this->extend('onAfterDuplicate', $page); + $this->invokeWithExtensions('onAfterDuplicate', $page); return $page; } @@ -1653,7 +1653,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if($table == 'SiteTree_Live') { $publishedClass = $origPublished['ClassName']; $origPublishedObj = new $publishedClass($origPublished); - $this->extend('onRenameLinkedAsset', $origPublishedObj); + $this->invokeWithExtensions('onRenameLinkedAsset', $origPublishedObj); } } } @@ -2262,7 +2262,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if(!$this->canDeleteFromLive()) return false; if(!$this->ID) return false; - $this->extend('onBeforeUnpublish'); + $this->invokeWithExtensions('onBeforeUnpublish', $this); $origStage = Versioned::current_stage(); Versioned::reading_stage('Live'); @@ -2292,7 +2292,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $this->write(); } - $this->extend('onAfterUnpublish'); + $this->invokeWithExtensions('onAfterUnpublish', $this); return true; } @@ -2301,6 +2301,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * Revert the draft changes: replace the draft content with the content on live */ public function doRevertToLive() { + $this->invokeWithExtensions('onBeforeRevertToLive', $this); + $this->publish("Live", "Stage", false); // Use a clone to get the updates made by $this->publish @@ -2313,7 +2315,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $page->write(); } - $this->extend('onAfterRevertToLive'); + $this->invokeWithExtensions('onAfterRevertToLive', $this); } /**