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.29k stars 2.59k 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 3 weeks ago

chriscroome commented 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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.