Fixed bug to support tests

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40166 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-08-15 10:13:27 +00:00
parent 2c3cea4df0
commit 186e3466af
1 changed files with 11 additions and 2 deletions

View File

@ -119,12 +119,13 @@ class Versioned extends DataObjectDecorator {
// Extra tables for _Live, etc.
if($stage != $this->defaultStage) {
DB::requireTable("{$table}_$stage", $fields, $indexes);
/*
if(!DB::query("SELECT * FROM {$table}_$stage")->value()) {
$fieldList = implode(", ",array_keys($fields));
DB::query("INSERT INTO `{$table}_$stage` (ID,$fieldList)
SELECT ID,$fieldList FROM `$table`");
}
*/
}
// Version fields on each root table (including Stage)
@ -156,13 +157,14 @@ class Versioned extends DataObjectDecorator {
);
DB::requireTable("{$table}_versions", $versionFields, $versionIndexes);
/*
if(!DB::query("SELECT * FROM {$table}_versions")->value()) {
$fieldList = implode(", ",array_keys($fields));
DB::query("INSERT INTO `{$table}_versions` ($fieldList, RecordID, Version)
SELECT $fieldList, ID AS RecordID, 1 AS Version FROM `$table`");
}
*/
} else {
DB::dontRequireTable("{$table}_versions");
@ -568,6 +570,13 @@ class Versioned extends DataObjectDecorator {
return new $className($record);
}
function contentcontrollerInit($controller) {
self::choose_site_stage();
}
function modelascontrollerInit($controller) {
self::choose_site_stage();
}
protected static $reading_stage = null;
protected static $reading_archived_date = null;
}