Enforce leading and trailing slashes on paths updated with `update_blog_details()`
In multisite, core expects the stored value for a site's path to have leading and trailing slashes. When these slashes are missing, it becomes impossible to visit the site. This enforces proper `/path/` creation in `update_blog_details()`, most likely used when updating an existing site through `site-info.php`. Props earnjam, simonwheatley. Fixes #18117. Fixes #23865. Built from https://develop.svn.wordpress.org/trunk@31155 git-svn-id: http://core.svn.wordpress.org/trunk@31136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
34636a0e41
commit
eaf7f8df74
|
@ -296,8 +296,14 @@ function update_blog_details( $blog_id, $details = array() ) {
|
|||
|
||||
$update_details = array();
|
||||
$fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
|
||||
foreach ( array_intersect( array_keys( $details ), $fields ) as $field )
|
||||
foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) {
|
||||
if ( 'path' === $field ) {
|
||||
$details[ $field ] = array_filter( explode( '/', $details[ $field ] ) );
|
||||
$details[ $field ] = trailingslashit( '/' . implode( '/', $details[ $field ] ) );
|
||||
}
|
||||
|
||||
$update_details[ $field ] = $details[ $field ];
|
||||
}
|
||||
|
||||
$result = $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31154';
|
||||
$wp_version = '4.2-alpha-31155';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue