Changeset 3400945
- Timestamp:
- 11/22/2025 01:06:05 PM (4 months ago)
- Location:
- 404-solution
- Files:
-
- 14 edited
- 1 copied
-
tags/3.0.2 (copied) (copied from 404-solution/trunk)
-
tags/3.0.2/404-solution.php (modified) (2 diffs)
-
tags/3.0.2/CHANGELOG.md (modified) (1 diff)
-
tags/3.0.2/README.md (modified) (1 diff)
-
tags/3.0.2/includes/DatabaseUpgradesEtc.php (modified) (2 diffs)
-
tags/3.0.2/includes/Loader.php (modified) (1 diff)
-
tags/3.0.2/includes/Uninstaller.php (modified) (1 diff)
-
tags/3.0.2/readme.txt (modified) (2 diffs)
-
trunk/404-solution.php (modified) (2 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/includes/DatabaseUpgradesEtc.php (modified) (2 diffs)
-
trunk/includes/Loader.php (modified) (1 diff)
-
trunk/includes/Uninstaller.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
404-solution/tags/3.0.2/404-solution.php
r3400707 r3400945 8 8 Author URI: https://www.ajexperience.com/404-solution/ 9 9 10 Version: 3.0. 110 Version: 3.0.2 11 11 Requires at least: 5.0 12 12 Requires PHP: 7.4 … … 222 222 $abj404dao->deleteOldRedirectsCron(); 223 223 224 // Ngram cache maintenance: sync missing entries and cleanup orphaned ones225 224 $dbUpgrades = ABJ_404_Solution_DatabaseUpgradesEtc::getInstance(); 226 $dbUpgrades->syncMissingNGrams(); 227 $dbUpgrades->cleanupOrphanedNGrams(); 228 229 // Clean up expired rate limit transients to prevent wp_options bloat 230 $dbUpgrades->cleanupExpiredRateLimitTransients(); 225 $dbUpgrades->runDatabaseMaintenanceTasks(); 231 226 } 232 227 function abj404_updateLogsHitsTableListener() { -
404-solution/tags/3.0.2/CHANGELOG.md
r3400707 r3400945 1 1 # Changelog # 2 3 ## Version 3.0.2 (Nov 22, 2025) ## 4 * FIX: Table creation issues on multisite. (Thanks to debug file participants!) 2 5 3 6 ## Version 3.0.1 (Nov 20, 2025) ## -
404-solution/tags/3.0.2/README.md
r3400707 r3400945 81 81 ## Changelog ## 82 82 83 ## Version 3.0.2 (Nov 22, 2025) ## 84 * FIX: Table creation issues on multisite. (Thanks to debug file participants!) 85 83 86 ## Version 3.0.1 (Nov 20, 2025) ## 84 87 * Improvement: Use accordions on the settings screen instead of chips. -
404-solution/tags/3.0.2/includes/DatabaseUpgradesEtc.php
r3400707 r3400945 1942 1942 1943 1943 /** 1944 * Daily insurance check: verify tables exist and repair if needed. 1945 * 1946 * This is a safety net that runs during daily maintenance to catch: 1947 * - Failed table creation during activation/upgrade 1948 * - Database corruption or manual table deletions 1949 * - Edge cases we haven't anticipated 1950 * 1951 * Behavior: 1952 * - Verifies CURRENT site only (per-site cron execution) 1953 * - In multisite networks, each site's cron verifies its own tables 1954 * - This avoids O(N²) performance when N sites each loop through N sites 1955 * 1956 * The check is lightweight (6 SHOW TABLES queries) and the repair 1957 * reuses the same idempotent table creation logic used during activation. 1958 * 1959 * @return void 1960 */ 1961 public function runDailyInsuranceCheck() { 1962 // Always verify current site only 1963 // Per-site cron execution ensures network coverage without O(N²) duplication 1964 $this->verifyAndRepairCurrentSite(); 1965 } 1966 1967 /** 1968 * Verify and repair tables for the current site only. 1969 * 1970 * Checks all 6 required tables for the plugin: 1971 * - abj404_redirects (redirect rules) 1972 * - abj404_logsv2 (404 hits and redirect logs) 1973 * - abj404_lookup (user/location lookups) 1974 * - abj404_permalink_cache (performance cache) 1975 * - abj404_spelling_cache (spell-check results cache) 1976 * - abj404_ngram_cache (n-gram search cache) 1977 * 1978 * If ANY table is missing, triggers full table creation/repair. 1979 * 1980 * @return void 1981 */ 1982 private function verifyAndRepairCurrentSite() { 1983 global $wpdb; 1984 1985 // Define all required tables 1986 $requiredTables = [ 1987 'abj404_redirects', 1988 'abj404_logsv2', 1989 'abj404_lookup', 1990 'abj404_permalink_cache', 1991 'abj404_spelling_cache', 1992 'abj404_ngram_cache', 1993 ]; 1994 1995 $missingTables = []; 1996 1997 // Check each required table 1998 foreach ($requiredTables as $tableName) { 1999 $fullTableName = $wpdb->prefix . $tableName; 2000 $tableExists = $wpdb->get_var("SHOW TABLES LIKE '{$fullTableName}'"); 2001 2002 if (!$tableExists) { 2003 $missingTables[] = $tableName; 2004 } 2005 } 2006 2007 // If any tables are missing, run repair 2008 if (!empty($missingTables)) { 2009 $this->logger->infoMessage(sprintf( 2010 "Site %d (prefix: %s) is missing %d table(s): %s. Running repair...", 2011 get_current_blog_id(), 2012 $wpdb->prefix, 2013 count($missingTables), 2014 implode(', ', $missingTables) 2015 )); 2016 2017 // Repair: call the same idempotent routine activation uses 2018 // This is safe because createDatabaseTables() is idempotent 2019 $this->createDatabaseTables(false); // false = not updating to new version 2020 2021 $this->logger->infoMessage("Table repair complete for site " . get_current_blog_id()); 2022 } 2023 } 2024 2025 /** 1944 2026 * Clean up expired rate limit transients from wp_options table. 1945 2027 * … … 2009 2091 2010 2092 /** 2093 * Run all database maintenance tasks. 2094 * 2095 * This is the main orchestrator method called by the daily maintenance cron job. 2096 * It coordinates all database-related maintenance tasks in the proper order. 2097 * 2098 * Called by: abj404_dailyMaintenanceCronJobListener() in 404-solution.php 2099 * 2100 * @return void 2101 */ 2102 public function runDatabaseMaintenanceTasks() { 2103 // Insurance: Verify tables exist (per-site or network-wide based on activation mode) 2104 // This catches failed activations, database corruption, and edge cases 2105 $this->runDailyInsuranceCheck(); 2106 2107 // Ngram cache maintenance: sync missing entries and cleanup orphaned ones 2108 $this->syncMissingNGrams(); 2109 $this->cleanupOrphanedNGrams(); 2110 2111 // Clean up expired rate limit transients to prevent wp_options bloat 2112 $this->cleanupExpiredRateLimitTransients(); 2113 } 2114 2115 /** 2011 2116 * Build ngrams for all categories. 2012 2117 * Should be called during initial setup or manual rebuild. -
404-solution/tags/3.0.2/includes/Loader.php
r3400707 r3400945 11 11 basename(dirname(ABJ404_FILE)) . '/' . basename(ABJ404_FILE)); 12 12 13 define( 'ABJ404_VERSION', '3.0. 1' );13 define( 'ABJ404_VERSION', '3.0.2' ); 14 14 define( 'URL_TRACKING_SUFFIX', '?utm_source=404SolutionPlugin&utm_medium=WordPress'); 15 15 define( 'ABJ404_HOME_URL', 'https://www.ajexperience.com/404-solution/' . URL_TRACKING_SUFFIX); -
404-solution/tags/3.0.2/includes/Uninstaller.php
r3400707 r3400945 225 225 $message .= "WordPress Version: " . get_bloginfo('version') . "\n"; 226 226 $message .= "PHP Version: " . PHP_VERSION . "\n"; 227 $message .= "Plugin Version: 3.0. 1\n";227 $message .= "Plugin Version: 3.0.2\n"; 228 228 $message .= "Site URL: " . get_site_url() . "\n"; 229 229 $message .= "Site Language: " . get_locale() . "\n"; -
404-solution/tags/3.0.2/readme.txt
r3400707 r3400945 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.8 8 Stable tag: 3.0. 18 Stable tag: 3.0.2 9 9 License: GPL-3.0-or-later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 240 240 == Changelog == 241 241 242 = Version 3.0.2 (Nov 22, 2025) = 243 * FIX: Table creation issues on multisite. (Thanks to debug file participants!) 244 242 245 = Version 3.0.1 (Nov 20, 2025) = 243 246 * Improvement: Use accordions on the settings screen instead of chips. -
404-solution/trunk/404-solution.php
r3400707 r3400945 8 8 Author URI: https://www.ajexperience.com/404-solution/ 9 9 10 Version: 3.0. 110 Version: 3.0.2 11 11 Requires at least: 5.0 12 12 Requires PHP: 7.4 … … 222 222 $abj404dao->deleteOldRedirectsCron(); 223 223 224 // Ngram cache maintenance: sync missing entries and cleanup orphaned ones225 224 $dbUpgrades = ABJ_404_Solution_DatabaseUpgradesEtc::getInstance(); 226 $dbUpgrades->syncMissingNGrams(); 227 $dbUpgrades->cleanupOrphanedNGrams(); 228 229 // Clean up expired rate limit transients to prevent wp_options bloat 230 $dbUpgrades->cleanupExpiredRateLimitTransients(); 225 $dbUpgrades->runDatabaseMaintenanceTasks(); 231 226 } 232 227 function abj404_updateLogsHitsTableListener() { -
404-solution/trunk/CHANGELOG.md
r3400707 r3400945 1 1 # Changelog # 2 3 ## Version 3.0.2 (Nov 22, 2025) ## 4 * FIX: Table creation issues on multisite. (Thanks to debug file participants!) 2 5 3 6 ## Version 3.0.1 (Nov 20, 2025) ## -
404-solution/trunk/README.md
r3400707 r3400945 81 81 ## Changelog ## 82 82 83 ## Version 3.0.2 (Nov 22, 2025) ## 84 * FIX: Table creation issues on multisite. (Thanks to debug file participants!) 85 83 86 ## Version 3.0.1 (Nov 20, 2025) ## 84 87 * Improvement: Use accordions on the settings screen instead of chips. -
404-solution/trunk/includes/DatabaseUpgradesEtc.php
r3400707 r3400945 1942 1942 1943 1943 /** 1944 * Daily insurance check: verify tables exist and repair if needed. 1945 * 1946 * This is a safety net that runs during daily maintenance to catch: 1947 * - Failed table creation during activation/upgrade 1948 * - Database corruption or manual table deletions 1949 * - Edge cases we haven't anticipated 1950 * 1951 * Behavior: 1952 * - Verifies CURRENT site only (per-site cron execution) 1953 * - In multisite networks, each site's cron verifies its own tables 1954 * - This avoids O(N²) performance when N sites each loop through N sites 1955 * 1956 * The check is lightweight (6 SHOW TABLES queries) and the repair 1957 * reuses the same idempotent table creation logic used during activation. 1958 * 1959 * @return void 1960 */ 1961 public function runDailyInsuranceCheck() { 1962 // Always verify current site only 1963 // Per-site cron execution ensures network coverage without O(N²) duplication 1964 $this->verifyAndRepairCurrentSite(); 1965 } 1966 1967 /** 1968 * Verify and repair tables for the current site only. 1969 * 1970 * Checks all 6 required tables for the plugin: 1971 * - abj404_redirects (redirect rules) 1972 * - abj404_logsv2 (404 hits and redirect logs) 1973 * - abj404_lookup (user/location lookups) 1974 * - abj404_permalink_cache (performance cache) 1975 * - abj404_spelling_cache (spell-check results cache) 1976 * - abj404_ngram_cache (n-gram search cache) 1977 * 1978 * If ANY table is missing, triggers full table creation/repair. 1979 * 1980 * @return void 1981 */ 1982 private function verifyAndRepairCurrentSite() { 1983 global $wpdb; 1984 1985 // Define all required tables 1986 $requiredTables = [ 1987 'abj404_redirects', 1988 'abj404_logsv2', 1989 'abj404_lookup', 1990 'abj404_permalink_cache', 1991 'abj404_spelling_cache', 1992 'abj404_ngram_cache', 1993 ]; 1994 1995 $missingTables = []; 1996 1997 // Check each required table 1998 foreach ($requiredTables as $tableName) { 1999 $fullTableName = $wpdb->prefix . $tableName; 2000 $tableExists = $wpdb->get_var("SHOW TABLES LIKE '{$fullTableName}'"); 2001 2002 if (!$tableExists) { 2003 $missingTables[] = $tableName; 2004 } 2005 } 2006 2007 // If any tables are missing, run repair 2008 if (!empty($missingTables)) { 2009 $this->logger->infoMessage(sprintf( 2010 "Site %d (prefix: %s) is missing %d table(s): %s. Running repair...", 2011 get_current_blog_id(), 2012 $wpdb->prefix, 2013 count($missingTables), 2014 implode(', ', $missingTables) 2015 )); 2016 2017 // Repair: call the same idempotent routine activation uses 2018 // This is safe because createDatabaseTables() is idempotent 2019 $this->createDatabaseTables(false); // false = not updating to new version 2020 2021 $this->logger->infoMessage("Table repair complete for site " . get_current_blog_id()); 2022 } 2023 } 2024 2025 /** 1944 2026 * Clean up expired rate limit transients from wp_options table. 1945 2027 * … … 2009 2091 2010 2092 /** 2093 * Run all database maintenance tasks. 2094 * 2095 * This is the main orchestrator method called by the daily maintenance cron job. 2096 * It coordinates all database-related maintenance tasks in the proper order. 2097 * 2098 * Called by: abj404_dailyMaintenanceCronJobListener() in 404-solution.php 2099 * 2100 * @return void 2101 */ 2102 public function runDatabaseMaintenanceTasks() { 2103 // Insurance: Verify tables exist (per-site or network-wide based on activation mode) 2104 // This catches failed activations, database corruption, and edge cases 2105 $this->runDailyInsuranceCheck(); 2106 2107 // Ngram cache maintenance: sync missing entries and cleanup orphaned ones 2108 $this->syncMissingNGrams(); 2109 $this->cleanupOrphanedNGrams(); 2110 2111 // Clean up expired rate limit transients to prevent wp_options bloat 2112 $this->cleanupExpiredRateLimitTransients(); 2113 } 2114 2115 /** 2011 2116 * Build ngrams for all categories. 2012 2117 * Should be called during initial setup or manual rebuild. -
404-solution/trunk/includes/Loader.php
r3400707 r3400945 11 11 basename(dirname(ABJ404_FILE)) . '/' . basename(ABJ404_FILE)); 12 12 13 define( 'ABJ404_VERSION', '3.0. 1' );13 define( 'ABJ404_VERSION', '3.0.2' ); 14 14 define( 'URL_TRACKING_SUFFIX', '?utm_source=404SolutionPlugin&utm_medium=WordPress'); 15 15 define( 'ABJ404_HOME_URL', 'https://www.ajexperience.com/404-solution/' . URL_TRACKING_SUFFIX); -
404-solution/trunk/includes/Uninstaller.php
r3400707 r3400945 225 225 $message .= "WordPress Version: " . get_bloginfo('version') . "\n"; 226 226 $message .= "PHP Version: " . PHP_VERSION . "\n"; 227 $message .= "Plugin Version: 3.0. 1\n";227 $message .= "Plugin Version: 3.0.2\n"; 228 228 $message .= "Site URL: " . get_site_url() . "\n"; 229 229 $message .= "Site Language: " . get_locale() . "\n"; -
404-solution/trunk/readme.txt
r3400707 r3400945 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.8 8 Stable tag: 3.0. 18 Stable tag: 3.0.2 9 9 License: GPL-3.0-or-later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 240 240 == Changelog == 241 241 242 = Version 3.0.2 (Nov 22, 2025) = 243 * FIX: Table creation issues on multisite. (Thanks to debug file participants!) 244 242 245 = Version 3.0.1 (Nov 20, 2025) = 243 246 * Improvement: Use accordions on the settings screen instead of chips.
Note: See TracChangeset
for help on using the changeset viewer.