diff --git a/.travis.yml b/.travis.yml index f45613aa..2d78e2ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ addons: env: global: - - CORE_RELEASE=3 + - CORE_RELEASE=3.5 matrix: include: diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 11862a63..656bcd24 100755 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2541,21 +2541,27 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid } /** - * Removes the page from both live and stage + * Removes the page from both live and stage, if it exists on both + * otherwise just removes from stage * * @return bool Success */ public function doArchive() { $this->invokeWithExtensions('onBeforeArchive', $this); + $doDelete = false; - if($this->doUnpublish()) { - $this->delete(); - $this->invokeWithExtensions('onAfterArchive', $this); - - return true; + if($this->ExistsOnLive) { + $doDelete = $this->doUnpublish(); + } else { + $doDelete = true; } - return false; + if ($doDelete) { + $this->delete(); + $this->invokeWithExtensions('onAfterArchive', $this); + } + + return $doDelete; } /**