Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Command line console does not work after upgrade to 5.0 #21718

Closed
4 tasks done
hyzteric opened this issue Dec 19, 2023 · 11 comments
Closed
4 tasks done

[Bug] Command line console does not work after upgrade to 5.0 #21718

hyzteric opened this issue Dec 19, 2023 · 11 comments
Labels
answered For when a question was asked and we referred to forum or answered it. invalid For issues or pull requests that are no longer relevant to Matomo core.

Comments

@hyzteric
Copy link

What happened?

I tried to upgrade to Matomo 5.0 and do it manually since I will do it on a high traffic website.
When I wanted to run console commands, I got a PHP Fatal Error.

What should happen?

There should be no error when running the ./console help 😁

How can this be reproduced?

Download latest version
wget https://builds.matomo.org/matomo.zip

Extract it to "matomo/" directory
unzip -o matomo.zip

Set file ownership
chown -R apache:apache /var/web/matomo

Disable Matomo Tracking and web interface via config/config.ini.php,

	[Tracker]
	record_statistics = 0
	[General]
	maintenance_mode = 1

Check for any obsolete files

cd matomo/
./console diagnostics:unexpected-files 

=> PHP Fatal error: Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/web/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27

Then I tried this :
./console help
=> PHP Fatal error: Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/web/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27

Then I put the backup back, run the same console command => No error

Matomo version

5.0

PHP version

8.1.25 (cli)

Server operating system

Rocky Linux 8.8

What browsers are you seeing the problem on?

Not applicable (e.g. an API call etc.)

Computer operating system

Windows 10

Relevant log output

No response

Validations

@hyzteric hyzteric added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Dec 19, 2023
@michalkleiner
Copy link
Contributor

michalkleiner commented Dec 19, 2023

Hi @hyzteric, thank you for raising the issue.

To be able to establish this is a true issue and not a one off or configuration specific issue, can you try if the same works/doesn't work on a different linux machine perhaps?
I just tried following the same steps but didn't get any errors locally on a MacOS. Tried PHP 8.1, 8.2 and 8.3.

Is the above the only content in your config.ini.php file or did you put anything extra there?

@michalkleiner michalkleiner added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Dec 19, 2023
@sgiehl
Copy link
Member

sgiehl commented Dec 19, 2023

The file plugins/CoreConsole/Commands/GenerateAngularComponent.php no longer exists in Matomo 5. Due to internal code changes in this major release old files might break Matomo. Like in this case. Removing it manually and should fix the problem.

Which version did you update from?

@sgiehl sgiehl removed the To Triage An issue awaiting triage by a Matomo core team member label Dec 19, 2023
@tsteur
Copy link
Member

tsteur commented Dec 19, 2023

Here we should be likely adding another update script that will remove these files automatically should someone not removing it themselves to avoid upgrade issues.

I believe we've done this in the past and noticed this was necessary to avoid some update issues for some people.
We could check which dimensions and commands were removed and remove those files manually maybe?

It's something we probably also want to document as part of our process so it won't be forgotten next time.

@hyzteric
Copy link
Author

hyzteric commented Dec 20, 2023

Ok so I did delete those two files (supposing it was the same issue for the second one) and it went through:

  • /var/web/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php
  • /var/web/matomo/plugins/CoreConsole/Commands/GenerateAngularDirective.php

Upgrading from 4.16

@sgiehl
Copy link
Member

sgiehl commented Dec 20, 2023

@tsteur That wouldn't help for that specific scenario. When simply overwriting the installation with new files, old files can always cause issues. Removing them in an update script would work fine when updating through the UI. But on command line running any console command would fail due to the old files. So the update command would fail as well.

@hyzteric
Copy link
Author

@sgiehl I based my update from this page : https://fr.matomo.org/faq/on-premise/update-matomo/
I think it would be great to add on that page a link to the changelogs where a specific section should be added with required manual operations when needed.

@hyzteric
Copy link
Author

Also, I was not (and still am) not too sure if I could just remove the old directory, extract the new one and just copy my old config.ini.php over it. Would it break something? If not then I would do that next time. And maybe the update page should mention it too (https://fr.matomo.org/faq/on-premise/update-matomo/)

@sgiehl
Copy link
Member

sgiehl commented Dec 20, 2023

@hyzteric If you don't have any additional plugins installed that works without problems. If you have any those would be lost and would need to be reinstalled.

@hyzteric
Copy link
Author

Thanks. That's what I thought so I'll stick to overwriting then.

@michalkleiner michalkleiner added answered For when a question was asked and we referred to forum or answered it. invalid For issues or pull requests that are no longer relevant to Matomo core. and removed Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Dec 20, 2023
@michalkleiner
Copy link
Contributor

Thanks for confirming that after manually removing the files you were able to finish the upgrade. Don't hesitate to open a new issue if you find any other (reproducible) bugs with Matomo 5.

@michalkleiner michalkleiner closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/update-matomo-4-16-0-5-0-0-error/54668/4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. invalid For issues or pull requests that are no longer relevant to Matomo core.
Projects
None yet
Development

No branches or pull requests

5 participants