Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#42622 closed defect (bug) (fixed)

Maintenance Mode / DB Repair

Reported by: munklefish Owned by: dd32
Priority: low Milestone: 5.1
Component: Administration Version: 2.9
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Adding

define('WP_ALLOW_REPAIR', true);

to WP-config.php enable the database optimisation/repair mode as expected. However, setting the value to false is also interpreted as if it were true.

eg:

define('WP_ALLOW_REPAIR', false);

I suspect that the properly formated presence of this constant will be interpreted as if it were true regardless of the actual content, although I have not tested this.

Attachments (1)

42622.patch​ (414 bytes ) - added by tiagohillebrandt 9 years ago.

Download all attachments as: .zip

Change History (7)

#1 @dd32
9 years ago

  • Component General → Administration
  • Priority normal → low
  • Version 4.9 → 2.9

Hey @munklefish and welcome to Trac.

This is mostly intentional, we base the script being available based upon the constant being defined, not what the value of it is.

#11717 is kind-of a duplicate, I'm going to leave this ticket open though, as requiring it be non-falsey makes sense to me - however, it's worth noting it's been this way for 8+ years deliberately.

#2 @dd32
9 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review → 5.0

Thanks for the patch @tiagohillebrandt!

For future contributions - please note that our ticketing system doesn't trigger email notifications when attachments are added, adding a comment mentioning you've uploaded a patch (and setting the has-patch keyword) allows us to review them as they come in. Including details of how it's tested and what edge-cases you've taken into account also greatly helps.

Looking at 42622.patch​, it can be simplified to the following:

if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) { 

#3 @dd32
9 years ago

  • Owner set to dd32
  • Resolution → fixed
  • Status new → closed

In 42205:

DB Repair: Only allow non-falsey values of WP_ALLOW_REPAIR to access the DB repair functionality.
This allows defining the constant as false to prevent access (rather than requiring the constant to be removed entirely).

Props tiagohillebrandt, munklefish.
See #11717.
Fixes #42622.

#4 @swissspidy
9 years ago

#43245 was marked as a duplicate.

#5 @swissspidy
9 years ago

#43245 was marked as a duplicate.

#6 @pento
8 years ago

  • Milestone 5.0 → 5.1
Note: See TracTickets for help on using tickets.