PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.0.7
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.0.7
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 2 years ago advanced_settings.php 2 years ago exclusion_settings.php 4 years ago geolocation_settings.php 2 years ago get_started.php 4 years ago import_wp_statistics.php 4 years ago info.php 4 years ago info_bug_report.php 2 years ago info_help.php 4 years ago info_high_traffic.php 2 years ago info_multisite.php 2 years ago info_newsletter.php 4 years ago info_shared.php 4 years ago marketplace.php 2 years ago marketplace_setup_wizard.php 2 years ago measurable_settings.php 2 years ago privacy_gdpr.php 4 years ago scheduled_tasks_failures.php 2 years ago settings.php 4 years ago settings_errors.php 4 years ago summary.php 4 years ago systemreport.php 2 years ago tracking.php 3 years ago update_notice_clear_cache.php 5 years ago
systemreport.php
282 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 string $matomo_active_tab */
33 /** @var \WpMatomo\Settings $settings */
34
35 if ( ! function_exists( 'matomo_format_value_text' ) ) {
36 function matomo_format_value_text( $value ) {
37 if ( is_string( $value ) && ! empty( $value ) ) {
38 $matomo_format = [
39 '<br />' => ' ',
40 '<br/>' => ' ',
41 '<br>' => ' ',
42 ];
43 foreach ( $matomo_format as $search => $replace ) {
44 $value = str_replace( $search, $replace, $value );
45 }
46 }
47
48 return $value;
49 }
50 }
51 ?>
52
53 <div class="wrap matomo-systemreport">
54 <?php
55 if ( $matomo_has_warning_and_no_errors ) {
56 ?>
57 <div class="notice notice-warning">
58 <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>
59 </div>
60 <?php
61 }
62 ?>
63 <?php if ( $settings->is_network_enabled() && ! is_network_admin() && is_super_admin() ) { ?>
64 <div class="updated notice">
65 <p><?php esc_html_e( 'Only you are seeing this page as you are the super admin', 'matomo' ); ?></p>
66 </div>
67 <?php } ?>
68 <div id="icon-plugins" class="icon32"></div>
69 <h1><?php matomo_header_icon(); ?><?php esc_html_e( 'Diagnostics', 'matomo' ); ?></h1>
70
71 <h2 class="nav-tab-wrapper">
72 <a href="?page=<?php echo esc_attr( Menu::SLUG_SYSTEM_REPORT ); ?>"
73 class="nav-tab <?php echo empty( $matomo_active_tab ) ? 'nav-tab-active' : ''; ?>"> System report</a>
74 <a href="?page=<?php echo esc_attr( Menu::SLUG_SYSTEM_REPORT ); ?>&tab=troubleshooting"
75 class="nav-tab <?php echo 'troubleshooting' === $matomo_active_tab ? 'nav-tab-active' : ''; ?>">Troubleshooting</a>
76 </h2>
77
78 <?php if ( empty( $matomo_active_tab ) ) { ?>
79
80 <p><?php esc_html_e( 'Copy the below info in case our support team asks you for this information:', 'matomo' ); ?>
81 <br/> <br/>
82 <a href="javascript:void(0);"
83 onclick="var textarea = document.getElementById('matomo_system_report_info');textarea.select();document.execCommand('copy');"
84 class='button-primary'><?php esc_html_e( 'Copy system report', 'matomo' ); ?></a>
85
86 </p>
87 <textarea style="width:100%;height: 200px;" readonly
88 id="matomo_system_report_info">
89 <?php
90 foreach ( $matomo_tables as $matomo_table ) {
91 if ( empty( $matomo_table['rows'] ) ) {
92 continue;
93 }
94 echo '# ' . esc_html( $matomo_table['title'] ) . "\n";
95 foreach ( $matomo_table['rows'] as $index => $matomo_row ) {
96 if ( ! empty( $matomo_row['section'] ) ) {
97 echo "\n\n## " . esc_html( $matomo_row['section'] ) . "\n";
98 continue;
99 }
100 $matomo_value = $matomo_row['value'];
101 if ( true === $matomo_value ) {
102 $matomo_value = 'Yes';
103 } elseif ( false === $matomo_value ) {
104 $matomo_value = 'No';
105 }
106 $matomo_class = '';
107 if ( ! empty( $matomo_row['is_error'] ) ) {
108 $matomo_class = 'Error ';
109 } elseif ( ! empty( $matomo_row['is_warning'] ) ) {
110 $matomo_class = 'Warning ';
111 }
112 echo "\n* " . esc_html( $matomo_class ) . esc_html( $matomo_row['name'] ) . ': ' . esc_html( matomo_anonymize_value( matomo_format_value_text( $matomo_value ) ) );
113 if ( isset( $matomo_row['comment'] ) && '' !== $matomo_row['comment'] ) {
114 // We want to add links in the comments
115 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
116 echo ' (' . matomo_anonymize_value( matomo_format_value_text( $matomo_row['comment'] ) ) . ')';
117 }
118 }
119 echo "\n\n";
120 }
121 ?>
122 </textarea>
123
124 <?php
125 foreach ( $matomo_tables as $matomo_table ) {
126 if ( empty( $matomo_table['rows'] ) ) {
127 continue;
128 }
129 echo '<h2>' . esc_html( $matomo_table['title'] ) . "</h2><table class='widefat'><thead></thead><tbody>";
130 foreach ( $matomo_table['rows'] as $matomo_row ) {
131 if ( ! empty( $matomo_row['section'] ) ) {
132 echo '</tbody><thead id="' . esc_attr( preg_replace( '/[^a-zA-Z0-9_-]/', '', strtolower( $matomo_row['section'] ) ) )
133 . '"><tr><th colspan="3" class="section">' . esc_html( $matomo_row['section'] ) . '</th></tr></thead><tbody>';
134 continue;
135 }
136 $matomo_value = $matomo_row['value'];
137 if ( true === $matomo_value ) {
138 $matomo_value = esc_html__( 'Yes', 'matomo' );
139 } elseif ( false === $matomo_value ) {
140 $matomo_value = esc_html__( 'No', 'matomo' );
141 }
142 $matomo_class = '';
143 if ( ! empty( $matomo_row['is_error'] ) ) {
144 $matomo_class = 'error';
145 } elseif ( ! empty( $matomo_row['is_warning'] ) ) {
146 $matomo_class = 'warning';
147 }
148 echo "<tr class='" . esc_attr( $matomo_class ) . "'>";
149 echo "<td width='30%'>" . esc_html( $matomo_row['name'] ) . '</td>';
150 echo "<td width='" . ( ! empty( $matomo_table['has_comments'] ) ? 20 : 70 ) . "%'>" . esc_html( $matomo_value ) . '</td>';
151 if ( ! empty( $matomo_table['has_comments'] ) ) {
152 $matomo_replaced_elements = [
153 '<code>' => '__#CODEBACKUP#__',
154 '</code>' => '__##CODEBACKUP##__',
155 '<pre style="overflow-x: scroll;max-width: 600px;">' => '__#PREBACKUP#__',
156 '</pre>' => '__##PREBACKUP##__',
157 '<br/>' => '__#BRBACKUP#__',
158 '<br />' => '__#BRBACKUP#__',
159 '<br>' => '__#BRBACKUP#__',
160 ];
161 $matomo_comment = isset( $matomo_row['comment'] ) ? $matomo_row['comment'] : '';
162 $matomo_replaced = str_replace( array_keys( $matomo_replaced_elements ), array_values( $matomo_replaced_elements ), $matomo_comment );
163 // 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.
164 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
165 echo "<td width='50%' class='matomo-systemreport-comment'>" . str_replace( array_values( $matomo_replaced_elements ), array_keys( $matomo_replaced_elements ), $matomo_replaced ) . '</td>';
166 }
167
168 echo '</tr>';
169 }
170 echo '</tbody></table>';
171 }
172 ?>
173
174 <?php } else { ?>
175 <h1><?php esc_html_e( 'Troubleshooting', 'matomo' ); ?></h1>
176
177 <form method="post">
178 <?php wp_nonce_field( SystemReport::NONCE_NAME ); ?>
179
180 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_ARCHIVE_NOW ); ?>" type="submit"
181 class='button-primary'
182 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' ); ?>"
183 value="<?php esc_html_e( 'Archive reports', 'matomo' ); ?>">
184 <br/><br/>
185 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_CLEAR_MATOMO_CACHE ); ?>" type="submit"
186 class='button-primary'
187 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' ); ?>"
188 value="<?php esc_html_e( 'Clear Matomo cache', 'matomo' ); ?>">
189 <br/><br/>
190 <?php if ( ! empty( $matomo_has_exception_logs ) ) { ?>
191 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_CLEAR_LOGS ); ?>" type="submit"
192 class='button-primary'
193 title="<?php esc_attr_e( 'Removes all stored Matomo logs that are shown in the system report', 'matomo' ); ?>"
194 value="<?php esc_html_e( 'Clear system report logs', 'matomo' ); ?>">
195 <br/><br/>
196 <?php } ?>
197
198 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_UPDATE_GEOIP_DB ); ?>" type="submit"
199 class='button-primary'
200 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' ); ?>"
201 value="<?php esc_html_e( 'Install/Update Geo-IP DB', 'matomo' ); ?>">
202 <br/><br/>
203
204 <?php if ( ! $settings->is_network_enabled() || ! is_network_admin() ) { ?>
205 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_USERS ); ?>" type="submit"
206 class='button-primary'
207 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' ); ?>"
208 value="<?php esc_html_e( 'Sync users', 'matomo' ); ?>">
209 <br/><br/>
210 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_SITE ); ?>" type="submit"
211 class='button-primary'
212 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' ); ?>"
213 value="<?php esc_html_e( 'Sync site (blog)', 'matomo' ); ?>">
214 <br/><br/>
215 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_RUN_UPDATER ); ?>" type="submit"
216 class='button-primary'
217 title="<?php esc_attr_e( 'Force trigger a Matomo update in case it failed error', 'matomo' ); ?>"
218 value="<?php esc_html_e( 'Run Updater', 'matomo' ); ?>">
219 <?php } ?>
220 <?php if ( $settings->is_network_enabled() ) { ?>
221 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_ALL_USERS ); ?>" type="submit"
222 class='button-primary'
223 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' ); ?>"
224 value="<?php esc_html_e( 'Sync all users across sites / blogs', 'matomo' ); ?>">
225 <br/><br/>
226 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_ALL_SITES ); ?>" type="submit"
227 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' ); ?>"
228 class='button-primary'
229 value="<?php esc_html_e( 'Sync all sites (blogs)', 'matomo' ); ?>">
230 <?php } ?>
231 </form>
232
233 <?php
234 $show_troubleshooting_link = false;
235 include 'info_help.php';
236 ?>
237 <h3><?php esc_html_e( 'Popular Troubleshooting FAQs', 'matomo' ); ?></h3>
238 <ul class="matomo-list">
239 <li>
240 <a href="https://matomo.org/faq/wordpress/matomo-for-wordpress-is-not-showing-any-statistics-not-archiving-how-do-i-fix-it/"
241 target="_blank"
242 rel="noreferrer noopener"><?php esc_html_e( 'Matomo is not showing any statistics / reports, how do I fix it?', 'matomo' ); ?></a>
243 </li>
244 <li><a href="https://matomo.org/faq/wordpress/i-cannot-open-backend-page-how-do-i-troubleshoot-it/"
245 target="_blank"
246 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>
247 </li>
248 <li><a href="https://matomo.org/faq/wordpress/i-have-a-problem-how-do-i-troubleshoot-and-enable-wp_debug/"
249 target="_blank"
250 rel="noreferrer noopener"><?php esc_html_e( 'I have an issue with the plugin, how do I troubleshoot and enable debug mode?', 'matomo' ); ?></a>
251 </li>
252 <li><a href="https://matomo.org/faq/wordpress/how-do-i-manually-delete-all-matomo-for-wordpress-data/"
253 target="_blank"
254 rel="noreferrer noopener"><?php esc_html_e( 'How do I manually delete or reset all Matomo for WordPress data?', 'matomo' ); ?></a>
255 </li>
256 <li><a href="https://matomo.org/faq/wordpress/" target="_blank"
257 rel="noreferrer noopener"><?php esc_html_e( 'View all FAQs', 'matomo' ); ?></a></li>
258 </ul>
259 <?php include 'info_bug_report.php'; ?>
260 <h4><?php esc_html_e( 'Before you create an issue', 'matomo' ); ?></h4>
261 <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' ); ?>
262 <br/>
263 <?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>' ); ?>
264 <?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>' ); ?>
265
266 </p>
267 <h3><?php esc_html_e( 'Having performance issues?', 'matomo' ); ?></h3>
268 <p>
269 <?php
270 echo sprintf(
271 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' ),
272 '<code>DISABLE_WP_CRON</code>',
273 '<code>wp-config.php</code>',
274 '<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/requirements/#recommended-servers-sizing-cpu-ram-disks">',
275 '</a>'
276 );
277 ?>
278 </p>
279 <?php include 'info_high_traffic.php'; ?>
280 <?php } ?>
281 </div>
282