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

Avoid incidental execution of system report unless it has not been executed in a week #925

Merged
merged 7 commits into from
Nov 1, 2023

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Oct 31, 2023

Description:

Fixes #893

Changes:

  • Look for PHP binary in system report only on demand.
  • Cache whether errors exist in the system report for use with the admin menu item and notification. Before starting this check, assume there are no errors, so if the system report fails, Matomo for WordPress will still be accessible.

Review

@diosmosis diosmosis added the Needs Review For pull requests that need a code review. label Oct 31, 2023
@diosmosis diosmosis requested a review from tsteur October 31, 2023 18:30
@tsteur
Copy link
Member

tsteur commented Oct 31, 2023

@diosmosis great find! This would slow down things a lot executing system check every time.

I wonder if it's avoidable to call this every time in the first place but until then a cache will do 👍 I do wonder if it makes sense to use transients for caching? https://www.godaddy.com/resources/skills/transient-date-wordpress I don't know the pros/cons though. Maybe just something to consider. I believe when you then eg invalidate transients, then our cache will be also invalidated I believe which may be helpful at certain times. There could be cons too.

Off topic:
There is below string that is not really translatable into other languages. Any chance we can utilise %s there and put it in one sentence? Or we could create a separate issue for it and tackle it another time. Depending on the language, you can't translate 3 sentence parts individually.

<p>' . esc_html__( 'There are some errors in the', 'matomo' ) .
					' <a href="' . esc_url( admin_url( 'admin.php?page=matomo-systemreport' ) ) . '">' . esc_html__( 'Matomo Diagnostics System report', 'matomo' ) . '</a> ' .
					esc_html__( 'that may prevent the plugin for working normally.', 'matomo' ) . '</p></div>';

@diosmosis
Copy link
Member Author

diosmosis commented Nov 1, 2023

Transients were what I was looking for 👍, I checked the object cache but the docs stated it would not always persist past a single request so I didn't use it.

@diosmosis diosmosis merged commit 60e53e9 into develop Nov 1, 2023
10 checks passed
@diosmosis diosmosis deleted the system-report-cache branch November 1, 2023 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review For pull requests that need a code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System report should not execute for every matomo for wordpress admin page view
2 participants