From 1ff6f3f1b047a1d27b3d60217dc262e8a1c9f54c Mon Sep 17 00:00:00 2001 From: John Milmine Date: Thu, 27 Apr 2017 08:48:19 +1200 Subject: [PATCH 1/2] fixing doArchive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for users who can delete, but not unpublish, they should be able to delete draft pages that they’ve created. Old code used to unpublish even if the page wasn’t published, which meant users who couldn’t publish, also could delete draft pages. They could create draft pages, but not delete them. --- code/model/SiteTree.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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; } /** From 14540729caa30dd2e782e4fd52afe518dc156ed8 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 9 May 2017 11:41:55 +1200 Subject: [PATCH 2/2] FIX: Use framework 3.5 to test cms 3.5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: