Skip to content

Commit

Permalink
Inject TGM_Plugin_Activation into TGMPA_Bulk_Installer
Browse files Browse the repository at this point in the history
This allows each bulk installer to use its corresponding TGMPA instance, instead of all installers using the same global instance.

TGMPA#804
  • Loading branch information
XedinUnknown committed Apr 27, 2021
1 parent 989ab79 commit 5f46fa6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,7 @@ public function process_bulk_actions() {

// Create a new instance of TGMPA_Bulk_Installer.
$installer = new TGMPA_Bulk_Installer(
$this->tgmpa,
new TGMPA_Bulk_Installer_Skin(
array(
'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ),
Expand Down Expand Up @@ -3284,14 +3285,14 @@ class TGMPA_Bulk_Installer extends Plugin_Upgrader {
*
* @since 2.2.0
*
* @param TGM_Plugin_Activation $tgmpa The TGMPA instance to be used by this class.
* @param \Bulk_Upgrader_Skin|null $skin Installer skin.
*/
public function __construct( $skin = null ) {
// Get TGMPA class instance.
$this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );

public function __construct( $tgmpa, $skin = null ) {
parent::__construct( $skin );

$this->tgmpa = $tgmpa;

if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) {
$this->clear_destination = true;
}
Expand Down

0 comments on commit 5f46fa6

Please sign in to comment.