WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 20 months ago

#15907 closed defect (bug) (wontfix)

inconsistent handling of plugin_folder in get_plugins()

Reported by: wpmuguru Owned by: dd32
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch 3.2-early
Focuses: Cc:

Description

If you pass the name of a folder to get_plugins, it needs to have a leading slash which then stores the plugin list from that folder in $wp_plugins['/folder-name'].

Secondly, the plugin file/path does not include folder-name passed to get_plugins, so the returned data has to have the 'folder-name/' added to the key of each plugin's information before it can be used throughout WP. The code I'm currently using to work around the issue is

			$my_plugins = get_plugins( '/extra' );
			$extra = array();
			if( !empty( $my_plugins ) ) {
				foreach( $my_plugins as $k => $v )
					$extra['extra/' . $k] = $v;
			}

related #15906

Attachments (4)

15907.diff (999 bytes) - added by wpmuguru 4 years ago.
15907.2.diff (1.1 KB) - added by wonderboymusic 2 years ago.
15907.3.diff (1.0 KB) - added by MikeHansenMe 2 years ago.
Refreshed relative to root.
15907.4.diff (1.0 KB) - added by DrewAPicture 2 years ago.

Download all attachments as: .zip

Change History (12)

@wpmuguru4 years ago

comment:1 @sterlo4 years ago

Possibly related? #15853

comment:2 @nacin4 years ago

  • Keywords 3.2-early added
  • Milestone changed from Awaiting Review to Future Release

@wonderboymusic2 years ago

comment:3 @wonderboymusic2 years ago

  • Milestone changed from Future Release to 3.6

Refreshed against trunk

@MikeHansenMe2 years ago

Refreshed relative to root.

@DrewAPicture2 years ago

comment:4 @DrewAPicture2 years ago

15907.4.diff fixes spacing in the changed code, uses clearer concat for $plugin_files[].

comment:5 @ocean9022 months ago

  • Milestone changed from 3.6 to Future Release

comment:6 @wonderboymusic21 months ago

  • Milestone changed from Future Release to 3.7

Latest patch applies cleanly

comment:7 @nacin20 months ago

  • Owner set to dd32
  • Status changed from new to assigned

comment:8 @dd3220 months ago

  • Milestone 3.7 deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed
  • Backwards incompatible change
  • The function returns data relative to WP_PLUGINS_DIR, or, optionally, relative to WP_PLUGINS_DIR/$folder in the event one is passed

Anyone calling it with a folder name will know the prefix if they require it for something.

Closing as wontfix for now, but if someone can come up with an actual use-case we can re-evaluate it, I can think of no reason why a change here is needed.

Note: See TracTickets for help on using tickets.