Make WordPress Core


Ignore:
Timestamp:
02/06/2024 11:44:09 PM (14 months ago)
Author:
costdev
Message:

Upgrade/Install: Introduce Plugin Dependencies.

Introduces a new "Requires Plugins" plugin header so that plugin developers can list the slugs of the plugins theirs depends on.

This will inform users of the requirements, and provide links to the WordPress.org Plugins Repository that they can click to install and activate the dependencies first.

Plugins whose requirements are not met cannot be installed or activated, and they will be deactivated automatically if their requirements become unmet.
Plugins that others rely on cannot be deactivated or deleted until their dependent plugins are deactivated or deleted.

In memory of Alex Mills and Alex King.
WordPress Remembers.

Props ahoereth, afragen, alanfuller, alexkingorg, amykamala, anonymized_10690803, apeatling, ashfame, atimmer, audrasjb, aristath, azaozz, batmoo, beaulebens, blobaugh, bobbingwide, boonebgorges, brianhenryie, chanthaboune, chrisdavidmiles, coolmann, costdev, courane01, danielbachhuber, davidperez, dd32, Denis-de-Bernardy, dingo_d, DJPaul, dougal, DrewAPicture, ethitter, filosofo, georgestephanis, giuseppemazzapica-1, goldenapples, griffinjt, hellofromTonya, husobj, ideag, jarednova, jbobich, jbrinley, jltallon, joedolson, johnciacia, johnjamesjacoby, joppuyo, jsmoriss, karmatosed, kebbet, knutsp, kraftbj, kraftner, kurtpayne, lkraav, logikal16, luisherranz, man4toman, markjaquith, matt, mbijon, megphillips91, mikeschinkel, mordauk, morehawes, mrwweb, mte90, mukesh27, mzaweb, nacin, norcross, nvwd, nwjames, obliviousharmony, ocean90, oglekler, paaljoachim, pauldewouters, pbaylies, pbiron, peterwilsoncc, Philipp15b, poena, pogidude, retlehs, rmccue, ryan, sabreuse, sc0ttkclark, scribu, sereedmedia, SergeyBiryukov, ShaneF, shidouhikari, soean, spacedmonkey, stephenh1988, swissspidy, taylorde, tazotodua, threadi, TimothyBlynJacobs, TJNowell, tollmanz, toscho, tropicalista, Viper007Bond, westi, whiteshadow, williamsba1, wpsmith, ZaneMatthew.
Fixes #22316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r57504 r57545  
    987987    $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
    988988
     989    $invalid_plugins = array();
    989990    foreach ( $active_plugins as $plugin ) {
    990991        if ( ! validate_file( $plugin )                     // $plugin must validate as file.
     
    995996        ) {
    996997            $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
     998        } else {
     999            $invalid_plugins[] = $plugin;
     1000        }
     1001    }
     1002
     1003    if ( ! empty( $invalid_plugins ) ) {
     1004        $all_plugin_data = get_option( 'plugin_data', array() );
     1005
     1006        if ( ! empty( $all_plugin_data ) ) {
     1007            foreach ( $invalid_plugins as $invalid_plugin ) {
     1008                unset( $all_plugin_data[ $invalid_plugin ] );
     1009            }
     1010
     1011            update_option( 'plugin_data', $all_plugin_data );
    9971012        }
    9981013    }
     
    11911206        'update-plugin',          // Update an existing plugin.
    11921207        'update-theme',           // Update an existing theme.
     1208        'activate-plugin',        // Activating an existing plugin.
    11931209    );
    11941210
Note: See TracChangeset for help on using the changeset viewer.