WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 2 months ago

Last modified 2 months ago

#37199 closed enhancement (fixed)

Strengthen language in wp-config-sample.php

Reported by: kraftbj Owned by: jorbin
Milestone: 5.8 Priority: low
Severity: minor Version:
Component: Bootstrap/Load Keywords: has-patch commit
Focuses: Cc:

Description

The current /* That's all, stop editing! Happy blogging. */ line can be easily misunderstood when a novice power user is editing/adding things to their wp-config.php file.

We can tweak the language to avoid confusion and folks adding any custom define values after the line to call wp-settings.php.

Attachments (4)

37199.diff (548 bytes) - added by kraftbj 5 years ago.
Add a specific reference to where custom values should go and strengthen to the do not edit warning.
37199.2.diff (509 bytes) - added by SergeyBiryukov 2 months ago.
37199.3.diff (613 bytes) - added by SergeyBiryukov 2 months ago.
37199.4.diff (609 bytes) - added by SergeyBiryukov 2 months ago.

Download all attachments as: .zip

Change History (24)

@kraftbj
5 years ago

Add a specific reference to where custom values should go and strengthen to the do not edit warning.

#1 @swissspidy
5 years ago

  • Summary changed from Strengthen language in wp-content-sample.php to Strengthen language in wp-config-sample.php

#2 @kraftbj
5 years ago

Seeing [37902], I need to refresh the patch to include updating that function too.

This ticket was mentioned in Slack in #polyglots by sergey. View the logs.


5 years ago

#4 @xibe
5 years ago

Piggy-backing on this and wondering if this could be an opportunity to rid us of the outdated (or at least, less used) "blogging" reference :)

This ticket was mentioned in Slack in #core by jorbin. View the logs.


5 years ago

#6 @jorbin
5 years ago

  • Keywords has-patch removed

Discussed this during a bug scrub today, The direction that was decided is:

1) Keep the existing final line, but add in a line /* Add any custom values above this line. */ above it. That language likely can be improved. Suggestions welcome.

2) Need to make sure to work with polyglots for locales that customize wp-config-sample.php

#7 @kraftbj
5 years ago

Maybe something like "Any customization must occur above this line.", "Do not change or add anything beyond this point/after this line"?

#9 @jorbin
2 months ago

  • Milestone changed from Awaiting Review to 5.8

#10 @jorbin
2 months ago

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

In 50915:

Boostrap/Load: Strengthen language in wp-config-sample.php

Make it clearer where custom pieces belong in wp-config.php

Props kraftbj, jorbin.
Fixes #37199.

#11 @SergeyBiryukov
2 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

There are some references to these lines on Network Setup screen:

As it is now, anyone following these instructions directly and not familiar with how PHP works might accidentally place the code inside the PHP comment block, which would not work as intended.

Should these instructions be updated for the new wording?

#12 @SergeyBiryukov
2 months ago

  • Keywords has-patch commit added

I think an easy solution to comment:11 would be to place all of the comment on a single line, as it was in 37199.diff.

This pushes the line to 94 characters, which is a bit higher than the recommended cut-off point of 80 characters as per the documentation standards, but is still within the limit of 120 characters.

See 37199.2.diff.

Last edited 2 months ago by SergeyBiryukov (previous) (diff)

#13 @jorbin
2 months ago

I think you are correct to put it on a single line as it will help folks who are less familiar with PHP.

#14 @jorbin
2 months ago

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

In 50917:

Boostrap/Load: Have language in wp-config-sample.php better match install instructions.

Help prevent errors from users who are less familiar with php from adding code in side the comment block and thus having their code not work. Therefore, this comment is now a single line.

Follow up to [50915].

Fixes #37199.
Props SergeyBiryukov.

This ticket was mentioned in Slack in #core by sergey. View the logs.


2 months ago

#16 @swissspidy
2 months ago

FWIW this breaks WP-CLI's `wp config update` command, which currently looks for "/* That's all, stop editing!" in wp-config.php

See https://github.com/wp-cli/wp-config-transformer/blob/cc4007e8d88fb6d79e433421e5952b489bbb0c8b/src/WPConfigTransformer.php#L135

Maybe this can be fixed on the WP-CLI side though, but I thought I'd mention it here so we can consider undoing the change on the WP side.

cc @schlessera

#17 @schlessera
2 months ago

Thanks for the ping, @swissspidy!

There are probably more integrations that this will break apart from WP-CLI, as most managed hosting platforms customize the config file in some form or other.

For WP-CLI I can plan a more flexible anchor pattern to take this into account, but I wonder whether it wouldn't be a good opportunity to rethink the configuration file in general, if we're already breaking existing integrations anyway...

For example, how about allowing for a configuration file to only contain configuration, and not be a needed part of the loading process (i.e. right now there is a hard require of wp-settings.php directly in the config file)?

So, WP could for example pull in the configuration file, and then, if WP was not already loaded in the next line of code, load wp-settings.php from there. This way, the wp-config.php file would actually be what its names claims to be.

#18 @SergeyBiryukov
2 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening to address the concerns of backward compatibility with various integrations.

I think we can restore that line as it was, and just expand the line above a bit more. That should still make the message clear while avoiding unnecessary breakage. See 37199.3.diff.

#19 @SergeyBiryukov
2 months ago

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

In 50946:

Boostrap/Load: Further update the language in wp-config-sample.php.

This restores "That's all, stop editing!" line to its previous format, to avoid breaking external integrations looking for that format specifically.

Follow up to [50915], [50917], [50918].

Props swissspidy, schlessera.
Fixes #37199.

#20 @jorbin
2 months ago

#29688 was marked as a duplicate.

Note: See TracTickets for help on using tickets.