Opened 7 years ago
Last modified 12 months ago
#24049 accepted defect (bug)
Make Plugin Editor's file list alphabetical by full path
Reported by: | Daedalon | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.8 |
Component: | Plugins | Keywords: | close |
Focuses: | administration | Cc: |
Description
The files under Plugin Editor's (plugin-editor.php) Plugin Files header should be shown in alphabetical order of their full path. Currently their order seems completely random, which makes the list cumbersome to use.
Attachments (3)
Change History (14)
#5
@
6 years ago
- Milestone changed from Awaiting Review to 4.1
- Owner set to SergeyBiryukov
- Status changed from new to accepted
#6
@
6 years ago
Sorry to report on further testing that this doesn't work fully.
By returning a sorted list of plugin files the 'first' entry returned may not be the main plugin file and it may also not be a file supported in the editor - resulting in unusual behaviour.
The sort needs to return the array with the main file at the start of the array or somehow that file needs to be 'selected' by default.
#7
@
6 years ago
Attached patch resolves the issued stated above by placing the main plugin file name at the start of the returned array.
I've also dropped the root file sorting section with the preg_match - it doesn't seem to change the returned values and also causes errors as the regex is not properly contained - I was getting lots of errors log about invalid operators.
#8
@
6 years ago
- Keywords needs-unit-tests needs-patch added; has-patch removed
- Milestone changed from 4.1 to Future Release
If you select a file in a subdirectory for editing, the list of files in the sidebar completely breaks, and the current plugin is not correctly selected. I can't believe there isn't an existing ticket for this.
I think that's closely related to this and they should be fixed together. get_plugin_files()
should probably always be passed the plugin's root file, not the file being currently edited.
We should also get some unit tests on this.
Related: #24048
Sorts file list alphabetically by full path and improves performance of get_plugin_files() by calling plugin_basename() only once