WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#14545 closed enhancement (worksforme)

move wp-settings from wp-config to wp-load

Reported by: wpmuguru Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Inline Docs Keywords: has-patch
Focuses: Cc:

Description

In 3.0 we added a number of constants which are manually added to wp-config.php. Some people are adding these to the bottom of the file after the stop editing & load of wp-settings.

This causes unpredictable behavior with some constants (ex. SUNRISE is defined in the admin area but sunrise.php isn't executed because SUNRISE was defined after loading wp-settings.

Attached is a patch that moves wp-settings.php to wp-load.php.

Attachments (3)

14545.diff (674 bytes) - added by wpmuguru 5 years ago.
14545-2.diff (666 bytes) - added by jkudish 4 years ago.
added better comments in wp-config-sample.php
14545-3.diff (643 bytes) - added by jkudish 4 years ago.

Download all attachments as: .zip

Change History (11)

@wpmuguru5 years ago

comment:1 follow-ups: @nacin5 years ago

This isn't backwards compatible... More than a few plugins call wp-config.php directly, hence the additional conditional ABSPATH define. This used to be the proper way to deeply integrate, now you should use either wp-load or wp-blog-header depending on your objective, or in most cases admin-ajax or admin-post. wp-load was created specifically so wp-config can be moved up one directory, so WP can be used as an SVN external.

The only way to handle this is to deliberately define certain constants as false where defining the constant will not produce incompatibilities with plugins. For example, [14000].

Additionally, this is more of an education thing. The line says don't add anything past it. What else can we do?

comment:2 in reply to: ↑ 1 @Denis-de-Bernardy5 years ago

Replying to nacin:

Additionally, this is more of an education thing. The line says don't add anything past it. What else can we do?

Break a few sites that use hopelessly obsolete plugins? The suggested approach seems right in terms of backwards compat IMO. I'd suggest using a slightly better metric, like a function or class exists call. Something that we're sure won't get overridden by a plugin, or an API change, basically. But it's really nit picking.

comment:3 in reply to: ↑ 1 @wpmuguru5 years ago

Replying to nacin:

This isn't backwards compatible...

It would work with any existing installs which load wp-settings in wp-config.

Replying to nacin:

More than a few plugins call wp-config.php directly, hence the additional conditional ABSPATH define.

Good point. It would break those plugins in new installs.

Replying to nacin:

What else can we do?

Yeah, I know. A bit of a rock and hard place. What about adding a last comment line instructing adding above the stop editing line?

comment:4 @nacin4 years ago

  • Component changed from General to Inline Docs
  • Keywords needs-patch 3.2-early added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release

What about adding a last comment line instructing adding above the stop editing line?

Sure.

@jkudish4 years ago

added better comments in wp-config-sample.php

comment:5 @jkudish4 years ago

  • Cc joachim.kudish@… added
  • Keywords has-patch added; needs-patch 3.2-early removed

comment:6 follow-up: @wpmuguru4 years ago

@jkudish - I would make the last line you added say "Do not anything below this line."

Adding the extra comment at the bottom would address this one afaic.

Version 0, edited 4 years ago by wpmuguru (next)

@jkudish4 years ago

comment:7 in reply to: ↑ 6 @jkudish4 years ago

Replying to wpmuguru:

@jkudish - I would make the last line you added say "Do not add anything below this line."

Adding the extra comment at the bottom would address this one afaic.

Edited to add the word add above.

sure done!

comment:8 @nacin3 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.