Skip to content

Commit

Permalink
Don't include the DB backup utility when backupCommand is false
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 15, 2024
1 parent 20671ca commit 3840c69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Fixed a SQL error that could occur when converting a field to a Lightswitch field on PostgreSQL. ([#14792](https://github.com/craftcms/cms/issues/14792))
- Fixed a bug where the Database Backup utility was present when the `backupCommand` config setting was set to `false`.

## 4.8.9 - 2024-04-10

Expand Down
9 changes: 7 additions & 2 deletions src/services/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ public function getAllUtilityTypes(): array

$utilityTypes[] = ClearCaches::class;
$utilityTypes[] = DeprecationErrors::class;
$utilityTypes[] = DbBackup::class;

$generalConfig = Craft::$app->getConfig()->getGeneral();
if ($generalConfig->backupCommand !== false) {
$utilityTypes[] = DbBackup::class;
}

$utilityTypes[] = FindAndReplace::class;
$utilityTypes[] = Migrations::class;

Expand All @@ -98,7 +103,7 @@ public function getAllUtilityTypes(): array
]);
$this->trigger(self::EVENT_REGISTER_UTILITY_TYPES, $event);

$disabledUtilities = array_flip(Craft::$app->getConfig()->getGeneral()->disabledUtilities);
$disabledUtilities = array_flip($generalConfig->disabledUtilities);

return array_values(array_filter($event->types, function(string $class) use ($disabledUtilities) {
/** @var string|UtilityInterface $class */
Expand Down

0 comments on commit 3840c69

Please sign in to comment.