diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 904437003..3457b6efe 100755 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -2463,7 +2463,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $stageVersion = Versioned::get_versionnumber_by_stage('SiteTree', 'Stage', $this->ID); $liveVersion = Versioned::get_versionnumber_by_stage('SiteTree', 'Live', $this->ID); - return ($stageVersion != $liveVersion); + return ($stageVersion && $stageVersion != $liveVersion); } /** diff --git a/core/model/Versioned.php b/core/model/Versioned.php index b812586a4..93b990a13 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -801,6 +801,11 @@ class Versioned extends DataObjectDecorator { $clone = clone $this->owner; $result = $clone->delete(); Versioned::set_reading_mode($oldMode); + + // Fix the version number cache (in case you go delete from stage and then check ExistsOnLive) + $baseClass = ClassInfo::baseDataClass($this->owner->class); + self::$cache_versionnumber[$baseClass][$stage][$this->owner->ID] = null; + return $result; }