WordPress.org

Make WordPress Core

Opened 7 months ago

Closed 7 months ago

Last modified 4 months ago

#37827 closed enhancement (fixed)

Some classes still need to be moved into their own file

Reported by: wonderboymusic Owned by:
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: General Keywords:
Focuses: Cc:

Description

After #33413, and winking at #36335, there a few places that classes still need to be copied over into their own file.

This was done extensively in 4.4 via svn cp, and blame remains intact for past history / commits: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/widgets/class-wp-widget-links.php?annotate=blame

Attachments (5)

37827.diff (148.7 KB) - added by wonderboymusic 7 months ago.
37827.2.diff (32.2 KB) - added by wonderboymusic 7 months ago.
37827.3.diff (22.4 KB) - added by wonderboymusic 7 months ago.
37827.4.diff (32.0 KB) - added by wonderboymusic 7 months ago.
37827.5.diff (359.8 KB) - added by wonderboymusic 7 months ago.

Download all attachments as: .zip

Change History (25)

#1 @wonderboymusic
7 months ago

In 38351:

Query: move WP_Query into its own file via svn cp.

See #37827.

#2 @wonderboymusic
7 months ago

In 38352:

Diff: move WP_Text_Diff_Renderer_inline (behold that lowercase "i") and WP_Text_Diff_Renderer_Table into their own files via svn cp.

See #37827.

#3 @wonderboymusic
7 months ago

In 38353:

Session: move WP_Session_Tokens and WP_User_Meta_Session_Tokens into their own files via svn cp. If we move forard with autoloading, session.php is useless. We could even remove it now, and just load these new files in wp-settings.php. That can be decided post-mortem.

See #37827.

#4 @wonderboymusic
7 months ago

In 38354:

Feed: move 'WP_Feed_Cache', 'WP_Feed_Cache_Transient', WP_SimplePie_File and WP_SimplePie_Sanitize_KSES into their own files via svn cp. If we move forard with autoloading, class-feed.php is useless. We could even remove it now, and just load these new files in wp-settings.php. That can be decided post-mortem. class-feed.php is an interesting name: there is no Feed or WP_Feed class.

See #37827.

#5 @wonderboymusic
7 months ago

In 38361:

OEmbed: move _wp_oembed_get_object() to embed.php, where all of the other embed functions live. WP_oEmbed is then in a file by itself. Load class-oembed.php in wp-settings.php and remove extraneous include calls.

See #37827.

#6 @wonderboymusic
7 months ago

In 38362:

Embed: wp-settings.php loads class-wp-embed.php, which currently produces side effects. Move the global instantiation to wp-settings.php. WP_Embed is then in a file by itself.

See #37827.

#7 @wonderboymusic
7 months ago

In 38363:

Load: move is_wp_error() to load.php so that WP_Error is in a file by itself.

See #37827.

#8 follow-up: @wonderboymusic
7 months ago

In 38364:

i18n: move is_rtl() to l10n.php (which loads way earlier). Load WP_Locale file in wp-settings.php. Retire wp-includes/locale.php - it only loaded the class and the one function, is_rtl(). If someone loaded this file for fun somewhere else, it would be a fatal error.

See #37827.

#9 @wonderboymusic
7 months ago

In 38375:

Script Loader: move _WP_Dependency into its own file.

See #37827.

#10 @wonderboymusic
7 months ago

In 38376:

Load: move WP_MatchesMapRegex into its own file.

See #37827.

#11 follow-up: @wonderboymusic
7 months ago

In 38379:

Upgrade/Install: wp-admin/includes/class-wp-upgrader-skins.php is unused, remove it. All of the same includes are loaded in class-wp-upgrader.php.

See #37827.

#12 @wonderboymusic
7 months ago

In 38389:

XML-RPC: break up class-IXR.php into individual class files.

See #37827.

#13 @wonderboymusic
7 months ago

In 38392:

List Tables: move _WP_List_Table_Compat into its own file.

See #37827.

#14 @dd32
7 months ago

In 38404:

i18n: Retire another remaining wp-includes/locale.php require, and instead load the required WP_Locale class directly.

See #37827.

#15 in reply to: ↑ 8 @dd32
7 months ago

Replying to wonderboymusic:

In 38364:

i18n: move is_rtl() to l10n.php (which loads way earlier). Load WP_Locale file in wp-settings.php. Retire wp-includes/locale.php - it only loaded the class and the one function, is_rtl(). If someone loaded this file for fun somewhere else, it would be a fatal error.

See #37827.

AFAICT this has caused a fatal when wp_die() is called upon mu-plugin/plugin inclusion, as the function now exists much earlier than it can be called.

#16 @wonderboymusic
7 months ago

In 38438:

i18n: after r38364, check that global $wp_locale is an instance of WP_Locale before calling ->is_rtle() in is_rtl().

See #37827.

#17 @wonderboymusic
7 months ago

  • Resolution set to fixed
  • Status changed from new to closed

#18 @pento
7 months ago

In 38496:

Bootstrap: class-wp-locale.php needs to be require_once()-ed.

After [38364], the inclusion of class-wp-locale.php was changed from a require_once() to a require(). This caused problems for anything that called load_text_domain_early() prior to the require() but didn't bail, as it was now being require()-ed a second time.

With the use of require_once(), it doesn't really matter where it's loaded, so it has been moved next to the related l10n.php load.

See #37827.

#19 in reply to: ↑ 11 @ocean90
7 months ago

Replying to wonderboymusic:

In 38379:

Upgrade/Install: wp-admin/includes/class-wp-upgrader-skins.php is unused, remove it. All of the same includes are loaded in class-wp-upgrader.php.

See #37827.

This is going to break plugins - if there won't be an autoloader in 4.7 - which doif ( ! class_exists( 'WP_Upgrader_Skin' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader-skins.php'; }.

See also ticket:36335:185. I think there should be a deprecation notice first.

#20 @pento
4 months ago

In 39455:

Load: Re-add locale.php.

locale.php is occasionally included directly by custom external code, so should continue to be available. This behaviour is deprecated.

Partial revert of [38364].
See #37827, #39027.

Note: See TracTickets for help on using tickets.