Make WordPress Core


Ignore:
Timestamp:
02/06/2024 11:44:09 PM (4 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-admin/includes/class-plugin-upgrader.php

    r57239 r57545  
    155155        // Force refresh of plugin update information.
    156156        wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
     157
     158        $all_plugin_data = get_option( 'plugin_data', array() );
     159        $plugin_file     = $this->new_plugin_data['file'];
     160        unset( $this->new_plugin_data['file'] );
     161        $all_plugin_data[ $plugin_file ] = $this->new_plugin_data;
     162        update_option( 'plugin_data', $all_plugin_data );
    157163
    158164        if ( $parsed_args['overwrite_package'] ) {
     
    483489                $info = get_plugin_data( $file, false, false );
    484490                if ( ! empty( $info['Name'] ) ) {
    485                     $this->new_plugin_data = $info;
     491                    $basename = basename( $file );
     492                    $dirname  = basename( dirname( $file ) );
     493
     494                    if ( '.' === $dirname ) {
     495                        $plugin_file = $basename;
     496                    } else {
     497                        $plugin_file = "$dirname/$basename";
     498                    }
     499                    $this->new_plugin_data         = ( $info );
     500                    $this->new_plugin_data['file'] = $plugin_file;
    486501                    break;
    487502                }
Note: See TracChangeset for help on using the changeset viewer.