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] When deleting currently selected site, and you delete that site, an error shows up #22788

Open
4 tasks done
tsteur opened this issue Nov 21, 2024 · 4 comments
Open
4 tasks done
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. triaged

Comments

@tsteur
Copy link
Member

tsteur commented Nov 21, 2024

What happened?

An error shows up and you can't use Matomo anymore when you delete the currently selected site. When you try to go back every previous page will show an error too because the site has been deleted.

What should happen?

When you delete the currently selected site, Matomo should change the idSite parameter in the URL to a valid idSite so that measurable management works again.

How can this be reproduced?

  • Select any site in Matomo
  • Go to Admin -> Measurables -> Manage
  • Delete the selected site
  • An error shows up and you can't use Matomo anymore. When you try to go back every previous page will show an error too because the site has been deleted.
  • You need to enter your Matomo domain to continue working

Matomo version

5

PHP version

No response

Server operating system

No response

What browsers are you seeing the problem on?

No response

Computer operating system

No response

Relevant log output

No response

Validations

@tsteur tsteur 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 Nov 21, 2024
@michalkleiner
Copy link
Contributor

Hi Thomas, thanks for the report. Looking at the expected behaviour you're suggesting, would it possibly be better if parts of the admin interface that don't need to know about an active site didn't rely on having one in the URL at all? If we went with the approach of changing to a valid site id, which site id should it select? The oldest one, the newest one, the one with most revenue, some other one?

@des-innocraft des-innocraft added triaged and removed To Triage An issue awaiting triage by a Matomo core team member labels Nov 21, 2024
@sgiehl
Copy link
Member

sgiehl commented Nov 22, 2024

@michalkleiner Some parts of the admin do not need an idsite set. But if there is none, and you then switch to a part, where one would be needed, a similar problem occurs. So introducing some sort of default / fallback in case none is provided might be good.

@tsteur
Copy link
Member Author

tsteur commented Nov 22, 2024

If we went with the approach of changing to a valid site id, which site id should it select?

Just any will be fine. It happens so rarely so anything will be fine as long as you can continue using Matomo.

@tsteur
Copy link
Member Author

tsteur commented Nov 22, 2024

Ideally we'd use UserPreferences::getDefaultWebsiteId(). In the controller you can simply redirect by calling $this->redirectToIndex() and it'll use the default website ID if needed. May be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. triaged
Projects
None yet
Development

No branches or pull requests

4 participants