Skip to content

Commit

Permalink
Added a fix for deleted sites
Browse files Browse the repository at this point in the history
This fixes an issue (Dolphiq#25) where deleted sites would be included in sitemap generation, causing an error to be thrown.
  • Loading branch information
mrnebbi committed Jul 28, 2020
1 parent 5c062c6 commit 163b173
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/controllers/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,9 @@ private function _createEntrySectionQuery(): Query
'[[elements_sites.elementId]] = [[elements.id]] AND [[elements_sites.enabled]] = 1')
->innerJoin('{{%sites}} sites', '[[elements_sites.siteId]] = [[sites.id]]')
->andWhere(['elements.dateDeleted' => null])
->andWhere(['sites.dateDeleted' => null])
->andWhere(['elements.archived' => false])
->andWhere(['elements.revisionId' => null])


->groupBy(['elements_sites.id']);
}

Expand Down Expand Up @@ -206,6 +205,7 @@ private function _createAlternateSectionQuery($elementId): Query
'[[elements_sites.elementId]] = [[elements.id]] AND [[elements_sites.enabled]] = 1')
->innerJoin('{{%sites}} sites', '[[elements_sites.siteId]] = [[sites.id]]')
->where(['=', '[[elements_sites.elementId]]', $elementId])
->andWhere(['sites.dateDeleted' => null])
->groupBy(['elements_sites.id']);
}

Expand All @@ -230,6 +230,7 @@ private function _createEntryCategoryQuery(): Query
'[[elements_sites.elementId]] = [[elements.id]] AND [[elements_sites.enabled]] = 1')
->innerJoin('{{%sites}} sites', '[[elements_sites.siteId]] = [[sites.id]]')
->andWhere(['elements.dateDeleted' => null])
->andWhere(['sites.dateDeleted' => null])
->groupBy(['elements_sites.id']);
}

Expand Down

0 comments on commit 163b173

Please sign in to comment.