BUGFIX MigrateSiteTreeLinkingTask returns duplicate results from databases like MSSQL - remove any duplicates that may be around

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@91418 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-11-12 04:16:31 +00:00 committed by Sam Minnee
parent 8bb3797f04
commit 8b65a55b55

View File

@ -22,6 +22,10 @@ class MigrateSiteTreeLinkingTask extends BuildTask {
'INNER JOIN "SiteTree_LinkTracking" ON "SiteTree_LinkTracking"."SiteTreeID" = "SiteTree"."ID"'
);
// Databases like MSSQL will give duplicate results - remove them
// This would normally be fixed by using SELECT DISTINCT, but DataObject::get() doesn't support it
$linkedPages->removeDuplicates();
if($linkedPages) foreach($linkedPages as $page) {
$tracking = DB::query(sprintf (
'SELECT "ChildID", "FieldName" FROM "SiteTree_LinkTracking" WHERE "SiteTreeID" = %d',