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.
|
// Extra tables for _Live, etc.
|
||||||
if($stage != $this->defaultStage) {
|
if($stage != $this->defaultStage) {
|
||||||
DB::requireTable("{$table}_$stage", $fields, $indexes);
|
DB::requireTable("{$table}_$stage", $fields, $indexes);
|
||||||
|
/*
|
||||||
if(!DB::query("SELECT * FROM {$table}_$stage")->value()) {
|
if(!DB::query("SELECT * FROM {$table}_$stage")->value()) {
|
||||||
$fieldList = implode(", ",array_keys($fields));
|
$fieldList = implode(", ",array_keys($fields));
|
||||||
DB::query("INSERT INTO `{$table}_$stage` (ID,$fieldList)
|
DB::query("INSERT INTO `{$table}_$stage` (ID,$fieldList)
|
||||||
SELECT ID,$fieldList FROM `$table`");
|
SELECT ID,$fieldList FROM `$table`");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version fields on each root table (including Stage)
|
// Version fields on each root table (including Stage)
|
||||||
@ -156,13 +157,14 @@ class Versioned extends DataObjectDecorator {
|
|||||||
);
|
);
|
||||||
|
|
||||||
DB::requireTable("{$table}_versions", $versionFields, $versionIndexes);
|
DB::requireTable("{$table}_versions", $versionFields, $versionIndexes);
|
||||||
|
/*
|
||||||
if(!DB::query("SELECT * FROM {$table}_versions")->value()) {
|
if(!DB::query("SELECT * FROM {$table}_versions")->value()) {
|
||||||
$fieldList = implode(", ",array_keys($fields));
|
$fieldList = implode(", ",array_keys($fields));
|
||||||
|
|
||||||
DB::query("INSERT INTO `{$table}_versions` ($fieldList, RecordID, Version)
|
DB::query("INSERT INTO `{$table}_versions` ($fieldList, RecordID, Version)
|
||||||
SELECT $fieldList, ID AS RecordID, 1 AS Version FROM `$table`");
|
SELECT $fieldList, ID AS RecordID, 1 AS Version FROM `$table`");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DB::dontRequireTable("{$table}_versions");
|
DB::dontRequireTable("{$table}_versions");
|
||||||
@ -568,6 +570,13 @@ class Versioned extends DataObjectDecorator {
|
|||||||
return new $className($record);
|
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_stage = null;
|
||||||
protected static $reading_archived_date = null;
|
protected static $reading_archived_date = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user