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