BUGFIX: Fixed SiteTree::doRestoreToStage() for db abstraction.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76369 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-05-07 05:59:24 +00:00
parent 29afa282b9
commit f296534380

View File

@ -1516,7 +1516,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// if no record can be found on draft stage (meaning it has been "deleted from draft" before),
// create an empty record
if(!DB::query("SELECT ID FROM SiteTree WHERE ID = $this->ID")->value()) {
DB::query("INSERT INTO SiteTree SET ID = $this->ID");
$conn = DB::getConn();
if($conn->hasMethod('allowPrimaryKeyEditing')) $conn->allowPrimaryKeyEditing('SiteTree', true);
DB::query("INSERT INTO \"SiteTree\" (\"ID\") VALUES ($this->ID)");
if($conn->hasMethod('allowPrimaryKeyEditing')) $conn->allowPrimaryKeyEditing('SiteTree', false);
}
$oldStage = Versioned::current_stage();