From 186e3466af00b9d649069559e1741021121a08d7 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 15 Aug 2007 10:13:27 +0000 Subject: [PATCH] Fixed bug to support tests git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40166 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Versioned.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/model/Versioned.php b/core/model/Versioned.php index f4a7f64c8..c1df3f65f 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -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; }