mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Fix notice-level error in 'show deleted pages' function
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76096 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
aafaee660b
commit
3e18112b32
@ -103,23 +103,19 @@ class Versioned extends DataObjectDecorator {
|
||||
* @todo Ensure that this is DB abstracted
|
||||
*/
|
||||
protected static function requireArchiveTempTable($baseTable, $date = null) {
|
||||
if(!isset(self::$createdArchiveTempTable[$baseTable])) {
|
||||
self::$createdArchiveTempTable[$baseTable] = true;
|
||||
|
||||
DB::query("CREATE TEMPORARY TABLE IF NOT EXISTS \"_Archive$baseTable\" (
|
||||
\"RecordID\" INT NOT NULL PRIMARY KEY,
|
||||
\"Version\" INT NOT NULL
|
||||
)");
|
||||
|
||||
if(!DB::query("SELECT COUNT(*) FROM \"_Archive$baseTable\"")->value()) {
|
||||
if($date) $dateClause = "WHERE \"LastEdited\" <= '$date'";
|
||||
else $dateClause = "";
|
||||
DB::query("CREATE TEMPORARY TABLE IF NOT EXISTS \"_Archive$baseTable\" (
|
||||
\"RecordID\" INT NOT NULL PRIMARY KEY,
|
||||
\"Version\" INT NOT NULL
|
||||
)");
|
||||
|
||||
if(!DB::query("SELECT COUNT(*) FROM \"_Archive$baseTable\"")->value()) {
|
||||
if($date) $dateClause = "WHERE \"LastEdited\" <= '$date'";
|
||||
else $dateClause = "";
|
||||
|
||||
DB::query("INSERT INTO \"_Archive$baseTable\"
|
||||
SELECT \"RecordID\", max(\"Version\") FROM \"{$baseTable}_versions\"
|
||||
$dateClause
|
||||
GROUP BY \"RecordID\"");
|
||||
}
|
||||
DB::query("INSERT INTO \"_Archive$baseTable\"
|
||||
SELECT \"RecordID\", max(\"Version\") FROM \"{$baseTable}_versions\"
|
||||
$dateClause
|
||||
GROUP BY \"RecordID\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user