Changeset 3748520
- Timestamp:
- 10/15/2026 12:56:36 PM (3 weeks ago)
- Location:
- aaa-option-optimizer
- Files:
-
- 3 added
- 1 deleted
- 20 edited
- 1 copied
-
assets/banner-1544x500-nl_NL.png (added)
-
assets/banner-1544x500.png (modified) ( previous)
-
assets/banner-772x250-nl_NL.png (added)
-
assets/banner-772x250.png (modified) ( previous)
-
assets/github_banner_aaaao_pp.png (added)
-
assets/github_banner_aaaoo_pp.png (deleted)
-
tags/1.7.0 (copied) (copied from aaa-option-optimizer/trunk )
-
tags/1.7.0/aaa-option-optimizer.php (modified) (1 diff)
-
tags/1.7.0/known-plugins/known-plugins.json (modified) (1 diff)
-
tags/1.7.0/package-lock.json (modified) (2 diffs)
-
tags/1.7.0/package.json (modified) (1 diff)
-
tags/1.7.0/readme.txt (modified) (3 diffs)
-
tags/1.7.0/src/class-admin-page.php (modified) (7 diffs)
-
tags/1.7.0/src/class-database.php (modified) (5 diffs)
-
tags/1.7.0/src/class-plugin.php (modified) (2 diffs)
-
tags/1.7.0/src/class-rest.php (modified) (2 diffs)
-
trunk/aaa-option-optimizer.php (modified) (1 diff)
-
trunk/known-plugins/known-plugins.json (modified) (1 diff)
-
trunk/package-lock.json (modified) (2 diffs)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/class-admin-page.php (modified) (7 diffs)
-
trunk/src/class-database.php (modified) (5 diffs)
-
trunk/src/class-plugin.php (modified) (2 diffs)
-
trunk/src/class-rest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aaa-option-optimizer/tags/1.7.0/aaa-option-optimizer.php
r3479922 r3748520 5 5 * @package Progress_Planner\OptionOptimizer 6 6 * 7 * Plugin Name: AAA OptionOptimizer7 * Plugin Name: AAA Autoload Optimizer 8 8 * Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/ 9 9 * Description: Tracks autoloaded options usage and allows the user to optimize them. 10 * Version: 1. 6.110 * Version: 1.7.0 11 11 * License: GPL-3.0+ 12 * Author: Team Pro spress Planner13 * Author URI: https://pro spressplanner.com/12 * Author: Team Progress Planner 13 * Author URI: https://progressplanner.com/ 14 14 * Text Domain: aaa-option-optimizer 15 15 */ -
aaa-option-optimizer/tags/1.7.0/known-plugins/known-plugins.json
r3473518 r3748520 1 1 { 2 2 "aaa-option-optimizer": { 3 "name": "AAA OptionOptimizer",3 "name": "AAA Autoload Optimizer", 4 4 "option_prefixes": ["option_optimizer"] 5 5 }, -
aaa-option-optimizer/tags/1.7.0/package-lock.json
r3324099 r3748520 1 1 { 2 2 "name": "aaa-option-optimizer", 3 "version": "1. 3.2",3 "version": "1.7.0", 4 4 "lockfileVersion": 3, 5 5 "requires": true, … … 7 7 "": { 8 8 "name": "aaa-option-optimizer", 9 "version": "1. 3.2",9 "version": "1.7.0", 10 10 "license": "GPL-3.0-or-later", 11 11 "devDependencies": { -
aaa-option-optimizer/tags/1.7.0/package.json
r3324099 r3748520 1 1 { 2 2 "name": "aaa-option-optimizer", 3 "version": "1. 3.2",3 "version": "1.7.0", 4 4 "private": true, 5 5 "description": "WordPress plugin", -
aaa-option-optimizer/tags/1.7.0/readme.txt
r3479922 r3748520 1 === AAA OptionOptimizer ===1 === AAA Autoload Optimizer === 2 2 Contributors: joostdevalk, aristath, filipi, progressplanner 3 Tags: options, database, cleanup3 Tags: autoload, options, database, performance, cleanup 4 4 Requires at least: 6.7 5 Tested up to: 7.0 5 Tested up to: 7.1 6 Stable tag: 1.7.0 6 7 Requires PHP: 7.4 7 Stable tag: 1.6.1 8 License: GPL3+ 8 License: GPL-3.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html 10 10 11 Plugin that tracks autoloaded options usage and allows the user to optimize them. 11 Find and fix bloated autoloaded options slowing down your WordPress database 12 12 13 13 == Description == 14 This plugin tracks which of the autoloaded options are used on a page, and stores that data at the end of page render. It keeps an array of options that it has seen as being used. On the admin page, it compares all the autoloaded options to the array of stored options, and shows the autoloaded options that have not been used as you were browsing the site. If you've been to every page on your site, or you've kept the plugin around for a week or so, this means that those options probably don't need to be autoloaded. 15 16 === How to use this plugin === 17 Install this plugin, and go through your entire site. Best is to use it normally for a couple of days, or to visit every page on your site and in your admin manually. Then go to the plugin's settings screen, and go through the unused options. You can either decide to remove an unused option (they might for instance be for plugins you no longer use), or to set it to not autoload. The latter action is much less destructive: it'll still be there, but it just won't be autoloaded. 14 15 Every WordPress site loads dozens — sometimes hundreds — of autoloaded 16 options from the `wp_options` table on every single page request. Many of 17 those options belong to plugins you removed long ago, or simply don't need 18 to be autoloaded. The result: a bigger database query, slower page loads, 19 and wasted server resources. 20 21 **AAA Autoload Optimizer** tracks which autoloaded options your site actually 22 uses, then shows you the ones it doesn't — so you can safely remove them 23 or turn off autoloading. 24 25 == How It Works == 26 27 1. Install the plugin and browse your site normally for a few days. 28 2. The plugin quietly records which autoloaded options are actually used 29 during page rendering. 30 3. Visit the settings screen to see every autoloaded option that was 31 *never* used — and decide what to do with it. 32 33 You can **remove** unused options entirely (great for leftover data from 34 deactivated plugins) or **disable autoloading** for options that exist but 35 don't need to load on every request. Disabling autoloading is 36 non-destructive — the option stays in your database, it just won't be 37 fetched automatically. 38 39 == Features == 40 41 - **Automatic usage tracking** — monitors which autoloaded options are 42 loaded on every page, on both the front end and in the admin. 43 - **Bulk actions** — optimize or delete multiple options at once instead 44 of one by one. 45 - **Known-plugin recognition** — identifies which plugin or theme each 46 option belongs to, so you know exactly what you're looking at. 47 - **"All Options" browser** — view and manage every option in your 48 `wp_options` table, not just the unused ones. 49 - **Source filtering** — filter options by their source plugin, theme, or 50 WordPress core to quickly find what you need. 51 - **Safe by design** — disabling autoload is non-destructive. You can 52 always re-enable it. 53 - **Lightweight** — the plugin's own tracking data is stored in a custom 54 database table for optimal performance. 55 56 == Why the "aaa" Slug? == 57 58 WordPress loads plugins alphabetically. Because this plugin needs to start 59 tracking options as early as possible, the `aaa-option-optimizer` slug 60 ensures it loads first. It's not vanity — it's a technical requirement for 61 accurate measurement. 62 63 == Links == 64 65 - [GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/) 66 — report bugs, contribute code, or browse the source. 67 - [Report a security vulnerability](https://patchstack.com/database/vdp/aaa-option-optimizer) 68 — via the Patchstack Vulnerability Disclosure Program. 69 - Built by the team behind 70 [Progress Planner](https://progressplanner.com/). 71 72 == Installation == 73 74 = Automatic installation = 75 76 1. In your WordPress dashboard, go to **Plugins → Add New**. 77 2. Search for **AAA Autoload Optimizer**. 78 3. Click **Install Now**, then **Activate**. 79 4. Browse your site normally for a few days — or visit every page 80 manually if you're in a hurry. 81 5. Go to **Tools → Autoload Optimizer** to review and optimize your 82 autoloaded options. 83 84 = Manual installation = 85 86 1. Download the plugin zip file. 87 2. Upload it via **Plugins → Add New → Upload Plugin**, or extract it 88 to `/wp-content/plugins/aaa-option-optimizer/` via FTP. 89 3. Activate the plugin through the **Plugins** menu. 90 4. Follow steps 4–5 above. 18 91 19 92 == Frequently Asked Questions == 20 93 21 = Why the AAA prefix in the plugin name? = 22 23 Because the plugin needs to measure options being loaded, it benefits from being loaded itself first. As WordPress loads plugins alphabetically, 24 starting the name with AAA made sense. 94 = Will this plugin break my site? = 95 96 The safest action — disabling autoload — is non-destructive. The option 97 remains in your database and can still be loaded on demand. Deleting an 98 option is permanent, so only do that for options you're confident are no 99 longer needed (e.g., from plugins you've already removed). Always back up 100 your database before making bulk changes. 101 102 = Can I undo changes? = 103 104 Disabling autoload can be reversed from the "All Options" tab. Deleting 105 an option is permanent. If you need it back, you'll need to restore from 106 a database backup. 107 108 = How long should I wait before optimizing? = 109 110 A few days of normal browsing is usually enough. If you have a lot of 111 visitors, a few hours might even suffice. The goal is to visit every major 112 page on your site (front end and admin) so the plugin can record which 113 options are actually used. If you're thorough, you can start optimizing 114 sooner. 115 116 = Does this work with WordPress multisite? = 117 118 The plugin currently targets single-site installations. Multisite 119 compatibility has not been officially tested. 120 121 = How do I know which options are safe to remove? = 122 123 The plugin identifies the source of each option (which plugin, theme, or 124 WordPress core). If an option belongs to a plugin you've already 125 deactivated and removed, it's generally safe to delete. When in doubt, 126 disable autoloading instead of deleting — it's the safer choice. 25 127 26 128 = Do I need to take precautions? = 27 129 28 Yes!! Backup your database. 130 Yes, always back up your database before optimizing. Disabling autoload 131 is safe and reversible, but deleting options is permanent. 29 132 30 133 = Where can I report bugs? = 31 134 32 Please use [ our GitHub](https://github.com/ProgressPlanner/aaa-option-optimizer/) for reporting bugs or making code suggestions. Feel free to use the forums for asking questions too, of course.33 34 For security issues, please see the next question.135 Please use [the GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/) 136 for bug reports and code suggestions. The WordPress.org support forum 137 works too for general questions. 35 138 36 139 = How can I report security issues? = 37 140 38 You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer) 39 40 = How can I add recognized plugins? = 41 42 Please do a pull request via GitHub on [this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json) in the plugin. 43 44 == Installation == 45 1. Search for AAA Option Optimizer on the repository. 46 2. Install the plugin. 47 3. Wait a week or so. Or, if you're in a hurry, click around on pages on your site, be sure to try and hit every page on your site and in your admin. 48 4. Go to the plugin's admin page and optimize your option usage. 141 Through the Patchstack Vulnerability Disclosure Program. The Patchstack 142 team validates, triages, and handles all security reports. 143 [Report a security vulnerability here.](https://patchstack.com/database/vdp/aaa-option-optimizer) 144 145 = How can I add my plugin to the known-plugins list? = 146 147 Submit a pull request on GitHub to 148 [known-plugins.json](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json). 49 149 50 150 == Screenshots == 51 151 52 1. Screenshot of the admin screen, initial tab. 53 2. Screenshot of the "All options" screen, showing you can browse all the options. 152 1. The main dashboard showing unused autoloaded options with their size, 153 source plugin, and action buttons. 154 2. The "All Options" tab lets you browse and manage every option in your 155 wp_options table. 156 <!-- TODO: add screenshot showing bulk actions in use --> 157 <!-- TODO: add screenshot showing the source filtering feature --> 54 158 55 159 == Changelog == 56 160 161 = 1.7.0 = 162 163 * Rename the plugin to AAA Autoload Optimizer. 164 * Fix database deadlocks when concurrent requests write tracked options. 165 * Fix a fatal error when W3 Total Cache's database cache is active. 166 * Readme improvements. 167 57 168 = 1.6.1 = 58 169 59 * Fix infinite recursion in option access monitoring that could cause a fatal error in certain hosting environments. 60 61 = 1.6.0 62 63 * Replace using 'all' filter for monitoring option usage with 'pre_option' filter for better performance. 64 * Migrate tracked options data from a single wp_option to a custom database table for improved performance and reliability. 170 * Fix infinite recursion in option access monitoring that could cause a 171 fatal error in certain hosting environments. 172 173 = 1.6.0 = 174 175 * Replace using 'all' filter for monitoring option usage with 176 'pre_option' filter for better performance. 177 * Migrate tracked options data from a single wp_option to a custom 178 database table for improved performance and reliability. 65 179 66 180 = 1.5.1 = … … 105 219 106 220 * Overhaul of the UX, implementing proper tabs, better buttons and more. 107 * Added a new "All options" tab, which, when you hit the button, loads all the options from the database and allows you to manage them. 221 * Added a new "All options" tab, which, when you hit the button, loads 222 all the options from the database and allows you to manage them. 108 223 * Added a "Reset data" button which resets the tracking data. 109 224 * Added a link to the Optimize Options page from the Plugins page. 110 * Much improved recognition of core WordPress options, themes and plugins under "Source", thanks in part to pull requests from [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/) and [system4pc](https://github.com/system4pc). 111 * You can now also filter all tables by Source so you can more easily find the options you're looking for. 112 * Many code and speed improvements under the hood, including adding a class autoloader and some i18n fixes. 225 * Much improved recognition of core WordPress options, themes and plugins 226 under "Source", thanks in part to pull requests from 227 [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/) 228 and [system4pc](https://github.com/system4pc). 229 * You can now also filter all tables by Source so you can more easily 230 find the options you're looking for. 231 * Many code and speed improvements under the hood, including adding a 232 class autoloader and some i18n fixes. 113 233 114 234 = 1.1.1 = 115 235 116 Implement the missing functionality to create an option with value `false` when it's being loaded but doesn't exist. 236 Implement the missing functionality to create an option with value 237 `false` when it's being loaded but doesn't exist. 117 238 118 239 = 1.1 = 119 240 120 The plugin now recognizes plugins from which the options came (thanks to a great pull by [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)). If you're a plugin developer and want your plugin's options 121 properly recognized, please do a pull request [on this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json). 241 The plugin now recognizes plugins from which the options came (thanks to 242 a great pull by 243 [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)). 244 If you're a plugin developer and want your plugin's options properly 245 recognized, please do a pull request on 246 [this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json). 122 247 123 248 Small enhancements: 124 249 125 * Column width is now automatically determined which leads to better spacing. 250 * Column width is now automatically determined which leads to better 251 spacing. 126 252 * Action buttons are now centered in their columns. 127 253 128 254 Bugs fixed: 129 255 130 * If you removed autoload from or deleted an option, it'd be removed from the table but would be back when you paginated, that's fixed - thanks to [Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/) for reporting. 131 * Fixed sorting by filesize by moving the `KB` to the table heading, so that you can now properly sort numbers. 256 * If you removed autoload from or deleted an option, it'd be removed 257 from the table but would be back when you paginated, that's fixed - 258 thanks to 259 [Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/) 260 for reporting. 261 * Fixed sorting by filesize by moving the `KB` to the table heading, so 262 that you can now properly sort numbers. 132 263 * Fixed issue where an empty option would result in weird size output. 133 264 … … 135 266 136 267 * Fixed a bug where the buttons wouldn't work in a paginated state. 137 * Show the value of an option in a `popover`, as suggested with a great pull request by [@rogierlankhorst](https://profiles.wordpress.org/rogierlankhorst/). 268 * Show the value of an option in a `popover`, as suggested with a great 269 pull request by 270 [@rogierlankhorst](https://profiles.wordpress.org/rogierlankhorst/). 138 271 139 272 = 1.0.1 = 140 273 141 Fixed an error with values that are objects, not strings, which also caused sorting not to work for some people. 274 Fixed an error with values that are objects, not strings, which also 275 caused sorting not to work for some people. 142 276 143 277 = 1.0 = 144 278 145 279 Initial release on GitHub and WordPress.org. 280 281 == Upgrade Notice == 282 283 = 1.7.0 = 284 The plugin is now called AAA Autoload Optimizer. Also fixes bugs with 285 concurrent requests and W3 Total Cache. 286 287 = 1.6.1 = 288 Fixes a potential fatal error from infinite recursion in option 289 monitoring on certain hosts. 290 291 = 1.6.0 = 292 Performance and reliability: option tracking now uses a custom database 293 table instead of a single wp_option. -
aaa-option-optimizer/tags/1.7.0/src/class-admin-page.php
r3473518 r3748520 1 1 <?php 2 2 /** 3 * Admin page functionality for AAA OptionOptimizer.3 * Admin page functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 9 9 10 10 /** 11 * Admin page functionality for AAA OptionOptimizer.11 * Admin page functionality for AAA Autoload Optimizer. 12 12 */ 13 13 class Admin_Page { … … 136 136 public function add_admin_page() { 137 137 \add_management_page( 138 __( 'AAA OptionOptimizer', 'aaa-option-optimizer' ),139 __( ' OptionOptimizer', 'aaa-option-optimizer' ),138 __( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ), 139 __( 'Autoload Optimizer', 'aaa-option-optimizer' ), 140 140 'manage_options', 141 141 'aaa-option-optimizer', … … 272 272 ?> 273 273 <div class="wrap"> 274 <h1><?php \esc_html_e( 'AAA OptionOptimizer', 'aaa-option-optimizer' ); ?></h1>274 <h1><?php \esc_html_e( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ); ?></h1> 275 275 276 276 <?php if ( $migration_status['needs_migration'] ) : ?> … … 307 307 <div class="panel"> 308 308 <h2 id="unused-autoloaded"><?php \esc_html_e( 'Unused, but autoloaded', 'aaa-option-optimizer' ); ?></h2> 309 <p><?php \esc_html_e( 'The following options are autoloaded on each pageload, but AAA OptionOptimizer has not been able to detect them being used.', 'aaa-option-optimizer' ); ?></p>309 <p><?php \esc_html_e( 'The following options are autoloaded on each pageload, but AAA Autoload Optimizer has not been able to detect them being used.', 'aaa-option-optimizer' ); ?></p> 310 310 311 311 <table style="width:100%" id="unused_options_table" class="aaa_option_table"> … … 348 348 <?php // Render differences. ?> 349 349 <h2 id="used-not-autoloaded"><?php \esc_html_e( 'Used, but not autoloaded options', 'aaa-option-optimizer' ); ?></h2> 350 <p><?php \esc_html_e( 'The following options are *not* autoloaded on each pageload, but AAA OptionOptimizer has detected that they are being used. If one of the options below has been called a lot and is not very big, you might consider adding autoload to that option.', 'aaa-option-optimizer' ); ?></p>350 <p><?php \esc_html_e( 'The following options are *not* autoloaded on each pageload, but AAA Autoload Optimizer has detected that they are being used. If one of the options below has been called a lot and is not very big, you might consider adding autoload to that option.', 'aaa-option-optimizer' ); ?></p> 351 351 <table style="width:100%;" id="used_not_autoloaded_table" class="aaa_option_table"> 352 352 <thead> … … 390 390 <div class="panel"> 391 391 <h2 id="requested-do-not-exist"><?php \esc_html_e( 'Requested options that do not exist', 'aaa-option-optimizer' ); ?></h2> 392 <p><?php \esc_html_e( 'The following options are requested sometimes, but AAA OptionOptimizer has detected that they do not exist. If one of the options below has been called a lot, it might help to create it with a value of false.', 'aaa-option-optimizer' ); ?></p>392 <p><?php \esc_html_e( 'The following options are requested sometimes, but AAA Autoload Optimizer has detected that they do not exist. If one of the options below has been called a lot, it might help to create it with a value of false.', 'aaa-option-optimizer' ); ?></p> 393 393 <table width="100%" id="requested_do_not_exist_table" class="aaa_option_table"> 394 394 <thead> -
aaa-option-optimizer/tags/1.7.0/src/class-database.php
r3473518 r3748520 1 1 <?php 2 2 /** 3 * Database functionality for AAA OptionOptimizer.3 * Database functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 182 182 * for optimal performance on slow hosts with large datasets. 183 183 * 184 * Rows are written in a fixed (sorted) order. Every request writes the 185 * options it read at shutdown, and InnoDB locks rows in the order of the 186 * VALUES list; with per-request access order, concurrent requests lock 187 * the same rows in different orders and deadlock each other. 188 * 184 189 * @param array<string, int> $options Array of option_name => count. 185 190 * @param int $chunk_size Number of options per query. Default 500. … … 188 193 */ 189 194 public static function batch_insert( $options, $chunk_size = 500 ) { 190 global $wpdb;191 192 195 if ( empty( $options ) ) { 193 196 return; 194 197 } 195 198 196 $table_name = self::get_table_name(); 197 199 // SORT_STRING: numeric option names become int keys, keep one total order. 200 \ksort( $options, SORT_STRING ); 201 202 // A deadlock rolls back the whole transaction, so one retry can't double count. 203 if ( ! self::write_chunks( $options, $chunk_size ) && self::last_error_is_deadlock() ) { 204 self::write_chunks( $options, $chunk_size ); 205 } 206 } 207 208 /** 209 * Write option counts in chunks inside a single transaction. 210 * 211 * @param array<string, int> $options Array of option_name => count, already sorted. 212 * @param int $chunk_size Number of options per query. 213 * 214 * @return bool Whether the transaction was committed. 215 */ 216 private static function write_chunks( $options, $chunk_size ) { 217 global $wpdb; 218 219 $table_name = self::get_table_name(); 220 221 // Use `START TRANSACTION` (not `BEGIN`) so W3 Total Cache's DbCache layer 222 // recognizes it as a transaction and skips caching — `BEGIN` slips past its 223 // regex and triggers a fatal in wpdb::load_col_info() on the boolean result. 198 224 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 199 $wpdb->query( ' BEGIN' );225 $wpdb->query( 'START TRANSACTION' ); 200 226 201 227 foreach ( array_chunk( $options, $chunk_size, true ) as $chunk ) { … … 205 231 foreach ( $chunk as $option_name => $count ) { 206 232 $placeholders[] = '(%s, %d, NOW())'; 207 $values[] = $option_name;233 $values[] = (string) $option_name; 208 234 $values[] = (int) $count; 209 235 } … … 214 240 215 241 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared 216 $wpdb->query( $wpdb->prepare( $sql, ...$values ) ); 242 if ( false === $wpdb->query( $wpdb->prepare( $sql, ...$values ) ) ) { 243 // Keep the error: ROLLBACK succeeding would clear `$wpdb->last_error`. 244 $error = $wpdb->last_error; 245 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 246 $wpdb->query( 'ROLLBACK' ); 247 $wpdb->last_error = $error; 248 return false; 249 } 217 250 } 218 251 219 252 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 220 $wpdb->query( 'COMMIT' ); 253 return false !== $wpdb->query( 'COMMIT' ); 254 } 255 256 /** 257 * Whether the last database error was an InnoDB deadlock (MySQL error 1213). 258 * 259 * @return bool 260 */ 261 private static function last_error_is_deadlock() { 262 global $wpdb; 263 264 return false !== \stripos( (string) $wpdb->last_error, 'Deadlock found' ); 221 265 } 222 266 -
aaa-option-optimizer/tags/1.7.0/src/class-plugin.php
r3479922 r3748520 1 1 <?php 2 2 /** 3 * Plugin functionality for AAA OptionOptimizer.3 * Plugin functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 9 9 10 10 /** 11 * Core functionality of AAA OptionOptimizer.11 * Core functionality of AAA Autoload Optimizer. 12 12 */ 13 13 class Plugin { -
aaa-option-optimizer/tags/1.7.0/src/class-rest.php
r3473518 r3748520 1 1 <?php 2 2 /** 3 * REST functionality for AAA OptionOptimizer.3 * REST functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 13 13 14 14 /** 15 * REST functionality of AAA OptionOptimizer.15 * REST functionality of AAA Autoload Optimizer. 16 16 */ 17 17 class REST { -
aaa-option-optimizer/trunk/aaa-option-optimizer.php
r3479922 r3748520 5 5 * @package Progress_Planner\OptionOptimizer 6 6 * 7 * Plugin Name: AAA OptionOptimizer7 * Plugin Name: AAA Autoload Optimizer 8 8 * Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/ 9 9 * Description: Tracks autoloaded options usage and allows the user to optimize them. 10 * Version: 1. 6.110 * Version: 1.7.0 11 11 * License: GPL-3.0+ 12 * Author: Team Pro spress Planner13 * Author URI: https://pro spressplanner.com/12 * Author: Team Progress Planner 13 * Author URI: https://progressplanner.com/ 14 14 * Text Domain: aaa-option-optimizer 15 15 */ -
aaa-option-optimizer/trunk/known-plugins/known-plugins.json
r3473518 r3748520 1 1 { 2 2 "aaa-option-optimizer": { 3 "name": "AAA OptionOptimizer",3 "name": "AAA Autoload Optimizer", 4 4 "option_prefixes": ["option_optimizer"] 5 5 }, -
aaa-option-optimizer/trunk/package-lock.json
r3324099 r3748520 1 1 { 2 2 "name": "aaa-option-optimizer", 3 "version": "1. 3.2",3 "version": "1.7.0", 4 4 "lockfileVersion": 3, 5 5 "requires": true, … … 7 7 "": { 8 8 "name": "aaa-option-optimizer", 9 "version": "1. 3.2",9 "version": "1.7.0", 10 10 "license": "GPL-3.0-or-later", 11 11 "devDependencies": { -
aaa-option-optimizer/trunk/package.json
r3324099 r3748520 1 1 { 2 2 "name": "aaa-option-optimizer", 3 "version": "1. 3.2",3 "version": "1.7.0", 4 4 "private": true, 5 5 "description": "WordPress plugin", -
aaa-option-optimizer/trunk/readme.txt
r3479922 r3748520 1 === AAA OptionOptimizer ===1 === AAA Autoload Optimizer === 2 2 Contributors: joostdevalk, aristath, filipi, progressplanner 3 Tags: options, database, cleanup3 Tags: autoload, options, database, performance, cleanup 4 4 Requires at least: 6.7 5 Tested up to: 7.0 5 Tested up to: 7.1 6 Stable tag: 1.7.0 6 7 Requires PHP: 7.4 7 Stable tag: 1.6.1 8 License: GPL3+ 8 License: GPL-3.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html 10 10 11 Plugin that tracks autoloaded options usage and allows the user to optimize them. 11 Find and fix bloated autoloaded options slowing down your WordPress database 12 12 13 13 == Description == 14 This plugin tracks which of the autoloaded options are used on a page, and stores that data at the end of page render. It keeps an array of options that it has seen as being used. On the admin page, it compares all the autoloaded options to the array of stored options, and shows the autoloaded options that have not been used as you were browsing the site. If you've been to every page on your site, or you've kept the plugin around for a week or so, this means that those options probably don't need to be autoloaded. 15 16 === How to use this plugin === 17 Install this plugin, and go through your entire site. Best is to use it normally for a couple of days, or to visit every page on your site and in your admin manually. Then go to the plugin's settings screen, and go through the unused options. You can either decide to remove an unused option (they might for instance be for plugins you no longer use), or to set it to not autoload. The latter action is much less destructive: it'll still be there, but it just won't be autoloaded. 14 15 Every WordPress site loads dozens — sometimes hundreds — of autoloaded 16 options from the `wp_options` table on every single page request. Many of 17 those options belong to plugins you removed long ago, or simply don't need 18 to be autoloaded. The result: a bigger database query, slower page loads, 19 and wasted server resources. 20 21 **AAA Autoload Optimizer** tracks which autoloaded options your site actually 22 uses, then shows you the ones it doesn't — so you can safely remove them 23 or turn off autoloading. 24 25 == How It Works == 26 27 1. Install the plugin and browse your site normally for a few days. 28 2. The plugin quietly records which autoloaded options are actually used 29 during page rendering. 30 3. Visit the settings screen to see every autoloaded option that was 31 *never* used — and decide what to do with it. 32 33 You can **remove** unused options entirely (great for leftover data from 34 deactivated plugins) or **disable autoloading** for options that exist but 35 don't need to load on every request. Disabling autoloading is 36 non-destructive — the option stays in your database, it just won't be 37 fetched automatically. 38 39 == Features == 40 41 - **Automatic usage tracking** — monitors which autoloaded options are 42 loaded on every page, on both the front end and in the admin. 43 - **Bulk actions** — optimize or delete multiple options at once instead 44 of one by one. 45 - **Known-plugin recognition** — identifies which plugin or theme each 46 option belongs to, so you know exactly what you're looking at. 47 - **"All Options" browser** — view and manage every option in your 48 `wp_options` table, not just the unused ones. 49 - **Source filtering** — filter options by their source plugin, theme, or 50 WordPress core to quickly find what you need. 51 - **Safe by design** — disabling autoload is non-destructive. You can 52 always re-enable it. 53 - **Lightweight** — the plugin's own tracking data is stored in a custom 54 database table for optimal performance. 55 56 == Why the "aaa" Slug? == 57 58 WordPress loads plugins alphabetically. Because this plugin needs to start 59 tracking options as early as possible, the `aaa-option-optimizer` slug 60 ensures it loads first. It's not vanity — it's a technical requirement for 61 accurate measurement. 62 63 == Links == 64 65 - [GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/) 66 — report bugs, contribute code, or browse the source. 67 - [Report a security vulnerability](https://patchstack.com/database/vdp/aaa-option-optimizer) 68 — via the Patchstack Vulnerability Disclosure Program. 69 - Built by the team behind 70 [Progress Planner](https://progressplanner.com/). 71 72 == Installation == 73 74 = Automatic installation = 75 76 1. In your WordPress dashboard, go to **Plugins → Add New**. 77 2. Search for **AAA Autoload Optimizer**. 78 3. Click **Install Now**, then **Activate**. 79 4. Browse your site normally for a few days — or visit every page 80 manually if you're in a hurry. 81 5. Go to **Tools → Autoload Optimizer** to review and optimize your 82 autoloaded options. 83 84 = Manual installation = 85 86 1. Download the plugin zip file. 87 2. Upload it via **Plugins → Add New → Upload Plugin**, or extract it 88 to `/wp-content/plugins/aaa-option-optimizer/` via FTP. 89 3. Activate the plugin through the **Plugins** menu. 90 4. Follow steps 4–5 above. 18 91 19 92 == Frequently Asked Questions == 20 93 21 = Why the AAA prefix in the plugin name? = 22 23 Because the plugin needs to measure options being loaded, it benefits from being loaded itself first. As WordPress loads plugins alphabetically, 24 starting the name with AAA made sense. 94 = Will this plugin break my site? = 95 96 The safest action — disabling autoload — is non-destructive. The option 97 remains in your database and can still be loaded on demand. Deleting an 98 option is permanent, so only do that for options you're confident are no 99 longer needed (e.g., from plugins you've already removed). Always back up 100 your database before making bulk changes. 101 102 = Can I undo changes? = 103 104 Disabling autoload can be reversed from the "All Options" tab. Deleting 105 an option is permanent. If you need it back, you'll need to restore from 106 a database backup. 107 108 = How long should I wait before optimizing? = 109 110 A few days of normal browsing is usually enough. If you have a lot of 111 visitors, a few hours might even suffice. The goal is to visit every major 112 page on your site (front end and admin) so the plugin can record which 113 options are actually used. If you're thorough, you can start optimizing 114 sooner. 115 116 = Does this work with WordPress multisite? = 117 118 The plugin currently targets single-site installations. Multisite 119 compatibility has not been officially tested. 120 121 = How do I know which options are safe to remove? = 122 123 The plugin identifies the source of each option (which plugin, theme, or 124 WordPress core). If an option belongs to a plugin you've already 125 deactivated and removed, it's generally safe to delete. When in doubt, 126 disable autoloading instead of deleting — it's the safer choice. 25 127 26 128 = Do I need to take precautions? = 27 129 28 Yes!! Backup your database. 130 Yes, always back up your database before optimizing. Disabling autoload 131 is safe and reversible, but deleting options is permanent. 29 132 30 133 = Where can I report bugs? = 31 134 32 Please use [ our GitHub](https://github.com/ProgressPlanner/aaa-option-optimizer/) for reporting bugs or making code suggestions. Feel free to use the forums for asking questions too, of course.33 34 For security issues, please see the next question.135 Please use [the GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/) 136 for bug reports and code suggestions. The WordPress.org support forum 137 works too for general questions. 35 138 36 139 = How can I report security issues? = 37 140 38 You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer) 39 40 = How can I add recognized plugins? = 41 42 Please do a pull request via GitHub on [this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json) in the plugin. 43 44 == Installation == 45 1. Search for AAA Option Optimizer on the repository. 46 2. Install the plugin. 47 3. Wait a week or so. Or, if you're in a hurry, click around on pages on your site, be sure to try and hit every page on your site and in your admin. 48 4. Go to the plugin's admin page and optimize your option usage. 141 Through the Patchstack Vulnerability Disclosure Program. The Patchstack 142 team validates, triages, and handles all security reports. 143 [Report a security vulnerability here.](https://patchstack.com/database/vdp/aaa-option-optimizer) 144 145 = How can I add my plugin to the known-plugins list? = 146 147 Submit a pull request on GitHub to 148 [known-plugins.json](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json). 49 149 50 150 == Screenshots == 51 151 52 1. Screenshot of the admin screen, initial tab. 53 2. Screenshot of the "All options" screen, showing you can browse all the options. 152 1. The main dashboard showing unused autoloaded options with their size, 153 source plugin, and action buttons. 154 2. The "All Options" tab lets you browse and manage every option in your 155 wp_options table. 156 <!-- TODO: add screenshot showing bulk actions in use --> 157 <!-- TODO: add screenshot showing the source filtering feature --> 54 158 55 159 == Changelog == 56 160 161 = 1.7.0 = 162 163 * Rename the plugin to AAA Autoload Optimizer. 164 * Fix database deadlocks when concurrent requests write tracked options. 165 * Fix a fatal error when W3 Total Cache's database cache is active. 166 * Readme improvements. 167 57 168 = 1.6.1 = 58 169 59 * Fix infinite recursion in option access monitoring that could cause a fatal error in certain hosting environments. 60 61 = 1.6.0 62 63 * Replace using 'all' filter for monitoring option usage with 'pre_option' filter for better performance. 64 * Migrate tracked options data from a single wp_option to a custom database table for improved performance and reliability. 170 * Fix infinite recursion in option access monitoring that could cause a 171 fatal error in certain hosting environments. 172 173 = 1.6.0 = 174 175 * Replace using 'all' filter for monitoring option usage with 176 'pre_option' filter for better performance. 177 * Migrate tracked options data from a single wp_option to a custom 178 database table for improved performance and reliability. 65 179 66 180 = 1.5.1 = … … 105 219 106 220 * Overhaul of the UX, implementing proper tabs, better buttons and more. 107 * Added a new "All options" tab, which, when you hit the button, loads all the options from the database and allows you to manage them. 221 * Added a new "All options" tab, which, when you hit the button, loads 222 all the options from the database and allows you to manage them. 108 223 * Added a "Reset data" button which resets the tracking data. 109 224 * Added a link to the Optimize Options page from the Plugins page. 110 * Much improved recognition of core WordPress options, themes and plugins under "Source", thanks in part to pull requests from [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/) and [system4pc](https://github.com/system4pc). 111 * You can now also filter all tables by Source so you can more easily find the options you're looking for. 112 * Many code and speed improvements under the hood, including adding a class autoloader and some i18n fixes. 225 * Much improved recognition of core WordPress options, themes and plugins 226 under "Source", thanks in part to pull requests from 227 [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/) 228 and [system4pc](https://github.com/system4pc). 229 * You can now also filter all tables by Source so you can more easily 230 find the options you're looking for. 231 * Many code and speed improvements under the hood, including adding a 232 class autoloader and some i18n fixes. 113 233 114 234 = 1.1.1 = 115 235 116 Implement the missing functionality to create an option with value `false` when it's being loaded but doesn't exist. 236 Implement the missing functionality to create an option with value 237 `false` when it's being loaded but doesn't exist. 117 238 118 239 = 1.1 = 119 240 120 The plugin now recognizes plugins from which the options came (thanks to a great pull by [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)). If you're a plugin developer and want your plugin's options 121 properly recognized, please do a pull request [on this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json). 241 The plugin now recognizes plugins from which the options came (thanks to 242 a great pull by 243 [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)). 244 If you're a plugin developer and want your plugin's options properly 245 recognized, please do a pull request on 246 [this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json). 122 247 123 248 Small enhancements: 124 249 125 * Column width is now automatically determined which leads to better spacing. 250 * Column width is now automatically determined which leads to better 251 spacing. 126 252 * Action buttons are now centered in their columns. 127 253 128 254 Bugs fixed: 129 255 130 * If you removed autoload from or deleted an option, it'd be removed from the table but would be back when you paginated, that's fixed - thanks to [Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/) for reporting. 131 * Fixed sorting by filesize by moving the `KB` to the table heading, so that you can now properly sort numbers. 256 * If you removed autoload from or deleted an option, it'd be removed 257 from the table but would be back when you paginated, that's fixed - 258 thanks to 259 [Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/) 260 for reporting. 261 * Fixed sorting by filesize by moving the `KB` to the table heading, so 262 that you can now properly sort numbers. 132 263 * Fixed issue where an empty option would result in weird size output. 133 264 … … 135 266 136 267 * Fixed a bug where the buttons wouldn't work in a paginated state. 137 * Show the value of an option in a `popover`, as suggested with a great pull request by [@rogierlankhorst](https://profiles.wordpress.org/rogierlankhorst/). 268 * Show the value of an option in a `popover`, as suggested with a great 269 pull request by 270 [@rogierlankhorst](https://profiles.wordpress.org/rogierlankhorst/). 138 271 139 272 = 1.0.1 = 140 273 141 Fixed an error with values that are objects, not strings, which also caused sorting not to work for some people. 274 Fixed an error with values that are objects, not strings, which also 275 caused sorting not to work for some people. 142 276 143 277 = 1.0 = 144 278 145 279 Initial release on GitHub and WordPress.org. 280 281 == Upgrade Notice == 282 283 = 1.7.0 = 284 The plugin is now called AAA Autoload Optimizer. Also fixes bugs with 285 concurrent requests and W3 Total Cache. 286 287 = 1.6.1 = 288 Fixes a potential fatal error from infinite recursion in option 289 monitoring on certain hosts. 290 291 = 1.6.0 = 292 Performance and reliability: option tracking now uses a custom database 293 table instead of a single wp_option. -
aaa-option-optimizer/trunk/src/class-admin-page.php
r3473518 r3748520 1 1 <?php 2 2 /** 3 * Admin page functionality for AAA OptionOptimizer.3 * Admin page functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 9 9 10 10 /** 11 * Admin page functionality for AAA OptionOptimizer.11 * Admin page functionality for AAA Autoload Optimizer. 12 12 */ 13 13 class Admin_Page { … … 136 136 public function add_admin_page() { 137 137 \add_management_page( 138 __( 'AAA OptionOptimizer', 'aaa-option-optimizer' ),139 __( ' OptionOptimizer', 'aaa-option-optimizer' ),138 __( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ), 139 __( 'Autoload Optimizer', 'aaa-option-optimizer' ), 140 140 'manage_options', 141 141 'aaa-option-optimizer', … … 272 272 ?> 273 273 <div class="wrap"> 274 <h1><?php \esc_html_e( 'AAA OptionOptimizer', 'aaa-option-optimizer' ); ?></h1>274 <h1><?php \esc_html_e( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ); ?></h1> 275 275 276 276 <?php if ( $migration_status['needs_migration'] ) : ?> … … 307 307 <div class="panel"> 308 308 <h2 id="unused-autoloaded"><?php \esc_html_e( 'Unused, but autoloaded', 'aaa-option-optimizer' ); ?></h2> 309 <p><?php \esc_html_e( 'The following options are autoloaded on each pageload, but AAA OptionOptimizer has not been able to detect them being used.', 'aaa-option-optimizer' ); ?></p>309 <p><?php \esc_html_e( 'The following options are autoloaded on each pageload, but AAA Autoload Optimizer has not been able to detect them being used.', 'aaa-option-optimizer' ); ?></p> 310 310 311 311 <table style="width:100%" id="unused_options_table" class="aaa_option_table"> … … 348 348 <?php // Render differences. ?> 349 349 <h2 id="used-not-autoloaded"><?php \esc_html_e( 'Used, but not autoloaded options', 'aaa-option-optimizer' ); ?></h2> 350 <p><?php \esc_html_e( 'The following options are *not* autoloaded on each pageload, but AAA OptionOptimizer has detected that they are being used. If one of the options below has been called a lot and is not very big, you might consider adding autoload to that option.', 'aaa-option-optimizer' ); ?></p>350 <p><?php \esc_html_e( 'The following options are *not* autoloaded on each pageload, but AAA Autoload Optimizer has detected that they are being used. If one of the options below has been called a lot and is not very big, you might consider adding autoload to that option.', 'aaa-option-optimizer' ); ?></p> 351 351 <table style="width:100%;" id="used_not_autoloaded_table" class="aaa_option_table"> 352 352 <thead> … … 390 390 <div class="panel"> 391 391 <h2 id="requested-do-not-exist"><?php \esc_html_e( 'Requested options that do not exist', 'aaa-option-optimizer' ); ?></h2> 392 <p><?php \esc_html_e( 'The following options are requested sometimes, but AAA OptionOptimizer has detected that they do not exist. If one of the options below has been called a lot, it might help to create it with a value of false.', 'aaa-option-optimizer' ); ?></p>392 <p><?php \esc_html_e( 'The following options are requested sometimes, but AAA Autoload Optimizer has detected that they do not exist. If one of the options below has been called a lot, it might help to create it with a value of false.', 'aaa-option-optimizer' ); ?></p> 393 393 <table width="100%" id="requested_do_not_exist_table" class="aaa_option_table"> 394 394 <thead> -
aaa-option-optimizer/trunk/src/class-database.php
r3473518 r3748520 1 1 <?php 2 2 /** 3 * Database functionality for AAA OptionOptimizer.3 * Database functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 182 182 * for optimal performance on slow hosts with large datasets. 183 183 * 184 * Rows are written in a fixed (sorted) order. Every request writes the 185 * options it read at shutdown, and InnoDB locks rows in the order of the 186 * VALUES list; with per-request access order, concurrent requests lock 187 * the same rows in different orders and deadlock each other. 188 * 184 189 * @param array<string, int> $options Array of option_name => count. 185 190 * @param int $chunk_size Number of options per query. Default 500. … … 188 193 */ 189 194 public static function batch_insert( $options, $chunk_size = 500 ) { 190 global $wpdb;191 192 195 if ( empty( $options ) ) { 193 196 return; 194 197 } 195 198 196 $table_name = self::get_table_name(); 197 199 // SORT_STRING: numeric option names become int keys, keep one total order. 200 \ksort( $options, SORT_STRING ); 201 202 // A deadlock rolls back the whole transaction, so one retry can't double count. 203 if ( ! self::write_chunks( $options, $chunk_size ) && self::last_error_is_deadlock() ) { 204 self::write_chunks( $options, $chunk_size ); 205 } 206 } 207 208 /** 209 * Write option counts in chunks inside a single transaction. 210 * 211 * @param array<string, int> $options Array of option_name => count, already sorted. 212 * @param int $chunk_size Number of options per query. 213 * 214 * @return bool Whether the transaction was committed. 215 */ 216 private static function write_chunks( $options, $chunk_size ) { 217 global $wpdb; 218 219 $table_name = self::get_table_name(); 220 221 // Use `START TRANSACTION` (not `BEGIN`) so W3 Total Cache's DbCache layer 222 // recognizes it as a transaction and skips caching — `BEGIN` slips past its 223 // regex and triggers a fatal in wpdb::load_col_info() on the boolean result. 198 224 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 199 $wpdb->query( ' BEGIN' );225 $wpdb->query( 'START TRANSACTION' ); 200 226 201 227 foreach ( array_chunk( $options, $chunk_size, true ) as $chunk ) { … … 205 231 foreach ( $chunk as $option_name => $count ) { 206 232 $placeholders[] = '(%s, %d, NOW())'; 207 $values[] = $option_name;233 $values[] = (string) $option_name; 208 234 $values[] = (int) $count; 209 235 } … … 214 240 215 241 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared 216 $wpdb->query( $wpdb->prepare( $sql, ...$values ) ); 242 if ( false === $wpdb->query( $wpdb->prepare( $sql, ...$values ) ) ) { 243 // Keep the error: ROLLBACK succeeding would clear `$wpdb->last_error`. 244 $error = $wpdb->last_error; 245 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 246 $wpdb->query( 'ROLLBACK' ); 247 $wpdb->last_error = $error; 248 return false; 249 } 217 250 } 218 251 219 252 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 220 $wpdb->query( 'COMMIT' ); 253 return false !== $wpdb->query( 'COMMIT' ); 254 } 255 256 /** 257 * Whether the last database error was an InnoDB deadlock (MySQL error 1213). 258 * 259 * @return bool 260 */ 261 private static function last_error_is_deadlock() { 262 global $wpdb; 263 264 return false !== \stripos( (string) $wpdb->last_error, 'Deadlock found' ); 221 265 } 222 266 -
aaa-option-optimizer/trunk/src/class-plugin.php
r3479922 r3748520 1 1 <?php 2 2 /** 3 * Plugin functionality for AAA OptionOptimizer.3 * Plugin functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 9 9 10 10 /** 11 * Core functionality of AAA OptionOptimizer.11 * Core functionality of AAA Autoload Optimizer. 12 12 */ 13 13 class Plugin { -
aaa-option-optimizer/trunk/src/class-rest.php
r3473518 r3748520 1 1 <?php 2 2 /** 3 * REST functionality for AAA OptionOptimizer.3 * REST functionality for AAA Autoload Optimizer. 4 4 * 5 5 * @package Progress_Planner\OptionOptimizer … … 13 13 14 14 /** 15 * REST functionality of AAA OptionOptimizer.15 * REST functionality of AAA Autoload Optimizer. 16 16 */ 17 17 class REST {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)