PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 4.14.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v4.14.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 4 years ago advanced_settings.php 4 years ago exclusion_settings.php 4 years ago geolocation_settings.php 4 years ago get_started.php 4 years ago import_wp_statistics.php 4 years ago info.php 4 years ago info_bug_report.php 4 years ago info_help.php 4 years ago info_high_traffic.php 4 years ago info_multisite.php 4 years ago info_newsletter.php 4 years ago info_shared.php 4 years ago marketplace.php 4 years ago privacy_gdpr.php 4 years ago settings.php 4 years ago settings_errors.php 4 years ago summary.php 4 years ago systemreport.php 3 years ago tracking.php 3 years ago update_notice_clear_cache.php 5 years ago
systemreport.php
281 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 type="text/css">
18 .matomo-systemreport 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><tr><th colspan="3" class="section">' . esc_html( $matomo_row['section'] ) . '</th></tr></thead><tbody>';
133 continue;
134 }
135 $matomo_value = $matomo_row['value'];
136 if ( true === $matomo_value ) {
137 $matomo_value = esc_html__( 'Yes', 'matomo' );
138 } elseif ( false === $matomo_value ) {
139 $matomo_value = esc_html__( 'No', 'matomo' );
140 }
141 $matomo_class = '';
142 if ( ! empty( $matomo_row['is_error'] ) ) {
143 $matomo_class = 'error';
144 } elseif ( ! empty( $matomo_row['is_warning'] ) ) {
145 $matomo_class = 'warning';
146 }
147 echo "<tr class='" . esc_attr( $matomo_class ) . "'>";
148 echo "<td width='30%'>" . esc_html( $matomo_row['name'] ) . '</td>';
149 echo "<td width='" . ( ! empty( $matomo_table['has_comments'] ) ? 20 : 70 ) . "%'>" . esc_html( $matomo_value ) . '</td>';
150 if ( ! empty( $matomo_table['has_comments'] ) ) {
151 $matomo_replaced_elements = [
152 '<code>' => '__#CODEBACKUP#__',
153 '</code>' => '__##CODEBACKUP##__',
154 '<pre style="overflow-x: scroll;max-width: 600px;">' => '__#PREBACKUP#__',
155 '</pre>' => '__##PREBACKUP##__',
156 '<br/>' => '__#BRBACKUP#__',
157 '<br />' => '__#BRBACKUP#__',
158 '<br>' => '__#BRBACKUP#__',
159 ];
160 $matomo_comment = isset( $matomo_row['comment'] ) ? $matomo_row['comment'] : '';
161 $matomo_replaced = str_replace( array_keys( $matomo_replaced_elements ), array_values( $matomo_replaced_elements ), $matomo_comment );
162 // 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.
163 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
164 echo "<td width='50%' class='matomo-systemreport-comment'>" . str_replace( array_values( $matomo_replaced_elements ), array_keys( $matomo_replaced_elements ), $matomo_replaced ) . '</td>';
165 }
166
167 echo '</tr>';
168 }
169 echo '</tbody></table>';
170 }
171 ?>
172
173 <?php } else { ?>
174 <h1><?php esc_html_e( 'Troubleshooting', 'matomo' ); ?></h1>
175
176 <form method="post">
177 <?php wp_nonce_field( SystemReport::NONCE_NAME ); ?>
178
179 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_ARCHIVE_NOW ); ?>" type="submit"
180 class='button-primary'
181 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' ); ?>"
182 value="<?php esc_html_e( 'Archive reports', 'matomo' ); ?>">
183 <br/><br/>
184 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_CLEAR_MATOMO_CACHE ); ?>" type="submit"
185 class='button-primary'
186 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' ); ?>"
187 value="<?php esc_html_e( 'Clear Matomo cache', 'matomo' ); ?>">
188 <br/><br/>
189 <?php if ( ! empty( $matomo_has_exception_logs ) ) { ?>
190 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_CLEAR_LOGS ); ?>" type="submit"
191 class='button-primary'
192 title="<?php esc_attr_e( 'Removes all stored Matomo logs that are shown in the system report', 'matomo' ); ?>"
193 value="<?php esc_html_e( 'Clear system report logs', 'matomo' ); ?>">
194 <br/><br/>
195 <?php } ?>
196
197 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_UPDATE_GEOIP_DB ); ?>" type="submit"
198 class='button-primary'
199 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' ); ?>"
200 value="<?php esc_html_e( 'Install/Update Geo-IP DB', 'matomo' ); ?>">
201 <br/><br/>
202
203 <?php if ( ! $settings->is_network_enabled() || ! is_network_admin() ) { ?>
204 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_USERS ); ?>" type="submit"
205 class='button-primary'
206 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' ); ?>"
207 value="<?php esc_html_e( 'Sync users', 'matomo' ); ?>">
208 <br/><br/>
209 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_SITE ); ?>" type="submit"
210 class='button-primary'
211 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' ); ?>"
212 value="<?php esc_html_e( 'Sync site (blog)', 'matomo' ); ?>">
213 <br/><br/>
214 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_RUN_UPDATER ); ?>" type="submit"
215 class='button-primary'
216 title="<?php esc_attr_e( 'Force trigger a Matomo update in case it failed error', 'matomo' ); ?>"
217 value="<?php esc_html_e( 'Run Updater', 'matomo' ); ?>">
218 <?php } ?>
219 <?php if ( $settings->is_network_enabled() ) { ?>
220 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_ALL_USERS ); ?>" type="submit"
221 class='button-primary'
222 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' ); ?>"
223 value="<?php esc_html_e( 'Sync all users across sites / blogs', 'matomo' ); ?>">
224 <br/><br/>
225 <input name="<?php echo esc_attr( SystemReport::TROUBLESHOOT_SYNC_ALL_SITES ); ?>" type="submit"
226 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' ); ?>"
227 class='button-primary'
228 value="<?php esc_html_e( 'Sync all sites (blogs)', 'matomo' ); ?>">
229 <?php } ?>
230 </form>
231
232 <?php
233 $show_troubleshooting_link = false;
234 include 'info_help.php';
235 ?>
236 <h3><?php esc_html_e( 'Popular Troubleshooting FAQs', 'matomo' ); ?></h3>
237 <ul class="matomo-list">
238 <li>
239 <a href="https://matomo.org/faq/wordpress/matomo-for-wordpress-is-not-showing-any-statistics-not-archiving-how-do-i-fix-it/"
240 target="_blank"
241 rel="noreferrer noopener"><?php esc_html_e( 'Matomo is not showing any statistics / reports, how do I fix it?', 'matomo' ); ?></a>
242 </li>
243 <li><a href="https://matomo.org/faq/wordpress/i-cannot-open-backend-page-how-do-i-troubleshoot-it/"
244 target="_blank"
245 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>
246 </li>
247 <li><a href="https://matomo.org/faq/wordpress/i-have-a-problem-how-do-i-troubleshoot-and-enable-wp_debug/"
248 target="_blank"
249 rel="noreferrer noopener"><?php esc_html_e( 'I have an issue with the plugin, how do I troubleshoot and enable debug mode?', 'matomo' ); ?></a>
250 </li>
251 <li><a href="https://matomo.org/faq/wordpress/how-do-i-manually-delete-all-matomo-for-wordpress-data/"
252 target="_blank"
253 rel="noreferrer noopener"><?php esc_html_e( 'How do I manually delete or reset all Matomo for WordPress data?', 'matomo' ); ?></a>
254 </li>
255 <li><a href="https://matomo.org/faq/wordpress/" target="_blank"
256 rel="noreferrer noopener"><?php esc_html_e( 'View all FAQs', 'matomo' ); ?></a></li>
257 </ul>
258 <?php include 'info_bug_report.php'; ?>
259 <h4><?php esc_html_e( 'Before you create an issue', 'matomo' ); ?></h4>
260 <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' ); ?>
261 <br/>
262 <?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>' ); ?>
263 <?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>' ); ?>
264
265 </p>
266 <h3><?php esc_html_e( 'Having performance issues?', 'matomo' ); ?></h3>
267 <p>
268 <?php
269 echo sprintf(
270 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' ),
271 '<code>DISABLE_WP_CRON</code>',
272 '<code>wp-config.php</code>',
273 '<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/requirements/#recommended-servers-sizing-cpu-ram-disks">',
274 '</a>'
275 );
276 ?>
277 </p>
278 <?php include 'info_high_traffic.php'; ?>
279 <?php } ?>
280 </div>
281