Skip to content

Commit

Permalink
FIX Regression where pages would be indexed under all subsites
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensby committed Dec 9, 2016
1 parent 50c9f52 commit 465c072
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion code/search/SearchVariantSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,20 @@ public function extractManipulationWriteState(&$writes)
continue;
}

if (isset($write['fields']['SiteTree:SubsiteID'])) {
$subsitesForWrite = array($write['fields']['SiteTree:SubsiteID']);
}
// files in subsite 0 should be in all subsites as they are global
elseif (isset($write['fields']['File:SubsiteID']) && intval($write['fields']['File:SubsiteID']) !== 0) {
$subsitesForWrite = array($write['fields']['File:SubsiteID']);
}
else {
$subsitesForWrite = $subsites;
}

$next = array();
foreach ($write['statefulids'] as $i => $statefulid) {
foreach ($subsites as $subsiteID) {
foreach ($subsitesForWrite as $subsiteID) {
$next[] = array(
'id' => $statefulid['id'],
'state' => array_merge(
Expand Down

1 comment on commit 465c072

@normann
Copy link

@normann normann commented on 465c072 Jun 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit is a life saver.

Please sign in to comment.