Plugin Directory

Changeset 3748520


Ignore:
Timestamp:
10/15/2026 12:56:36 PM (3 weeks ago)
Author:
progressplanner
Message:

Update to version 1.7.0 from GitHub

Location:
aaa-option-optimizer
Files:
3 added
1 deleted
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • aaa-option-optimizer/tags/1.7.0/aaa-option-optimizer.php

    r3479922 r3748520  
    55 * @package Progress_Planner\OptionOptimizer
    66 *
    7  * Plugin Name: AAA Option Optimizer
     7 * Plugin Name: AAA Autoload Optimizer
    88 * Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/
    99 * Description: Tracks autoloaded options usage and allows the user to optimize them.
    10  * Version: 1.6.1
     10 * Version: 1.7.0
    1111 * License: GPL-3.0+
    12  * Author: Team Prospress Planner
    13  * Author URI: https://prospressplanner.com/
     12 * Author: Team Progress Planner
     13 * Author URI: https://progressplanner.com/
    1414 * Text Domain: aaa-option-optimizer
    1515 */
  • aaa-option-optimizer/tags/1.7.0/known-plugins/known-plugins.json

    r3473518 r3748520  
    11{
    22    "aaa-option-optimizer": {
    3         "name": "AAA Option Optimizer",
     3        "name": "AAA Autoload Optimizer",
    44        "option_prefixes": ["option_optimizer"]
    55    },
  • aaa-option-optimizer/tags/1.7.0/package-lock.json

    r3324099 r3748520  
    11{
    22        "name": "aaa-option-optimizer",
    3         "version": "1.3.2",
     3        "version": "1.7.0",
    44        "lockfileVersion": 3,
    55        "requires": true,
    … …  
    77                "": {
    88                        "name": "aaa-option-optimizer",
    9                         "version": "1.3.2",
     9                        "version": "1.7.0",
    1010                        "license": "GPL-3.0-or-later",
    1111                        "devDependencies": {
  • aaa-option-optimizer/tags/1.7.0/package.json

    r3324099 r3748520  
    11{
    22        "name": "aaa-option-optimizer",
    3         "version": "1.3.2",
     3        "version": "1.7.0",
    44        "private": true,
    55        "description": "WordPress plugin",
  • aaa-option-optimizer/tags/1.7.0/readme.txt

    r3479922 r3748520  
    1 === AAA Option Optimizer ===
     1=== AAA Autoload Optimizer ===
    22Contributors: joostdevalk, aristath, filipi, progressplanner
    3 Tags: options, database, cleanup
     3Tags: autoload, options, database, performance, cleanup
    44Requires at least: 6.7
    5 Tested up to: 7.0
     5Tested up to: 7.1
     6Stable tag: 1.7.0
    67Requires PHP: 7.4
    7 Stable tag: 1.6.1
    8 License: GPL3+
     8License: GPL-3.0-or-later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
    1010
    11 Plugin that tracks autoloaded options usage and allows the user to optimize them.
     11Find and fix bloated autoloaded options slowing down your WordPress database
    1212
    1313== 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
     15Every WordPress site loads dozens — sometimes hundreds — of autoloaded
     16options from the `wp_options` table on every single page request. Many of
     17those options belong to plugins you removed long ago, or simply don't need
     18to be autoloaded. The result: a bigger database query, slower page loads,
     19and wasted server resources.
     20
     21**AAA Autoload Optimizer** tracks which autoloaded options your site actually
     22uses, then shows you the ones it doesn't — so you can safely remove them
     23or turn off autoloading.
     24
     25== How It Works ==
     26
     271. Install the plugin and browse your site normally for a few days.
     282. The plugin quietly records which autoloaded options are actually used
     29   during page rendering.
     303. Visit the settings screen to see every autoloaded option that was
     31   *never* used — and decide what to do with it.
     32
     33You can **remove** unused options entirely (great for leftover data from
     34deactivated plugins) or **disable autoloading** for options that exist but
     35don't need to load on every request. Disabling autoloading is
     36non-destructive — the option stays in your database, it just won't be
     37fetched 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
     58WordPress loads plugins alphabetically. Because this plugin needs to start
     59tracking options as early as possible, the `aaa-option-optimizer` slug
     60ensures it loads first. It's not vanity — it's a technical requirement for
     61accurate 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
     761. In your WordPress dashboard, go to **Plugins → Add New**.
     772. Search for **AAA Autoload Optimizer**.
     783. Click **Install Now**, then **Activate**.
     794. Browse your site normally for a few days — or visit every page
     80   manually if you're in a hurry.
     815. Go to **Tools → Autoload Optimizer** to review and optimize your
     82   autoloaded options.
     83
     84= Manual installation =
     85
     861. Download the plugin zip file.
     872. Upload it via **Plugins → Add New → Upload Plugin**, or extract it
     88   to `/wp-content/plugins/aaa-option-optimizer/` via FTP.
     893. Activate the plugin through the **Plugins** menu.
     904. Follow steps 4–5 above.
    1891
    1992== Frequently Asked Questions ==
    2093
    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
     96The safest action — disabling autoload — is non-destructive. The option
     97remains in your database and can still be loaded on demand. Deleting an
     98option is permanent, so only do that for options you're confident are no
     99longer needed (e.g., from plugins you've already removed). Always back up
     100your database before making bulk changes.
     101
     102= Can I undo changes? =
     103
     104Disabling autoload can be reversed from the "All Options" tab. Deleting
     105an option is permanent. If you need it back, you'll need to restore from
     106a database backup.
     107
     108= How long should I wait before optimizing? =
     109
     110A few days of normal browsing is usually enough. If you have a lot of
     111visitors, a few hours might even suffice. The goal is to visit every major
     112page on your site (front end and admin) so the plugin can record which
     113options are actually used. If you're thorough, you can start optimizing
     114sooner.
     115
     116= Does this work with WordPress multisite? =
     117
     118The plugin currently targets single-site installations. Multisite
     119compatibility has not been officially tested.
     120
     121= How do I know which options are safe to remove? =
     122
     123The plugin identifies the source of each option (which plugin, theme, or
     124WordPress core). If an option belongs to a plugin you've already
     125deactivated and removed, it's generally safe to delete. When in doubt,
     126disable autoloading instead of deleting — it's the safer choice.
    25127
    26128= Do I need to take precautions? =
    27129
    28 Yes!! Backup your database.
     130Yes, always back up your database before optimizing. Disabling autoload
     131is safe and reversible, but deleting options is permanent.
    29132
    30133= Where can I report bugs? =
    31134
    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.
     135Please use [the GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/)
     136for bug reports and code suggestions. The WordPress.org support forum
     137works too for general questions.
    35138
    36139= How can I report security issues? =
    37140
    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.
     141Through the Patchstack Vulnerability Disclosure Program. The Patchstack
     142team 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
     147Submit a pull request on GitHub to
     148[known-plugins.json](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json).
    49149
    50150== Screenshots ==
    51151
    52 1. Screenshot of the admin screen, initial tab.
    53 2. Screenshot of the "All options" screen, showing you can browse all the options.
     1521. The main dashboard showing unused autoloaded options with their size,
     153   source plugin, and action buttons.
     1542. 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 -->
    54158
    55159== Changelog ==
    56160
     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
    57168= 1.6.1 =
    58169
    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.
    65179
    66180= 1.5.1 =
    … …  
    105219
    106220* 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.
    108223* Added a "Reset data" button which resets the tracking data.
    109224* 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.
    113233
    114234= 1.1.1 =
    115235
    116 Implement the missing functionality to create an option with value `false` when it's being loaded but doesn't exist.
     236Implement the missing functionality to create an option with value
     237`false` when it's being loaded but doesn't exist.
    117238
    118239= 1.1 =
    119240
    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).
     241The plugin now recognizes plugins from which the options came (thanks to
     242a great pull by
     243[Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)).
     244If you're a plugin developer and want your plugin's options properly
     245recognized, please do a pull request on
     246[this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json).
    122247
    123248Small enhancements:
    124249
    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.
    126252* Action buttons are now centered in their columns.
    127253
    128254Bugs fixed:
    129255
    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.
    132263* Fixed issue where an empty option would result in weird size output.
    133264
    … …  
    135266
    136267* 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/).
    138271
    139272= 1.0.1 =
    140273
    141 Fixed an error with values that are objects, not strings, which also caused sorting not to work for some people.
     274Fixed an error with values that are objects, not strings, which also
     275caused sorting not to work for some people.
    142276
    143277= 1.0 =
    144278
    145279Initial release on GitHub and WordPress.org.
     280
     281== Upgrade Notice ==
     282
     283= 1.7.0 =
     284The plugin is now called AAA Autoload Optimizer. Also fixes bugs with
     285concurrent requests and W3 Total Cache.
     286
     287= 1.6.1 =
     288Fixes a potential fatal error from infinite recursion in option
     289monitoring on certain hosts.
     290
     291= 1.6.0 =
     292Performance and reliability: option tracking now uses a custom database
     293table instead of a single wp_option.
  • aaa-option-optimizer/tags/1.7.0/src/class-admin-page.php

    r3473518 r3748520  
    11<?php
    22/**
    3  * Admin page functionality for AAA Option Optimizer.
     3 * Admin page functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    99
    1010/**
    11  * Admin page functionality for AAA Option Optimizer.
     11 * Admin page functionality for AAA Autoload Optimizer.
    1212 */
    1313class Admin_Page {
    … …  
    136136        public function add_admin_page() {
    137137                \add_management_page(
    138                         __( 'AAA Option Optimizer', 'aaa-option-optimizer' ),
    139                         __( 'Option Optimizer', 'aaa-option-optimizer' ),
     138                        __( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ),
     139                        __( 'Autoload Optimizer', 'aaa-option-optimizer' ),
    140140                        'manage_options',
    141141                        'aaa-option-optimizer',
    … …  
    272272                ?>
    273273                <div class="wrap">
    274                         <h1><?php \esc_html_e( 'AAA Option Optimizer', 'aaa-option-optimizer' ); ?></h1>
     274                        <h1><?php \esc_html_e( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ); ?></h1>
    275275
    276276                        <?php if ( $migration_status['needs_migration'] ) : ?>
    … …  
    307307                                <div class="panel">
    308308                                        <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 Option Optimizer 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>
    310310
    311311                                        <table style="width:100%" id="unused_options_table" class="aaa_option_table">
    … …  
    348348                                        <?php // Render differences. ?>
    349349                                        <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 Option 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>
     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>
    351351                                        <table style="width:100%;" id="used_not_autoloaded_table" class="aaa_option_table">
    352352                                                <thead>
    … …  
    390390                                <div class="panel">
    391391                                        <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 Option 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>
     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>
    393393                                        <table width="100%" id="requested_do_not_exist_table" class="aaa_option_table">
    394394                                                <thead>
  • aaa-option-optimizer/tags/1.7.0/src/class-database.php

    r3473518 r3748520  
    11<?php
    22/**
    3  * Database functionality for AAA Option Optimizer.
     3 * Database functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    182182         * for optimal performance on slow hosts with large datasets.
    183183         *
     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         *
    184189         * @param array<string, int> $options    Array of option_name => count.
    185190         * @param int                $chunk_size Number of options per query. Default 500.
    … …  
    188193         */
    189194        public static function batch_insert( $options, $chunk_size = 500 ) {
    190                 global $wpdb;
    191 
    192195                if ( empty( $options ) ) {
    193196                        return;
    194197                }
    195198
    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.
    198224                // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    199                 $wpdb->query( 'BEGIN' );
     225                $wpdb->query( 'START TRANSACTION' );
    200226
    201227                foreach ( array_chunk( $options, $chunk_size, true ) as $chunk ) {
    … …  
    205231                        foreach ( $chunk as $option_name => $count ) {
    206232                                $placeholders[] = '(%s, %d, NOW())';
    207                                 $values[]       = $option_name;
     233                                $values[]       = (string) $option_name;
    208234                                $values[]       = (int) $count;
    209235                        }
    … …  
    214240
    215241                        // 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                        }
    217250                }
    218251
    219252                // 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' );
    221265        }
    222266
  • aaa-option-optimizer/tags/1.7.0/src/class-plugin.php

    r3479922 r3748520  
    11<?php
    22/**
    3  * Plugin functionality for AAA Option Optimizer.
     3 * Plugin functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    99
    1010/**
    11  * Core functionality of AAA Option Optimizer.
     11 * Core functionality of AAA Autoload Optimizer.
    1212 */
    1313class Plugin {
  • aaa-option-optimizer/tags/1.7.0/src/class-rest.php

    r3473518 r3748520  
    11<?php
    22/**
    3  * REST functionality for AAA Option Optimizer.
     3 * REST functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    1313
    1414/**
    15  * REST functionality of AAA Option Optimizer.
     15 * REST functionality of AAA Autoload Optimizer.
    1616 */
    1717class REST {
  • aaa-option-optimizer/trunk/aaa-option-optimizer.php

    r3479922 r3748520  
    55 * @package Progress_Planner\OptionOptimizer
    66 *
    7  * Plugin Name: AAA Option Optimizer
     7 * Plugin Name: AAA Autoload Optimizer
    88 * Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/
    99 * Description: Tracks autoloaded options usage and allows the user to optimize them.
    10  * Version: 1.6.1
     10 * Version: 1.7.0
    1111 * License: GPL-3.0+
    12  * Author: Team Prospress Planner
    13  * Author URI: https://prospressplanner.com/
     12 * Author: Team Progress Planner
     13 * Author URI: https://progressplanner.com/
    1414 * Text Domain: aaa-option-optimizer
    1515 */
  • aaa-option-optimizer/trunk/known-plugins/known-plugins.json

    r3473518 r3748520  
    11{
    22    "aaa-option-optimizer": {
    3         "name": "AAA Option Optimizer",
     3        "name": "AAA Autoload Optimizer",
    44        "option_prefixes": ["option_optimizer"]
    55    },
  • aaa-option-optimizer/trunk/package-lock.json

    r3324099 r3748520  
    11{
    22        "name": "aaa-option-optimizer",
    3         "version": "1.3.2",
     3        "version": "1.7.0",
    44        "lockfileVersion": 3,
    55        "requires": true,
    … …  
    77                "": {
    88                        "name": "aaa-option-optimizer",
    9                         "version": "1.3.2",
     9                        "version": "1.7.0",
    1010                        "license": "GPL-3.0-or-later",
    1111                        "devDependencies": {
  • aaa-option-optimizer/trunk/package.json

    r3324099 r3748520  
    11{
    22        "name": "aaa-option-optimizer",
    3         "version": "1.3.2",
     3        "version": "1.7.0",
    44        "private": true,
    55        "description": "WordPress plugin",
  • aaa-option-optimizer/trunk/readme.txt

    r3479922 r3748520  
    1 === AAA Option Optimizer ===
     1=== AAA Autoload Optimizer ===
    22Contributors: joostdevalk, aristath, filipi, progressplanner
    3 Tags: options, database, cleanup
     3Tags: autoload, options, database, performance, cleanup
    44Requires at least: 6.7
    5 Tested up to: 7.0
     5Tested up to: 7.1
     6Stable tag: 1.7.0
    67Requires PHP: 7.4
    7 Stable tag: 1.6.1
    8 License: GPL3+
     8License: GPL-3.0-or-later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
    1010
    11 Plugin that tracks autoloaded options usage and allows the user to optimize them.
     11Find and fix bloated autoloaded options slowing down your WordPress database
    1212
    1313== 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
     15Every WordPress site loads dozens — sometimes hundreds — of autoloaded
     16options from the `wp_options` table on every single page request. Many of
     17those options belong to plugins you removed long ago, or simply don't need
     18to be autoloaded. The result: a bigger database query, slower page loads,
     19and wasted server resources.
     20
     21**AAA Autoload Optimizer** tracks which autoloaded options your site actually
     22uses, then shows you the ones it doesn't — so you can safely remove them
     23or turn off autoloading.
     24
     25== How It Works ==
     26
     271. Install the plugin and browse your site normally for a few days.
     282. The plugin quietly records which autoloaded options are actually used
     29   during page rendering.
     303. Visit the settings screen to see every autoloaded option that was
     31   *never* used — and decide what to do with it.
     32
     33You can **remove** unused options entirely (great for leftover data from
     34deactivated plugins) or **disable autoloading** for options that exist but
     35don't need to load on every request. Disabling autoloading is
     36non-destructive — the option stays in your database, it just won't be
     37fetched 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
     58WordPress loads plugins alphabetically. Because this plugin needs to start
     59tracking options as early as possible, the `aaa-option-optimizer` slug
     60ensures it loads first. It's not vanity — it's a technical requirement for
     61accurate 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
     761. In your WordPress dashboard, go to **Plugins → Add New**.
     772. Search for **AAA Autoload Optimizer**.
     783. Click **Install Now**, then **Activate**.
     794. Browse your site normally for a few days — or visit every page
     80   manually if you're in a hurry.
     815. Go to **Tools → Autoload Optimizer** to review and optimize your
     82   autoloaded options.
     83
     84= Manual installation =
     85
     861. Download the plugin zip file.
     872. Upload it via **Plugins → Add New → Upload Plugin**, or extract it
     88   to `/wp-content/plugins/aaa-option-optimizer/` via FTP.
     893. Activate the plugin through the **Plugins** menu.
     904. Follow steps 4–5 above.
    1891
    1992== Frequently Asked Questions ==
    2093
    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
     96The safest action — disabling autoload — is non-destructive. The option
     97remains in your database and can still be loaded on demand. Deleting an
     98option is permanent, so only do that for options you're confident are no
     99longer needed (e.g., from plugins you've already removed). Always back up
     100your database before making bulk changes.
     101
     102= Can I undo changes? =
     103
     104Disabling autoload can be reversed from the "All Options" tab. Deleting
     105an option is permanent. If you need it back, you'll need to restore from
     106a database backup.
     107
     108= How long should I wait before optimizing? =
     109
     110A few days of normal browsing is usually enough. If you have a lot of
     111visitors, a few hours might even suffice. The goal is to visit every major
     112page on your site (front end and admin) so the plugin can record which
     113options are actually used. If you're thorough, you can start optimizing
     114sooner.
     115
     116= Does this work with WordPress multisite? =
     117
     118The plugin currently targets single-site installations. Multisite
     119compatibility has not been officially tested.
     120
     121= How do I know which options are safe to remove? =
     122
     123The plugin identifies the source of each option (which plugin, theme, or
     124WordPress core). If an option belongs to a plugin you've already
     125deactivated and removed, it's generally safe to delete. When in doubt,
     126disable autoloading instead of deleting — it's the safer choice.
    25127
    26128= Do I need to take precautions? =
    27129
    28 Yes!! Backup your database.
     130Yes, always back up your database before optimizing. Disabling autoload
     131is safe and reversible, but deleting options is permanent.
    29132
    30133= Where can I report bugs? =
    31134
    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.
     135Please use [the GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/)
     136for bug reports and code suggestions. The WordPress.org support forum
     137works too for general questions.
    35138
    36139= How can I report security issues? =
    37140
    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.
     141Through the Patchstack Vulnerability Disclosure Program. The Patchstack
     142team 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
     147Submit a pull request on GitHub to
     148[known-plugins.json](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json).
    49149
    50150== Screenshots ==
    51151
    52 1. Screenshot of the admin screen, initial tab.
    53 2. Screenshot of the "All options" screen, showing you can browse all the options.
     1521. The main dashboard showing unused autoloaded options with their size,
     153   source plugin, and action buttons.
     1542. 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 -->
    54158
    55159== Changelog ==
    56160
     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
    57168= 1.6.1 =
    58169
    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.
    65179
    66180= 1.5.1 =
    … …  
    105219
    106220* 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.
    108223* Added a "Reset data" button which resets the tracking data.
    109224* 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.
    113233
    114234= 1.1.1 =
    115235
    116 Implement the missing functionality to create an option with value `false` when it's being loaded but doesn't exist.
     236Implement the missing functionality to create an option with value
     237`false` when it's being loaded but doesn't exist.
    117238
    118239= 1.1 =
    119240
    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).
     241The plugin now recognizes plugins from which the options came (thanks to
     242a great pull by
     243[Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)).
     244If you're a plugin developer and want your plugin's options properly
     245recognized, please do a pull request on
     246[this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json).
    122247
    123248Small enhancements:
    124249
    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.
    126252* Action buttons are now centered in their columns.
    127253
    128254Bugs fixed:
    129255
    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.
    132263* Fixed issue where an empty option would result in weird size output.
    133264
    … …  
    135266
    136267* 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/).
    138271
    139272= 1.0.1 =
    140273
    141 Fixed an error with values that are objects, not strings, which also caused sorting not to work for some people.
     274Fixed an error with values that are objects, not strings, which also
     275caused sorting not to work for some people.
    142276
    143277= 1.0 =
    144278
    145279Initial release on GitHub and WordPress.org.
     280
     281== Upgrade Notice ==
     282
     283= 1.7.0 =
     284The plugin is now called AAA Autoload Optimizer. Also fixes bugs with
     285concurrent requests and W3 Total Cache.
     286
     287= 1.6.1 =
     288Fixes a potential fatal error from infinite recursion in option
     289monitoring on certain hosts.
     290
     291= 1.6.0 =
     292Performance and reliability: option tracking now uses a custom database
     293table instead of a single wp_option.
  • aaa-option-optimizer/trunk/src/class-admin-page.php

    r3473518 r3748520  
    11<?php
    22/**
    3  * Admin page functionality for AAA Option Optimizer.
     3 * Admin page functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    99
    1010/**
    11  * Admin page functionality for AAA Option Optimizer.
     11 * Admin page functionality for AAA Autoload Optimizer.
    1212 */
    1313class Admin_Page {
    … …  
    136136        public function add_admin_page() {
    137137                \add_management_page(
    138                         __( 'AAA Option Optimizer', 'aaa-option-optimizer' ),
    139                         __( 'Option Optimizer', 'aaa-option-optimizer' ),
     138                        __( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ),
     139                        __( 'Autoload Optimizer', 'aaa-option-optimizer' ),
    140140                        'manage_options',
    141141                        'aaa-option-optimizer',
    … …  
    272272                ?>
    273273                <div class="wrap">
    274                         <h1><?php \esc_html_e( 'AAA Option Optimizer', 'aaa-option-optimizer' ); ?></h1>
     274                        <h1><?php \esc_html_e( 'AAA Autoload Optimizer', 'aaa-option-optimizer' ); ?></h1>
    275275
    276276                        <?php if ( $migration_status['needs_migration'] ) : ?>
    … …  
    307307                                <div class="panel">
    308308                                        <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 Option Optimizer 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>
    310310
    311311                                        <table style="width:100%" id="unused_options_table" class="aaa_option_table">
    … …  
    348348                                        <?php // Render differences. ?>
    349349                                        <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 Option 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>
     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>
    351351                                        <table style="width:100%;" id="used_not_autoloaded_table" class="aaa_option_table">
    352352                                                <thead>
    … …  
    390390                                <div class="panel">
    391391                                        <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 Option 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>
     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>
    393393                                        <table width="100%" id="requested_do_not_exist_table" class="aaa_option_table">
    394394                                                <thead>
  • aaa-option-optimizer/trunk/src/class-database.php

    r3473518 r3748520  
    11<?php
    22/**
    3  * Database functionality for AAA Option Optimizer.
     3 * Database functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    182182         * for optimal performance on slow hosts with large datasets.
    183183         *
     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         *
    184189         * @param array<string, int> $options    Array of option_name => count.
    185190         * @param int                $chunk_size Number of options per query. Default 500.
    … …  
    188193         */
    189194        public static function batch_insert( $options, $chunk_size = 500 ) {
    190                 global $wpdb;
    191 
    192195                if ( empty( $options ) ) {
    193196                        return;
    194197                }
    195198
    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.
    198224                // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    199                 $wpdb->query( 'BEGIN' );
     225                $wpdb->query( 'START TRANSACTION' );
    200226
    201227                foreach ( array_chunk( $options, $chunk_size, true ) as $chunk ) {
    … …  
    205231                        foreach ( $chunk as $option_name => $count ) {
    206232                                $placeholders[] = '(%s, %d, NOW())';
    207                                 $values[]       = $option_name;
     233                                $values[]       = (string) $option_name;
    208234                                $values[]       = (int) $count;
    209235                        }
    … …  
    214240
    215241                        // 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                        }
    217250                }
    218251
    219252                // 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' );
    221265        }
    222266
  • aaa-option-optimizer/trunk/src/class-plugin.php

    r3479922 r3748520  
    11<?php
    22/**
    3  * Plugin functionality for AAA Option Optimizer.
     3 * Plugin functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    99
    1010/**
    11  * Core functionality of AAA Option Optimizer.
     11 * Core functionality of AAA Autoload Optimizer.
    1212 */
    1313class Plugin {
  • aaa-option-optimizer/trunk/src/class-rest.php

    r3473518 r3748520  
    11<?php
    22/**
    3  * REST functionality for AAA Option Optimizer.
     3 * REST functionality for AAA Autoload Optimizer.
    44 *
    55 * @package Progress_Planner\OptionOptimizer
    … …  
    1313
    1414/**
    15  * REST functionality of AAA Option Optimizer.
     15 * REST functionality of AAA Autoload Optimizer.
    1616 */
    1717class REST {
Note: See TracChangeset for help on using the changeset viewer.