Make WordPress Core

Opened 10 months ago

Closed 6 months ago

#61565 closed enhancement (wontfix)

Rename wp_maintenance to maybe_show_wp_maintenance

Reported by: ramon-fincken's profile ramon fincken Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.6
Component: Bootstrap/Load Keywords: has-unit-tests has-patch
Focuses: Cc:

Description

Conform [maybe_serialize https://developer.wordpress.org/reference/functions/maybe_serialize/] calling wp_maintenance may not result in a maintenance call.

wp_maintenance() calls [wp_is_maintenance_mode() https://github.com/WordPress/wordpress-develop/blob/6.5/src/wp-includes/load.php#L374] to determine if the mode should be triggered/shown or not.

Using wp_maintenance looks a lot like it is going to start a maintenance no matter what. ( wp_maintenance looks like do_wp_maintenance which does not exist ).

Therefore I propose a simple change, rewrite the function name to maybe_show_wp_maintenance for better readability.

Change History (9)

This ticket was mentioned in PR #6962 on WordPress/wordpress-develop by @ramon fincken.


10 months ago
#1

  • Keywords has-patch added

Trac ticket: [](https://core.trac.wordpress.org/ticket/61565)

Rename wp_maintenance to maybe_show_wp_maintenance

#2 @ramon fincken
10 months ago

The alternative would be:

OPEN
wp-settings.php

FIND

wp_maintenance();

REPLACE WITH

if( wp_is_maintenance_mode() ) {
        do_wp_maintenance();
}

OPEN
wp-includes/load.php

FIND

function wp_maintenance() {
        // Return if maintenance mode is disabled.
        if ( ! wp_is_maintenance_mode() ) {
                return;
        }

REPLACE WITH

function do_wp_maintenance() {

@debarghyabanerjee commented on PR #6962:


9 months ago
#3

@ramonfincken
Please update the Trac ticket details in the PR description. Thanks.

@ramon fincken commented on PR #6962:


9 months ago
#4

@ramonfincken Please update the Trac ticket details in the PR description. Thanks.

apparently it was lost in BB code, now it is present again.

#5 @jorbin
8 months ago

  • Keywords close added

Unfortunately we can't rename functions since doing so will break any site that is using that function and for a function that has been around since 3.0.0, this risk doesn't seem valuable. The alternative which is to have an alias function just adds bloat. Therefore I am going to recommend that we close this as wontfix.

#6 @ramon fincken
8 months ago

In that case, the alternative would be ( keeping all function names the same ) :

OPEN
wp-settings.php

FIND

wp_maintenance();

REPLACE WITH

if( wp_is_maintenance_mode() ) {
        wp_maintenance();
}

OPEN
wp-includes/load.php

FIND

function wp_maintenance() {
        // Return if maintenance mode is disabled.
        if ( ! wp_is_maintenance_mode() ) {
                return;
        }
       


REPLACE WITH

function wp_maintenance() {

#7 @jorbin
8 months ago

@ramon-fincken Can you explain what value you think this would bring? Refactoring requires proper justification and clear rationale. While it's not consistent with some other functions, there are about 14 years worth of documentation and examples out there about this function.

#8 @desrosj
6 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted

I'm going to close this one out. Unfortunately, this is an instance where we have to live with past naming decisions unless there are clear benefits that outweigh the risks.

#9 @desrosj
6 months ago

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.