Skip to content

[4.x]: MaxBackups not working since glob pattern is invalid #15780

@KevinSleegers

Description

@KevinSleegers

What happened?

Description

The glob pattern to grab the existing backups is invalid on lines 301 and 302 in src/db/Connection.php. The problem is that it contains 2 periods since $this->_getDumpExtension() also starts with a period. This results in [PROJECT]/storage/backups/*..sql and [PROJECT]/storage/backups/*..sql.zip by default.

Expected behavior

The set number of backups based on maxBackups should be respected and older backups should be deleted.

Actual behavior

No database backups are removed since $files is always an empty array due to the invalid glob pattern.

Craft CMS version

4.10.4

PHP version

8.3.11

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions