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