Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#15907 closed defect (bug) (wontfix)

inconsistent handling of plugin_folder in get_plugins()

Reported by: wpmuguru's profile wpmuguru Owned by: dd32's profile 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 14 years ago.
15907.2.diff (1.1 KB) - added by wonderboymusic 12 years ago.
15907.3.diff (1.0 KB) - added by MikeHansenMe 12 years ago.
Refreshed relative to root.
15907.4.diff (1.0 KB) - added by DrewAPicture 12 years ago.

Download all attachments as: .zip

Change History (12)

@wpmuguru
14 years ago

#1 @sterlo
14 years ago

Possibly related? #15853

#2 @nacin
14 years ago

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

#3 @wonderboymusic
12 years ago

  • Milestone changed from Future Release to 3.6

Refreshed against trunk

@MikeHansenMe
12 years ago

Refreshed relative to root.

#4 @DrewAPicture
12 years ago

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

#5 @ocean90
11 years ago

  • Milestone changed from 3.6 to Future Release

#6 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.7

Latest patch applies cleanly

#7 @nacin
11 years ago

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

#8 @dd32
11 years 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.