Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX MigrateSiteTreeLinkingTask now takes a direct map when queryin…

…g 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 (from r110197)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112835 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit 2f159ce93e0a6666eac3720c49c1b365866cc1dc 1 parent 6e8bf56
@sminnee sminnee authored
Showing with 5 additions and 8 deletions.
  1. +5 −8 tasks/MigrateSiteTreeLinkingTask.php
View
13 tasks/MigrateSiteTreeLinkingTask.php
@@ -27,13 +27,10 @@ public function run($request) {
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
- ));
-
- foreach($tracking as $link) {
- $linked = DataObject::get_by_id('SiteTree', $link['ChildID']);
+ $tracking = DB::query(sprintf('SELECT "ChildID", "FieldName" FROM "SiteTree_LinkTracking" WHERE "SiteTreeID" = %d', $page->ID))->map();
+
+ 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 @@ public function run($request) {
$links += $replaced;
}
}
- $page->write();
+ $page->write();
$pages++;
}
Please sign in to comment.
Something went wrong with that request. Please try again.