matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.9k stars 2.65k forks source link

[Bug] Upgrade to 5.1.0 diagnostics:unexpected-files returns nothing but diagnostics:run returns directory to delete #22300

Open chriscroome opened 5 months ago

chriscroome commented 5 months ago

What happened?

After upgrading to 5.1.0 and running php console diagnostics:unexpected-files --delete -n and then checking using php console diagnostics:run the following is returned:

File integrity: WARNING File integrity check failed and reported some errors. You should fix this issue and then refresh this page until it shows no error.

Directories were found in your Matomo, but we didn't expect them.
--> Please delete these directories to prevent errors. <--

Directory to delete: node_modules/jquery.dotdotdot

To delete all these directories at once, you can run this command:
rm -Rf /home/stats/sites/default/node_modules/jquery.dotdotdot

1 warnings detected

What should happen?

The directory that should be deleted should have been deleted as a results of running php console diagnostics:unexpected-files --delete -n

How can this be reproduced?

Upgrade an older version of Matomo to version 5.1.0, and run php console diagnostics:unexpected-files and nothing is returned:

php console diagnostics:unexpected-files 
echo $?
0

Run php console diagnostics:run and a directory that should be deleted is listed, see above.

Matomo version

5.1.0

PHP version

8.3

Server operating system

Debian Bookworm

What browsers are you seeing the problem on?

Firefox

Computer operating system

Debian Bookworm

Relevant log output

No response

Validations

sgiehl commented 5 months ago

Hi @chriscroome,

How did you update? Using the one click update through UI or manually? Also did php console diagnostics:unexpected-files --delete -n do anything in your case? Did it maybe delete the files in node_modules/jquery.dotdotdot, but left the directory over empty?

chriscroome commented 5 months ago

I updated using the Ansible tasks in this role, which using rsync to copy the new version over the old version and then runs several php console commands.

The issue is that running php console diagnostics:unexpected-files --delete -n doesn't delete the node_modules/jquery.dotdotdot directory:

php console diagnostics:unexpected-files --delete -n
Preparing to delete all unexpected files from the Matomo installation directory

php console diagnostics:run
File integrity: WARNING File integrity check failed and reported some errors. You should fix this issue and then refresh this page until it shows no error.

Directories were found in your Matomo, but we didn't expect them.
--> Please delete these directories to prevent errors. <--

Directory to delete: node_modules/jquery.dotdotdot

To delete all these directories at once, you can run this command:
rm -Rf /home/stats/sites/default/node_modules/jquery.dotdotdot

1 warnings detected

This directory does have content:

ls -lah node_modules/jquery.dotdotdot
total 24K
drwxr-xr-x  3 stats stats 4.0K Mar  7 23:36 .
drwxr-xr-x 15 stats stats 4.0K Jun 10 07:48 ..
-rw-r--r--  1 stats stats 1.7K Mar  7 23:35 CONTRIBUTING.md
drwxr-xr-x  2 stats stats 4.0K Mar  7 23:35 dist
-rw-r--r--  1 stats stats  267 Mar  7 23:35 LICENSE.txt
-rw-r--r--  1 stats stats 1.4K Mar  7 23:35 README.md
sgiehl commented 5 months ago

That directory has been removed in latest release. So it's safe to remove it. We need to check why this doesn't happen automatically when running console diagnostics:unexpected-files --delete -n Thanks for reporting it.

randy-innocraft commented 3 months ago

Hi @chriscroome. Thank you for creating the issue and bringing this to our attention, that's very appreciated. We have reviewed and triaged the problem internally, and we have confirmed it is an issue. Our team will prioritise this, and we will update you on the progress here when we have an update to share. If you have any further information or questions, please feel free to add them here.