Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#42622 closed defect (bug) (fixed)

Maintenance Mode / DB Repair

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

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 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @dd32
7 years ago

  • Component changed from General to Administration
  • Priority changed from normal to low
  • Version changed from 4.9 to 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
7 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 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
7 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to 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
7 years ago

#43245 was marked as a duplicate.

#5 @swissspidy
7 years ago

#43245 was marked as a duplicate.

#6 @pento
6 years ago

  • Milestone changed from 5.0 to 5.1
Note: See TracTickets for help on using tickets.