BUGFIX MigrateSiteTreeLinkingTask now takes a direct map when querying the page tracked links instead of looping through the direct result set. This fixes SQL Server failing when MARS (Multiple Active Result Sets) is disabled

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@110197 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-08-30 05:25:42 +00:00 committed by Sam Minnee
parent 3a210c397a
commit 5160c8abd4

View File

@ -27,13 +27,10 @@ class MigrateSiteTreeLinkingTask extends BuildTask {
if($linkedPages) $linkedPages->removeDuplicates();
if($linkedPages) foreach($linkedPages as $page) {
$tracking = DB::query(sprintf (
'SELECT "ChildID", "FieldName" FROM "SiteTree_LinkTracking" WHERE "SiteTreeID" = %d',
$page->ID
));
$tracking = DB::query(sprintf('SELECT "ChildID", "FieldName" FROM "SiteTree_LinkTracking" WHERE "SiteTreeID" = %d', $page->ID))->map();
foreach($tracking as $link) {
$linked = DataObject::get_by_id('SiteTree', $link['ChildID']);
foreach($tracking as $childID => $fieldName) {
$linked = DataObject::get_by_id('SiteTree', $childID);
// TOOD: Replace in all HTMLText fields
$page->Content = preg_replace (
@ -48,8 +45,8 @@ class MigrateSiteTreeLinkingTask extends BuildTask {
$links += $replaced;
}
}
$page->write();
$page->write();
$pages++;
}