PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.1
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 / Db / Settings.php
matomo / classes / WpMatomo / Db Last commit date
Settings.php 6 years ago WordPress.php 6 years ago WordPressDbStatement.php 6 years ago WordPressTracker.php 6 years ago
Settings.php
97 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 namespace WpMatomo\Db;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // if accessed directly
14 }
15
16 class Settings {
17
18 /**
19 * This feature can be used to read data from matomo tables without needing to bootstrap matomo
20 *
21 * @param string $table_name_to_prefix
22 *
23 * @return string
24 * @api
25 */
26 public function prefix_table_name( $table_name_to_prefix ) {
27 global $wpdb;
28
29 return $wpdb->prefix . MATOMO_DATABASE_PREFIX . $table_name_to_prefix;
30 }
31
32 public function get_installed_matomo_tables() {
33 global $wpdb;
34
35 $table_names = array();
36 $tables = $wpdb->get_results( 'SHOW TABLES LIKE "' . $wpdb->prefix . str_replace( '_', '\_', MATOMO_DATABASE_PREFIX ) . '%"', ARRAY_N );
37 foreach ( $tables as $table_name_to_look_for ) {
38 $table_names[] = array_shift( $table_name_to_look_for );
39 }
40
41 // we need to hard code them unfortunately for tests cause there are temporary tables used and we can't find a
42 // list of existing temp tables
43 $table_names_to_look_for = array(
44 'access',
45 'brute_force_log',
46 'goal',
47 'locks',
48 'log_action',
49 'log_conversion',
50 'log_conversion_item',
51 'log_link_visit_action',
52 'log_profiling',
53 'log_visit',
54 'logger_message',
55 'option',
56 'plugin_setting',
57 'privacy_logdata_anonymizations',
58 'report',
59 'report_subscriptions',
60 'segment',
61 'sequence',
62 'session',
63 'site',
64 'site_setting',
65 'site_url',
66 'tagmanager_container',
67 'tagmanager_container_release',
68 'tagmanager_container_version',
69 'tagmanager_tag',
70 'tagmanager_trigger',
71 'tagmanager_variable',
72 'tracking_failure',
73 'twofactor_recovery_code',
74 'user',
75 'user_dashboard',
76 'user_language',
77 );
78 foreach ( range( 2010, gmdate( 'Y' ) + 1 ) as $year ) {
79 foreach ( range( 1, 12 ) as $month ) {
80 $table_names_to_look_for[] = 'archive_numeric_' . $year . '_' . str_pad( $month, 2, '0' );
81 $table_names_to_look_for[] = 'archive_blob_' . $year . '_' . str_pad( $month, 2, '0' );
82 }
83 }
84 $table_names_to_look_for = apply_filters( 'matomo_install_tables', $table_names_to_look_for );
85
86 foreach ( $table_names_to_look_for as $table_name_to_look_for ) {
87 $table_name_to_test = $this->prefix_table_name($table_name_to_look_for);
88 if ( ! in_array( $table_name_to_test, $table_names, true ) ) {
89 $table_names[] = $table_name_to_test;
90 }
91 }
92
93 return $table_names;
94 }
95
96 }
97