Make WordPress Core

Opened 11 years ago

Closed 22 months ago

Last modified 12 months ago

#24049 closed defect (bug) (worksforme)

Make Plugin Editor's file list alphabetical by full path

Reported by: daedalon's profile Daedalon Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Plugins Keywords:
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)

24049.diff (385 bytes) - added by Daedalon 11 years ago.
ticket24049.diff (1.4 KB) - added by Daedalon 11 years ago.
Sorts file list alphabetically by full path and improves performance of get_plugin_files() by calling plugin_basename() only once
24049v2.diff (1.2 KB) - added by MattyRob 10 years ago.

Download all attachments as: .zip

Change History (16)

@Daedalon
11 years ago

@Daedalon
11 years ago

Sorts file list alphabetically by full path and improves performance of get_plugin_files() by calling plugin_basename() only once

#1 @Daedalon
11 years ago

  • Keywords has-patch added
  • Version set to trunk

#2 @SergeyBiryukov
11 years ago

  • Version changed from trunk to 2.8

#3 @MattyRob
10 years ago

I have tested this patch and it works fine for me. Commit?

#4 @godhulii_1985
10 years ago

Please commit this patch. It works...

#5 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.1
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#6 @MattyRob
10 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.

@MattyRob
10 years ago

#7 @MattyRob
10 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 @johnbillion
9 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

#9 @dd32
9 years ago

Vaguely related: #17552

#10 @chriscct7
8 years ago

  • Focuses administration added

#11 @SergeyBiryukov
5 years ago

  • Keywords close added; needs-unit-tests needs-patch removed

This appears to be fixed in [41806], I can't reproduce any issues with file order in current trunk. The list includes:

  • The main plugin file.
  • The rest of the files, in alphabetical order.

#12 @desrosj
22 months ago

  • Keywords close removed
  • Resolution set to worksforme
  • Status changed from accepted to closed

I am also unable to reproduce this one. The only thing that feels a bit strange is that files beginning with a capital letter appear before any starting with lowercase. But they are all sorted alphabetically in those two groups. Some common files that "rise to the top" and appear under the main plugin file are any CHANGELOG/CONTRIBUTING/LICENSE/README.md files.

I think this is acceptable, though, and this one can be considered fixed by way of [41806].

#13 @helgatheviking
12 months ago

Could this be reopened? I have this problem am the time in my local environment (that i know of) and it's really annoying.

https://twitter.com/Kathy_Darling/status/1658886811614052368?t=hNttzcEKZab8DCi4tWM1DQ&s=19

Ideally I'd to see
Folder1
Folder2
File1
File2

Instead of the current mishmash

Note: See TracTickets for help on using tickets.