Skip to content

Commit

Permalink
Fixed #4100
Browse files Browse the repository at this point in the history
  • Loading branch information
andris-sevcenko committed Apr 9, 2019
1 parent 1b861d7 commit 6df5a89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Fixed a bug where entry drafts weren’t showing previous changes to Matrix fields on the draft. ([#4105](https://github.com/craftcms/cms/issues/4105))
- Fixed a bug where the `project-config/sync` console command was not performing schema checks.
- Fixed a bug where sometimes project.yaml changes were not being picked up. ([#4028](https://github.com/craftcms/cms/issues/4028))
- Fixed a bug where project config rebuild would restore deleted content. ([#4100](https://github.com/craftcms/cms/issues/4100))

## 3.1.21.1 - 2019-04-04

Expand Down
17 changes: 17 additions & 0 deletions src/services/ProjectConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,7 @@ private function _getSiteGroupData(): array
'name',
])
->from([Table::SITEGROUPS])
->where(['dateDeleted' => null])
->pairs();

foreach ($siteGroups as $uid => $name) {
Expand Down Expand Up @@ -1444,6 +1445,8 @@ private function _getSiteData(): array
])
->from(['{{%sites}} sites'])
->innerJoin('{{%sitegroups}} siteGroups', '[[sites.groupId]] = [[siteGroups.id]]')
->where(['sites.dateDeleted' => null])
->andWhere(['siteGroups.dateDeleted' => null])
->all();

foreach ($sites as $site) {
Expand Down Expand Up @@ -1476,6 +1479,8 @@ private function _getSectionData(): array
])
->from(['{{%sections}} sections'])
->leftJoin('{{%structures}} structures', '[[structures.id]] = [[sections.structureId]]')
->where(['sections.dateDeleted' => null])
->andWhere(['structures.dateDeleted' => null])
->all();

$sectionData = [];
Expand Down Expand Up @@ -1510,6 +1515,8 @@ private function _getSectionData(): array
->from(['{{%sections_sites}} sections_sites'])
->innerJoin('{{%sites}} sites', '[[sites.id]] = [[sections_sites.siteId]]')
->innerJoin('{{%sections}} sections', '[[sections.id]] = [[sections_sites.sectionId]]')
->where(['sites.dateDeleted' => null])
->andWhere(['sections.dateDeleted' => null])
->all();

foreach ($sectionSiteRows as $sectionSiteRow) {
Expand All @@ -1533,6 +1540,8 @@ private function _getSectionData(): array
])
->from(['{{%entrytypes}} as entrytypes'])
->innerJoin('{{%sections}} sections', '[[sections.id]] = [[entrytypes.sectionId]]')
->where(['sections.dateDeleted' => null])
->andWhere(['entrytypes.dateDeleted' => null])
->all();

$layoutIds = ArrayHelper::getColumn($entryTypeRows, 'fieldLayoutId');
Expand Down Expand Up @@ -1739,6 +1748,7 @@ private function _getVolumeData(): array
'volumes.uid',
])
->from(['{{%volumes}} volumes'])
->where(['volumes.dateDeleted' => null])
->all();

$layoutIds = [];
Expand Down Expand Up @@ -1781,6 +1791,7 @@ private function _getUserData(): array
->select(['id'])
->from([Table::FIELDLAYOUTS])
->where(['type' => User::class])
->where(['dateDeleted' => null])
->scalar();

if ($layoutId) {
Expand Down Expand Up @@ -1843,6 +1854,8 @@ private function _getCategoryGroupData(): array
])
->from(['{{%categorygroups}} groups'])
->leftJoin('{{%structures}} structures', '[[structures.id]] = [[groups.structureId]]')
->where(['groups.dateDeleted' => null])
->andWhere(['structures.dateDeleted' => null])
->all();

$groupData = [];
Expand Down Expand Up @@ -1889,6 +1902,8 @@ private function _getCategoryGroupData(): array
->from(['{{%categorygroups_sites}} groups_sites'])
->innerJoin('{{%sites}} sites', '[[sites.id]] = [[groups_sites.siteId]]')
->innerJoin('{{%categorygroups}} groups', '[[groups.id]] = [[groups_sites.groupId]]')
->where(['groups.dateDeleted' => null])
->andWhere(['sites.dateDeleted' => null])
->all();

foreach ($groupSiteRows as $groupSiteRow) {
Expand Down Expand Up @@ -1916,6 +1931,7 @@ private function _getTagGroupData(): array
'groups.fieldLayoutId',
])
->from(['{{%taggroups}} groups'])
->where(['groups.dateDeleted' => null])
->all();

$groupData = [];
Expand Down Expand Up @@ -2086,6 +2102,7 @@ private function _generateFieldLayoutArray(array $layoutIds): array
->innerJoin('{{%fieldlayouts}} AS layouts', '[[layoutFields.layoutId]] = [[layouts.id]]')
->innerJoin('{{%fields}} AS fields', '[[layoutFields.fieldId]] = [[fields.id]]')
->where(['layouts.id' => $layoutIds])
->andWhere(['layouts.dateDeleted' => null])
->orderBy(['tabs.sortOrder' => SORT_ASC, 'layoutFields.sortOrder' => SORT_ASC])
->all();

Expand Down

0 comments on commit 6df5a89

Please sign in to comment.