PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.1
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.1
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
← All changes | telemetry/telemetry-init.php +45 -11 2.6.9 → 2.7.1 View file →
@@ -14,14 +14,18 @@
14 14 if (!defined('WPINC')) {
15 15 die;
16 16 }
17 17
18 -// Class files are autoloaded by Composer. Procedural/side-effect files stay explicit.
19 -require_once plugin_dir_path(__FILE__) . 'sentry-wordpress-integration.php';
20 -require_once plugin_dir_path(__FILE__) . 'wordpress-error-handler.php';
21 -require_once plugin_dir_path(__FILE__) . 'sentry-helper.php';
18 +require_once plugin_dir_path(__FILE__) . 'privacy.php';
22 19
20 +// Side-effectful telemetry files must not load after either opt-out path.
21 +if (!metasync_telemetry_is_disabled()) {
22 + require_once plugin_dir_path(__FILE__) . 'sentry-wordpress-integration.php';
23 + require_once plugin_dir_path(__FILE__) . 'wordpress-error-handler.php';
24 + require_once plugin_dir_path(__FILE__) . 'sentry-helper.php';
25 +}
23 26
27 +
24 28 /**
25 29 * Initialize telemetry system
26 30 */
27 31 function init_metasync_telemetry() {
@@ -65,9 +69,9 @@
65 69 return; // Skip if memory was already determined to be unsafe
66 70 }
67 71
68 72 // Check if telemetry is explicitly disabled
69 - if (defined('METASYNC_DISABLE_TELEMETRY') && constant('METASYNC_DISABLE_TELEMETRY')) {
73 + if (metasync_telemetry_is_disabled()) {
70 74 return;
71 75 }
72 76
73 77 try {
@@ -108,22 +112,37 @@
108 112 // error_log('MetaSync Telemetry: Skipping manager initialization due to memory usage');
109 113 return;
110 114 }
111 115
112 - Metasync_Telemetry_Manager::get_instance();
116 + // Defensive load: this class is normally provided by the Composer
117 + // autoloader, but on some installs that can miss it at runtime (stale
118 + // OPcache after an update, or an autoloader collision with another
119 + // plugin). Load it explicitly so telemetry never fatals the page.
120 + if (!class_exists('Metasync_Telemetry_Manager')) {
121 + $manager_file = plugin_dir_path(__FILE__) . 'class-telemetry-manager.php';
122 + if (is_readable($manager_file)) {
123 + require_once $manager_file;
124 + }
125 + }
113 126
127 + if (class_exists('Metasync_Telemetry_Manager')) {
128 + Metasync_Telemetry_Manager::get_instance();
129 + }
130 +
114 131 // API request monitoring removed - creates excessive overhead
115 132 // Class kept for backward compatibility but not instantiated
116 133 // Already handled by log-sync.php
117 -
118 - } catch (Exception $e) {
119 - // Fail silently to prevent site crashes
134 +
135 + } catch (\Throwable $e) {
136 + // Fail silently to prevent site crashes. Catch \Throwable (not just
137 + // Exception) so PHP 7+ Errors — e.g. a "class not found" from a missed
138 + // autoload — are swallowed here instead of fataling the request.
120 139 // error_log('MetaSync Telemetry: Initialization failed: ' . $e->getMessage());
121 140 }
122 141 }
123 142
124 143 // Only initialize telemetry if not explicitly disabled
125 -if (!defined('METASYNC_DISABLE_TELEMETRY') || !constant('METASYNC_DISABLE_TELEMETRY')) {
144 +if (!metasync_telemetry_is_disabled()) {
126 145 // Add hook - memory check is now handled inside the function for efficiency
127 146 add_action('plugins_loaded', 'init_metasync_telemetry', 5);
128 147 }
129 148
@@ -129,11 +148,26 @@
129 148
130 149 /**
131 150 * Helper function to get telemetry manager instance
132 151 *
133 - * @return Metasync_Telemetry_Manager
152 + * @return Metasync_Telemetry_Manager|null Null when the class cannot be loaded.
134 153 */
135 154 function metasync_telemetry() {
155 + if (metasync_telemetry_is_disabled()) {
156 + return null;
157 + }
158 +
159 + if (!class_exists('Metasync_Telemetry_Manager')) {
160 + $manager_file = plugin_dir_path(__FILE__) . 'class-telemetry-manager.php';
161 + if (is_readable($manager_file)) {
162 + require_once $manager_file;
163 + }
164 + }
165 +
166 + if (!class_exists('Metasync_Telemetry_Manager')) {
167 + return null;
168 + }
169 +
136 170 return Metasync_Telemetry_Manager::get_instance();
137 171 }
138 172
139 173 /**