mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
2c3cea4df0
commit
186e3466af
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user