Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure we store changes in PC when catching #12850

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fixed a bug where non-admin users weren’t able to view Single section entries. ([#12838](https://github.com/craftcms/cms/issues/12838))
- Fixed an error that could occur when saving an element with eager-loaded relations. ([#12839](https://github.com/craftcms/cms/issues/12839))
- Fixed a bug where Customize Sources modals weren’t showing source headings with no subsequent sources. ([#12840](https://github.com/craftcms/cms/issues/12840))
- Fixed a bug where `entrify` commands could leave the database and project config data in inconsistent states, if aborted prematurely. ([#12850](https://github.com/craftcms/cms/pull/12850))
- Added `craft\db\Connection::getDriverLabel()`.

## 4.4.0 - 2023-03-08
Expand Down
13 changes: 11 additions & 2 deletions src/console/controllers/EntrifyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function actionCategories(string $categoryGroup): int
return ExitCode::UNSPECIFIED_ERROR;
}

$projectConfigService = Craft::$app->getProjectConfig();
$projectConfigChanged = false;

if (
Expand All @@ -127,6 +128,9 @@ public function actionCategories(string $categoryGroup): int
$author = $this->_author();
} catch (InvalidConfigException $e) {
$this->stderr($e->getMessage() . PHP_EOL, Console::FG_RED);
if ($projectConfigChanged) {
$projectConfigService->saveModifiedConfigData();
}
return ExitCode::UNSPECIFIED_ERROR;
}

Expand Down Expand Up @@ -217,7 +221,6 @@ public function actionCategories(string $categoryGroup): int

$this->success('Categories converted.');

$projectConfigService = Craft::$app->getProjectConfig();
if (!$projectConfigService->readOnly) {
if (!$categoryGroup->dateDeleted && $this->confirm("Delete the “{$categoryGroup}” category group?", true)) {
$this->do('Deleting category group', function() use ($categoryGroup) {
Expand Down Expand Up @@ -279,6 +282,7 @@ public function actionTags(string $tagGroup): int
return ExitCode::UNSPECIFIED_ERROR;
}

$projectConfigService = Craft::$app->getProjectConfig();
$projectConfigChanged = false;

if (
Expand All @@ -302,6 +306,9 @@ public function actionTags(string $tagGroup): int
$author = $this->_author();
} catch (InvalidConfigException $e) {
$this->stderr($e->getMessage() . PHP_EOL, Console::FG_RED);
if ($projectConfigChanged) {
$projectConfigService->saveModifiedConfigData();
}
return ExitCode::UNSPECIFIED_ERROR;
}

Expand Down Expand Up @@ -353,7 +360,6 @@ public function actionTags(string $tagGroup): int

$this->success('Tags converted.');

$projectConfigService = Craft::$app->getProjectConfig();
if (!$projectConfigService->readOnly) {
if (!$tagGroup->dateDeleted && $this->confirm("Delete the “{$tagGroup}” tag group?", true)) {
$this->do('Deleting tag group', function() use ($tagGroup) {
Expand Down Expand Up @@ -436,6 +442,9 @@ public function actionGlobalSet(string $globalSet): int
$entryType = $this->_entryType();
} catch (InvalidConfigException $e) {
$this->stderr($e->getMessage() . PHP_EOL, Console::FG_RED);
if ($projectConfigChanged) {
Craft::$app->getProjectConfig()->saveModifiedConfigData();
}
return ExitCode::UNSPECIFIED_ERROR;
}

Expand Down