mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX MigrateSiteTreeLinkingTask returns duplicate results from databases like MSSQL - remove any duplicates that may be around (from r91418)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@91477 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2daf84910c
commit
03fb434e59
@ -15,13 +15,17 @@ class MigrateSiteTreeLinkingTask extends BuildTask {
|
|||||||
$pages = 0;
|
$pages = 0;
|
||||||
$links = 0;
|
$links = 0;
|
||||||
|
|
||||||
$linkedPages = DataObject::get (
|
$linkedPages = DataObject::get(
|
||||||
'SiteTree',
|
'SiteTree',
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
'INNER JOIN "SiteTree_LinkTracking" ON "SiteTree_LinkTracking"."SiteTreeID" = "SiteTree"."ID"'
|
'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) {
|
if($linkedPages) foreach($linkedPages as $page) {
|
||||||
$tracking = DB::query(sprintf (
|
$tracking = DB::query(sprintf (
|
||||||
'SELECT "ChildID", "FieldName" FROM "SiteTree_LinkTracking" WHERE "SiteTreeID" = %d',
|
'SELECT "ChildID", "FieldName" FROM "SiteTree_LinkTracking" WHERE "SiteTreeID" = %d',
|
||||||
|
Loading…
Reference in New Issue
Block a user