Make WordPress Core

Opened 5 years ago

Last modified 8 weeks ago

#25819 reopened defect (bug)

"ms_files_rewriting" site option is not created during upgrades

Reported by: gradyetc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.5
Component: Upgrade/Install Keywords: needs-patch, bulk-reopened
Focuses: multisite Cc:


While testing an upgrade for a MU era multisite install from 3.1.4 -> 3.6.1 I discovered that the "ms_files_rewriting" site option was not being created.

The attempt in upgrade_network()...

if ( $wp_current_db_version < 21823 )
 	update_site_option( 'ms_files_rewriting', '1' );

... is failing. I believe this has gone unnoticed since the default value is forced to true in wp-includes/ms-default-filters.php:

// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );

Attachments (1)

25819.patch (503 bytes) - added by gradyetc 5 years ago.

Download all attachments as: .zip

Change History (10)

5 years ago

#1 @gradyetc
5 years ago

The call to update_site_option( 'ms_files_rewriting', '1' ) in upgrade_network() is failing due to that filter.

In most cases the "ms_files_rewriting" site option will not exist when running the upgrade. The default value added by that filter causes the check within update_site_option that would normally add it to fail:

if ( false === $oldvalue )
	return add_site_option( $option, $value );

The end result is it continues, attempting to UPDATE a non-existent meta_key within wp_sitemeta.

UPDATE `wp_sitemeta` SET `meta_value` = '1' WHERE `site_id` = 1 AND `meta_key` = 'ms_files_rewriting'

A fix is attached in 25819.patch.

#2 @SergeyBiryukov
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.8

#3 @dd32
5 years ago

25819.patch looks good, however, it'll only apply to future users updating their networks, anyone who has updated past-3.5 won't trigger this again.

Perhaps we should also add a 3.8 update check that checks to see if the row exists in the DB at all, and if not, creates it?

#4 @nacin
5 years ago

  • Keywords 3.9-early added
  • Milestone changed from 3.8 to Future Release

Let's deal with this at once.

#5 @gradyetc
5 years ago

Perhaps something like this in upgrade_network() or a 3.9 upgrade routine?

$ms_files_rewriting = get_site_option( 'ms_files_rewriting' );

remove_all_filters( 'default_site_option_ms_files_rewriting' );

if ( get_site_option( 'ms_files_rewriting' ) != $ms_files_rewriting ) {
	update_site_option( 'ms_files_rewriting', intval( $ms_files_rewriting ) );

#6 @chriscct7
4 years ago

  • Keywords needs-patch added; has-patch 3.9-early removed
  • Severity changed from minor to normal

#7 @jeremyfelt
3 years ago

  • Focuses multisite added

#8 @iseulde
4 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#9 @JeffPaul
8 weeks ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.