Make WordPress Core


Ignore:
Timestamp:
02/20/2024 07:25:38 AM (16 months ago)
Author:
costdev
Message:

Plugin Dependencies: Remove auto-deactivation and bootstrapping logic.

Automatic deactivation of dependents with unmet dependencies requires a write operation to the database. This was performed during Core's bootstrap, which risked the database and cache becoming out-of-sync on sites with heavy traffic.

No longer loading plugins that have unmet requirements has not had a final approach decided core-wide, and is still in discussion in #60491 to be handled in a future release.

The plugin_data option, used to persistently store plugin data for detecting unmet dependencies during Core's bootstrap, is no longer needed.

Follow-up to [57545], [57592], [57606], [57617].

Props dd32, azaozz, swissspidy, desrosj, afragen, pbiron, zunaid321, costdev.
Fixes #60457. See #60491, #60510, #60518.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/plugin-dependencies/hasCircularDependency.php

    r57545 r57658  
    1717 */
    1818class Tests_Admin_WPPluginDependencies_HasCircularDependency extends WP_PluginDependencies_UnitTestCase {
     19
     20    /**
     21     * Tests that false is returned if Plugin Dependencies has not been initialized.
     22     *
     23     * @ticket 60457
     24     */
     25    public function test_should_return_false_before_initialization() {
     26        $this->set_property_value(
     27            'plugins',
     28            array(
     29                'dependent/dependent.php'   => array(
     30                    'Name'            => 'Dependent',
     31                    'RequiresPlugins' => 'dependency',
     32                ),
     33                'dependency/dependency.php' => array(
     34                    'Name'            => 'Dependency',
     35                    'RequiresPlugins' => 'dependent',
     36                ),
     37            )
     38        );
     39
     40        // Ensure Plugin Dependencies has not been initialized.
     41        $this->assertFalse(
     42            $this->get_property_value( 'initialized' ),
     43            'Plugin Dependencies has been initialized.'
     44        );
     45
     46        $this->assertSame(
     47            self::$static_properties['circular_dependencies_slugs'],
     48            $this->get_property_value( 'circular_dependencies_slugs' ),
     49            '"circular_dependencies_slugs" was not set to its default value.'
     50        );
     51
     52        $this->assertFalse(
     53            self::$instance->has_circular_dependency( 'dependency' ),
     54            'false was not returned before initialization.'
     55        );
     56    }
    1957
    2058    /**
Note: See TracChangeset for help on using the changeset viewer.