Skip to content

Commit

Permalink
Delete .sql.zip files per maxBackups setting
Browse files Browse the repository at this point in the history
Resolves #11241
  • Loading branch information
brandonkelly committed Jun 4, 2022
1 parent 94003ab commit 607d1e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Field layout elements within field layout designers now support double-clicking to open their settings slideout. ([#11277](https://github.com/craftcms/cms/discussions/11277))
- The control panel’s JavaScript queue is now paused when the browser tab isn’t visible. ([#10632](https://github.com/craftcms/cms/issues/10632))
- The `users/create` command now asks whether the user should be activated when saved.
- The `maxBackups` config setting now impacts `.sql.zip` files in addition to `.sql` files. ([#11241](https://github.com/craftcms/cms/issues/11241))
- Deprecation messages are now consistently referred to as “deprecation warnings” in the control panel.
- Callback functions returned by elements’ `sortOptions()`/`defineSortOptions()` methods are now passed a `craft\db\Connection` object as a second argument.
- The `searchindex` table is now uses the InnoDB storage engine by default for MySQL installs. ([#11374](https://github.com/craftcms/cms/discussions/11374))
Expand Down
5 changes: 4 additions & 1 deletion src/db/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ public function backupTo(string $filePath): void
$backupPath = Craft::$app->getPath()->getDbBackupPath();

// Grab all .sql files in the backup folder.
$files = glob($backupPath . DIRECTORY_SEPARATOR . '*.sql');
$files = array_merge(
glob($backupPath . DIRECTORY_SEPARATOR . '*.sql'),
glob($backupPath . DIRECTORY_SEPARATOR . '*.sql.zip'),
);

// Sort them by file modified time descending (newest first).
usort($files, static function($a, $b) {
Expand Down

0 comments on commit 607d1e0

Please sign in to comment.