PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.8.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.8.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / classes / WpMatomo / Admin / views / systemreport.php
matomo / classes / WpMatomo / Admin / views Last commit date
access.php 7 months ago adblocker-notice.php 7 months ago advanced_settings.php 10 months ago exclusion_settings.php 4 years ago geolocation_settings.php 2 years ago get_started.php 2 months ago import_wp_statistics.php 2 months ago info.php 2 months ago info_bug_report.php 2 years ago info_help.php 1 year ago info_high_traffic.php 2 years ago info_matomo_desc.php 1 year ago info_multisite.php 2 months ago info_newsletter.php 4 years ago info_shared.php 1 year ago marketplace.php 3 months ago marketplace_setup_wizard.php 3 months ago marketplace_setup_wizard_body.php 3 months ago measurable_settings.php 2 years ago privacy_gdpr.php 4 years ago scheduled_tasks_failures.php 2 years ago settings.php 2 months ago settings_errors.php 4 years ago summary.php 2 months ago systemreport.php 2 months ago tracking.php 4 months ago update_notice_clear_cache.php 5 years ago whats-new-notifications.php 1 year ago
systemreport.php
331 lines
1 <?php
2 /**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 * @package matomo
8 */
9 /**
10 * phpcs considers all of our variables as global and want them prefixed with matomo
11 * phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
12 */
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16 ?>
17 <style>
18 .matomo-systemreport table a {
19 color: inherit;
20 text-decoration: underline;
21 }
22 </style>
23 <?php
24 use WpMatomo\Access;
25 use WpMatomo\Admin\Menu;
26 use WpMatomo\Admin\SystemReport;
27
28 /** @var Access $access */
29 /** @var array $matomo_tables */
30 /** @var array $matomo_has_exception_logs */
31 /** @var bool $matomo_has_warning_and_no_errors */
32 /** @var bool $matomo_has_errors */
33 /** @var string $matomo_active_tab */
34 /** @var \WpMatomo\Settings $settings */
35 /** @var array $matomo_scheduled_tasks */
36
37 if ( ! function_exists( 'matomo_format_value_text' ) ) {
38 function matomo_format_value_text( $value ) {
39 if ( is_string( $value ) && ! empty( $value ) ) {
40 $matomo_format = [
41 '<br />' => ' ',
42 '<br/>' => ' ',
43 '<br>' => ' ',
44 ];
45 foreach ( $matomo_format as $search => $replace ) {
46 $value = str_replace( $search, $replace, $value );
47 }
48 }
49
50 return $value;
51 }
52 }
53 ?>
54
55 <div class="matomo-systemreport">
56 <?php
57 // if there are no errors, make sure the error notice is not displayed
58 // (if there were errors previously, it may have been output before the system
59 // report is shown)
60 if ( empty( $matomo_has_errors ) && empty( $matomo_active_tab ) ) {
61 ?>
62 <script>
63 window.jQuery(document).ready(function ($) {
64 $('#matomo-systemreporterrors.notice').remove();
65 });
66 </script>
67 <?php
68 }
69 ?>
70
71 <?php
72 if ( $matomo_has_warning_and_no_errors ) {
73 ?>
74 <div class="notice notice-warning">
75 <p><?php esc_html_e( 'There are some issues with your system. Matomo will run, but you might experience some minor problems. See below for more information.', 'matomo' ); ?></p>
76 </div>
77 <?php
78 }
79 ?>
80 <?php if ( $settings->is_network_enabled() && ! is_network_admin() && is_super_admin() ) { ?>
81 <div class="updated notice">
82 <p><?php esc_html_e( 'Only you are seeing this page as you are the super admin', 'matomo' ); ?></p>
83 </div>
84 <?php } ?>
85
86 <h2 class="nav-tab-wrapper">
87 <a href="?page=<?php echo esc_attr( Menu::SLUG_SYSTEM_REPORT ); ?>"
88 class="nav-tab <?php echo empty( $matomo_active_tab ) ? 'nav-tab-active' : ''; ?>"> System report</a>
89 <a href="?page=<?php echo esc_attr( Menu::SLUG_SYSTEM_REPORT ); ?>&tab=troubleshooting"
90 class="nav-tab <?php echo 'troubleshooting' === $matomo_active_tab ? 'nav-tab-active' : ''; ?>">Troubleshooting</a>
91 </h2>
92
93 <?php if ( empty( $matomo_active_tab ) ) { ?>
94
95 <p><?php esc_html_e( 'Copy the below info in case our support team asks you for this information:', 'matomo' ); ?>
96 <br/> <br/>
97 <a href="javascript:void(0);"
98 onclick="var textarea = document.getElementById('matomo_system_report_info');textarea.select();document.execCommand('copy');"
99 class='button-primary'><?php esc_html_e( 'Copy system report', 'matomo' ); ?></a>
100
101 </p>
102 <textarea style="width:100%;height: 200px;" readonly
103 id="matomo_system_report_info">
104 <?php
105 foreach ( $matomo_tables as $matomo_table ) {
106 if ( empty( $matomo_table['rows'] ) ) {
107 continue;
108 }
109 echo '# ' . esc_html( $matomo_table['title'] ) . "\n";
110 foreach ( $matomo_table['rows'] as $index => $matomo_row ) {
111 if ( ! empty( $matomo_row['section'] ) ) {
112 echo "\n\n## " . esc_html( $matomo_row['section'] ) . "\n";
113 continue;
114 }
115 $matomo_value = $matomo_row['value'];
116 if ( true === $matomo_value ) {
117 $matomo_value = 'Yes';
118 } elseif ( false === $matomo_value ) {
119 $matomo_value = 'No';
120 }
121 $matomo_class = '';
122 if ( ! empty( $matomo_row['is_error'] ) ) {
123 $matomo_class = 'Error ';
124 } elseif ( ! empty( $matomo_row['is_warning'] ) ) {
125 $matomo_class = 'Warning ';
126 }
127 echo "\n* " . esc_html( $matomo_class ) . esc_html( $matomo_row['name'] ) . ': ' . esc_html( matomo_anonymize_value( matomo_format_value_text( $matomo_value ) ) );
128 if ( isset( $matomo_row['comment'] ) && '' !== $matomo_row['comment'] ) {
129 // We want to add links in the comments
130 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
131 echo ' (' . matomo_anonymize_value( matomo_format_value_text( $matomo_row['comment'] ) ) . ')';
132 }
133 }
134 echo "\n\n";
135 }
136 ?>
137 </textarea>
138
139 <?php
140 foreach ( $matomo_tables as $matomo_table ) {
141 if ( empty( $matomo_table['rows'] ) ) {
142 continue;
143 }
144 echo '<h2>' . esc_html( $matomo_table['title'] ) . "</h2><table class='widefat'><thead></thead><tbody>";
145 foreach ( $matomo_table['rows'] as $matomo_row ) {
146 if ( ! empty( $matomo_row['section'] ) ) {
147 $matomo_section_id = preg_replace( '/[^a-zA-Z0-9_-]/', '', strtolower( $matomo_row['section'] ) );
148 echo '</tbody><thead id="' . esc_attr( $matomo_section_id )
149 . '"><tr><th colspan="3" class="section">' . esc_html( $matomo_row['section'] ) . '</th></tr></thead><tbody id="'
150 . esc_attr( $matomo_section_id . '_body' ) . '">';
151 continue;
152 }
153 $matomo_value = $matomo_row['value'];
154 if ( true === $matomo_value ) {
155 $matomo_value = esc_html__( 'Yes', 'matomo' );
156 } elseif ( false === $matomo_value ) {
157 $matomo_value = esc_html__( 'No', 'matomo' );
158 }
159 $matomo_class = '';
160 if ( ! empty( $matomo_row['is_error'] ) ) {
161 $matomo_class = 'error';
162 } elseif ( ! empty( $matomo_row['is_warning'] ) ) {
163 $matomo_class = 'warning';
164 }
165 echo "<tr class='" . esc_attr( $matomo_class ) . "'" . ( isset( $matomo_row['name'] ) ? ' id="matomo-diagnostic-' . esc_attr( sanitize_key( $matomo_row['name'] ) ) : '' ) . '">';
166 echo "<td width='30%'>" . esc_html( $matomo_row['name'] ) . '</td>';
167 echo "<td width='" . ( ! empty( $matomo_table['has_comments'] ) ? 20 : 70 ) . "%'>" . esc_html( $matomo_value ) . '</td>';
168 if ( ! empty( $matomo_table['has_comments'] ) ) {
169 $matomo_replaced_elements = [
170 '<code>' => '__#CODEBACKUP#__',
171 '</code>' => '__##CODEBACKUP##__',
172 '<pre style="overflow-x: scroll;max-width: 600px;">' => '__#PREBACKUP#__',
173 '</pre>' => '__##PREBACKUP##__',
174 '<br/>' => '__#BRBACKUP#__',
175 '<br />' => '__#BRBACKUP#__',
176 '<br>' => '__#BRBACKUP#__',
177 ];
178 $matomo_comment = isset( $matomo_row['comment'] ) ? $matomo_row['comment'] : '';
179 $matomo_replaced = str_replace( array_keys( $matomo_replaced_elements ), array_values( $matomo_replaced_elements ), $matomo_comment );
180 // note: the text is not escaped anymore. Instead, the escaping is made when generating the comment. It allows then to add links in the output.
181 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
182 echo "<td width='50%' class='matomo-systemreport-comment'>" . str_replace( array_values( $matomo_replaced_elements ), array_keys( $matomo_replaced_elements ), $matomo_replaced ) . '</td>';
183 }
184
185 echo '</tr>';
186 }
187 echo '</tbody></table>';
188 }
189 ?>
190
191 <?php } else { ?>
192 <h1><?php esc_html_e( 'Troubleshooting', 'matomo' ); ?></h1>
193
194 <form method="post">
195 <?php wp_nonce_field( SystemReport::NONCE_NAME ); ?>
196
197 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_ARCHIVE_NOW ); ?>" type="submit"
198 class='button-primary'
199 title="<?php esc_attr_e( 'If reports show no data even though they should, you may try to see if report generation works when manually triggering the report generation.', 'matomo' ); ?>"
200 value="<?php esc_html_e( 'Archive reports', 'matomo' ); ?>">
201 <br/><br/>
202 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_CLEAR_MATOMO_CACHE ); ?>" type="submit"
203 class='button-primary'
204 title="<?php esc_attr_e( 'Will reset / empty the Matomo cache which can be helpful if something is not working as expected for example after an update.', 'matomo' ); ?>"
205 value="<?php esc_html_e( 'Clear Matomo cache', 'matomo' ); ?>">
206 <br/><br/>
207 <?php if ( ! empty( $matomo_has_exception_logs ) ) { ?>
208 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_CLEAR_LOGS ); ?>" type="submit"
209 class='button-primary'
210 title="<?php esc_attr_e( 'Removes all stored Matomo logs that are shown in the system report', 'matomo' ); ?>"
211 value="<?php esc_html_e( 'Clear system report logs', 'matomo' ); ?>">
212 <br/><br/>
213 <?php } ?>
214
215 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_UPDATE_GEOIP_DB ); ?>" type="submit"
216 class='button-primary'
217 title="<?php esc_attr_e( 'Updates the geolocation database which is used to detect the location (city/region/country) of visitors. This task is performed automatically. If the geolocation DB is not loaded or updated, you may need to trigger it manually to find the error which is causing it.', 'matomo' ); ?>"
218 value="<?php esc_html_e( 'Install/Update Geo-IP DB', 'matomo' ); ?>">
219 <br/><br/>
220
221 <?php if ( ! $settings->is_network_enabled() || ! is_network_admin() ) { ?>
222 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_USERS ); ?>" type="submit"
223 class='button-primary'
224 title="<?php esc_attr_e( 'Users are synced automatically. If for some reason a user cannot access Matomo pages even though the user has the permission, then triggering a manual sync may help to fix this issue immediately or it may show which error prevents the automatic syncing.', 'matomo' ); ?>"
225 value="<?php esc_html_e( 'Sync users', 'matomo' ); ?>">
226 <br/><br/>
227 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_SITE ); ?>" type="submit"
228 class='button-primary'
229 title="<?php esc_attr_e( 'Sites / blogs are synced automatically. If for some reason Matomo is not showing up for a specific blog, then triggering a manual sync may help to fix this issue immediately or it may show which error prevents the automatic syncing.', 'matomo' ); ?>"
230 value="<?php esc_html_e( 'Sync site (blog)', 'matomo' ); ?>">
231 <br/><br/>
232 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_RUN_UPDATER ); ?>" type="submit"
233 class='button-primary'
234 title="<?php esc_attr_e( 'Force trigger a Matomo update in case it failed error', 'matomo' ); ?>"
235 value="<?php esc_attr_e( 'Run Updater', 'matomo' ); ?>">
236 <label for="matomo_troubleshooting_update_from">Run updates from version:</label>
237 <input id="matomo_troubleshooting_update_from"
238 type="text"
239 name="matomo_troubleshooting_update_from"
240 title="<?php esc_attr_e( 'Enter a version to re-run updates from, eg, "5.0.0".', 'matomo' ); ?>"
241 value="">
242 <br/><br/>
243 <?php } ?>
244 <?php if ( $settings->is_network_enabled() ) { ?>
245 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_ALL_USERS ); ?>" type="submit"
246 class='button-primary'
247 title="<?php esc_attr_e( 'Users are synced automatically. If for some reason a user cannot access Matomo pages even though the user has the permission, then triggering a manual sync may help to fix this issue immediately or it may show which error prevents the automatic syncing.', 'matomo' ); ?>"
248 value="<?php esc_attr_e( 'Sync all users across sites / blogs', 'matomo' ); ?>">
249 <br/><br/>
250 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_ALL_SITES ); ?>" type="submit"
251 title="<?php esc_attr_e( 'Sites / blogs are synced automatically. If for some reason Matomo is not showing up for a specific blog, then triggering a manual sync may help to fix this issue immediately or it may show which error prevents the automatic syncing.', 'matomo' ); ?>"
252 class='button-primary'
253 value="<?php esc_attr_e( 'Sync all sites (blogs)', 'matomo' ); ?>">
254 <br/><br/>
255 <?php } ?>
256 <input name="<?php echo esc_attr( SystemReport::REGENERATE_TRACKING_CODE ); ?>" type="submit"
257 class="button-primary"
258 title="<?php esc_attr_e( 'Force the cached tracking code to be regenerated. The tracking code is usually regenerated on update and after changing tracking settings, or if a Matomo plugin is installed/updated, but if you need to do it manually, you can do it here.', 'matomo' ); ?>"
259 value="<?php esc_attr_e( 'Regenerate tracking code', 'matomo' ); ?>">
260 <br/>
261 <br/>
262
263 <input name="<?php echo esc_attr( SystemReport::RUN_SCHEDULED_TASK ); ?>" type="submit"
264 class="button-primary"
265 title="<?php esc_attr_e( 'Run a scheduled task by name.', 'matomo' ); ?>"
266 value="<?php esc_attr_e( 'Run scheduled task', 'matomo' ); ?>"
267 />
268 <label for="matomo_troubleshooting_run_task">Task to run:</label>
269 <select
270 id="matomo_troubleshooting_run_task"
271 name="matomo_troubleshooting_run_task"
272 title="<?php esc_attr_e( 'Pick a task to run', 'matomo' ); ?>"
273 >
274 <?php foreach ( $matomo_scheduled_tasks as $matomo_task ) { ?>
275 <option value="<?php echo esc_attr( $matomo_task ); ?>"><?php echo esc_html( $matomo_task ); ?></option>
276 <?php } ?>
277 </select>
278 <br/>
279 <br/>
280 </form>
281
282 <?php
283 $show_troubleshooting_link = false;
284 include 'info_help.php';
285 ?>
286 <h3><?php esc_html_e( 'Popular Troubleshooting FAQs', 'matomo' ); ?></h3>
287 <ul class="matomo-list">
288 <li>
289 <a href="https://matomo.org/faq/wordpress/matomo-for-wordpress-is-not-showing-any-statistics-not-archiving-how-do-i-fix-it/"
290 target="_blank"
291 rel="noreferrer noopener"><?php esc_html_e( 'Matomo is not showing any statistics / reports, how do I fix it?', 'matomo' ); ?></a>
292 </li>
293 <li><a href="https://matomo.org/faq/wordpress/i-cannot-open-backend-page-how-do-i-troubleshoot-it/"
294 target="_blank"
295 rel="noreferrer noopener"><?php esc_html_e( 'I cannot open the Matomo Reporting, Admin, or Tag Manager page, how do I troubleshoot it?', 'matomo' ); ?></a>
296 </li>
297 <li><a href="https://matomo.org/faq/wordpress/i-have-a-problem-how-do-i-troubleshoot-and-enable-wp_debug/"
298 target="_blank"
299 rel="noreferrer noopener"><?php esc_html_e( 'I have an issue with the plugin, how do I troubleshoot and enable debug mode?', 'matomo' ); ?></a>
300 </li>
301 <li><a href="https://matomo.org/faq/wordpress/how-do-i-manually-delete-all-matomo-for-wordpress-data/"
302 target="_blank"
303 rel="noreferrer noopener"><?php esc_html_e( 'How do I manually delete or reset all Matomo for WordPress data?', 'matomo' ); ?></a>
304 </li>
305 <li><a href="https://matomo.org/faq/wordpress/" target="_blank"
306 rel="noreferrer noopener"><?php esc_html_e( 'View all FAQs', 'matomo' ); ?></a></li>
307 </ul>
308 <?php include 'info_bug_report.php'; ?>
309 <h4><?php esc_html_e( 'Before you create an issue', 'matomo' ); ?></h4>
310 <p><?php esc_html_e( 'If you experience any issue in Matomo, it is always a good idea to first check your webserver logs (if possible) for any errors.', 'matomo' ); ?>
311 <br/>
312 <?php echo sprintf( esc_html__( 'You may also want to enable %1$s.', 'matomo' ), '<a href="https://matomo.org/faq/wordpress/i-have-a-problem-how-do-i-troubleshoot-and-enable-wp_debug/" target="_blank" rel="noreferrer noopener"><code>WP_DEBUG</code></a>' ); ?>
313 <?php echo sprintf( esc_html__( 'To debug issues that happen in the background, for example report generation during a cronjob, you might also want to enable %1$s.', 'matomo' ), '<code>WP_DEBUG_LOG</code>' ); ?>
314
315 </p>
316 <h3><?php esc_html_e( 'Having performance issues?', 'matomo' ); ?></h3>
317 <p>
318 <?php
319 echo sprintf(
320 esc_html__( 'You may want to disable %1$s in your %2$s and set up an actual cronjob and %3$scheck out our recommended server sizing%4$s.', 'matomo' ),
321 '<code>DISABLE_WP_CRON</code>',
322 '<code>wp-config.php</code>',
323 '<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/requirements/#recommended-servers-sizing-cpu-ram-disks">',
324 '</a>'
325 );
326 ?>
327 </p>
328 <?php include 'info_high_traffic.php'; ?>
329 <?php } ?>
330 </div>
331