BUGFIX: Fixed SiteTree::IsModifiedOnStage() for an edge-case that was identified when deleteFromStage() stopped manipulating the current record.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@106082 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-06-02 07:04:52 +00:00
parent 5fbc19f5be
commit afdf8afaf4
2 changed files with 6 additions and 1 deletions

View File

@ -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);
}
/**

View File

@ -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;
}