bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.3k stars 4.78k forks source link

[bitnami/matomo] Delete obsolete files after an update #72535

Open RisingOpsNinja opened 1 week ago

RisingOpsNinja commented 1 week ago

Name and Version

bitnami/matomo:5.1.1

What is the problem this feature will solve?

An update replaces all existing Matomo files with the latest version, but it does not delete obsolete files. E.g. when updating from 4.16.0 to 5.1.1, 168 old files remain.

Because since image version 4.15.0-debian-11-r20, all Matomo files have been made persistent:

https://github.com/bitnami/containers/pull/42956/commits/33b63ac86846d63964fce5555fedd0d2d9b0e76c

 4.15.0-debian-11-r20

From this version on, all Matomo files are persisted (MATOMO_DATA_TO_PERSIST env var). During the upgrade process, they will be replaced (except the config.ini.php file) as suggested in [the official documentation](https://matomo.org/faq/on-premise/update-matomo/#the-manual-three-step-update)

What is the feature you are proposing to solve the problem?

The official Matomo documentation suggest deleting obsolete files after an update with this command (Matomo 4.13.2+ only):

 ./console diagnostics:unexpected-files --delete

Excluded files:

$excludedFiles = [
            '/^config\/config.ini.php$/',        // main config file
            '/^config\/common.config.ini.php$/', // multi-tenant config file
            '/\.htaccess$/',                     // apache directory access rules
            '/^config\/config.php$/',            // DI customisation
            '/^misc\/.*$/'                       // everything in the misc/ directory (geo databases, multi-tenant, etc)
        ];

Source: https://github.com/matomo-org/matomo/blob/f9d5c2856f5e4bf9b09414a0b3da56b5392352e7/plugins/Diagnostics/Commands/UnexpectedFiles.php#L88

Caveat:

This command also deletes

What alternatives have you considered?

No response

carrodher commented 1 week ago

Thank you for bringing this issue to our attention. We appreciate your involvement! If you're interested in contributing a solution, we welcome you to create a pull request. The Bitnami team is excited to review your submission and offer feedback. You can find the contributing guidelines here.

Your contribution will greatly benefit the community. Feel free to reach out if you have any questions or need assistance.