Make WordPress Core

Opened 15 years ago

Closed 13 years ago

#14545 closed enhancement (worksforme)

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

Reported by: wpmuguru's profile 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 15 years ago.
14545-2.diff (666 bytes) - added by jkudish 14 years ago.
added better comments in wp-config-sample.php
14545-3.diff (643 bytes) - added by jkudish 14 years ago.

Download all attachments as: .zip

Change History (11)

@wpmuguru
15 years ago

#1 follow-ups: @nacin
15 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?

#2 in reply to: ↑ 1 @Denis-de-Bernardy
15 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.

#3 in reply to: ↑ 1 @wpmuguru
15 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?

#4 @nacin
14 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.

@jkudish
14 years ago

added better comments in wp-config-sample.php

#5 @jkudish
14 years ago

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

#6 follow-up: @wpmuguru
14 years ago

@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.

Last edited 14 years ago by wpmuguru (previous) (diff)

@jkudish
14 years ago

#7 in reply to: ↑ 6 @jkudish
14 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!

#8 @nacin
13 years ago

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