diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php
index e726adb0c7..8cb9c19fa3 100644
--- a/wp-includes/author-template.php
+++ b/wp-includes/author-template.php
@@ -269,7 +269,21 @@ function wp_list_authors($args = '') {
$return = '';
/** @todo Move select to get_authors(). */
- $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
+ if( is_multisite() ) {
+ $users = get_users_of_blog();
+ $author_ids = array();
+ foreach ( (array) $users as $user ) {
+ $author_ids[] = $user->user_id;
+ }
+ if ( count($author_ids) > 0 ) {
+ $author_ids=implode(',', $author_ids );
+ $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
+ } else {
+ $authors = array();
+ }
+ } else {
+ $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
+ }
$author_count = array();
foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row) {
diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index 2828c8a13a..463ff86625 100644
--- a/wp-includes/capabilities.php
+++ b/wp-includes/capabilities.php
@@ -987,6 +987,9 @@ function map_meta_cap( $cap, $user_id ) {
function current_user_can( $capability ) {
$current_user = wp_get_current_user();
+ if( is_multisite() && is_super_admin() )
+ return true;
+
if ( empty( $current_user ) )
return false;
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 0d4ee8cc74..285906ccb6 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -327,9 +327,13 @@ function get_option( $setting, $default = false ) {
return $pre;
// prevent non-existent options from triggering multiple queries
- $notoptions = wp_cache_get( 'notoptions', 'options' );
- if ( isset( $notoptions[$setting] ) )
- return $default;
+ if ( defined( 'WP_INSTALLING' ) && is_multisite() ) {
+ $notoptions = array();
+ } else {
+ $notoptions = wp_cache_get( 'notoptions', 'options' );
+ if ( isset( $notoptions[$setting] ) )
+ return $default;
+ }
$alloptions = wp_load_alloptions();
@@ -411,7 +415,8 @@ function form_option( $option ) {
function wp_load_alloptions() {
global $wpdb;
- $alloptions = wp_cache_get( 'alloptions', 'options' );
+ if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
if ( !$alloptions ) {
$suppress = $wpdb->suppress_errors();
@@ -421,7 +426,8 @@ function wp_load_alloptions() {
$alloptions = array();
foreach ( (array) $alloptions_db as $o )
$alloptions[$o->option_name] = $o->option_value;
- wp_cache_add( 'alloptions', $alloptions, 'options' );
+ if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+ wp_cache_add( 'alloptions', $alloptions, 'options' );
}
return $alloptions;
}
@@ -623,6 +629,9 @@ function delete_option( $name ) {
function delete_transient($transient) {
global $_wp_using_ext_object_cache, $wpdb;
+ if( is_multisite() )
+ do_action( 'delete_transient_' . $transient );
+
if ( $_wp_using_ext_object_cache ) {
return wp_cache_delete($transient, 'transient');
} else {
@@ -690,6 +699,9 @@ function get_transient($transient) {
function set_transient($transient, $value, $expiration = 0) {
global $_wp_using_ext_object_cache, $wpdb;
+ if( is_multisite() )
+ $value = apply_filters( 'pre_set_transient_' . $transient, $value );
+
if ( $_wp_using_ext_object_cache ) {
return wp_cache_set($transient, $value, 'transient', $expiration);
} else {
@@ -2174,6 +2186,15 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
if ( $upload['error'] !== false )
return $upload;
+ if( is_multisite() ) {
+ /* WPMU check file before writing it */
+ $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) );
+ if( is_array( $upload_bits_error ) == false ) {
+ $upload[ 'error' ] = $upload_bits_error;
+ return $upload;
+ }
+ }
+
$filename = wp_unique_filename( $upload['path'], $name );
$new_file = $upload['path'] . "/$filename";
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 7c917bf476..3690a1ef04 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -3076,10 +3076,12 @@ function wp_get_attachment_url( $post_id = 0 ) {
if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //Get upload directory
if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
$url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
- elseif ( false !== strpos($file, 'wp-content/uploads') )
- $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
- else
- $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.
+ elseif ( !is_multisite() ) {
+ if ( false !== strpos($file, 'wp-content/uploads') )
+ $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
+ else
+ $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.
+ }
}
}
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php
index 9c808139e5..12f4fc2324 100644
--- a/wp-includes/rewrite.php
+++ b/wp-includes/rewrite.php
@@ -1724,32 +1724,77 @@ class WP_Rewrite {
if ( ! $this->using_permalinks()) {
return '';
}
-
- $rules = '';
- $extra_indent = '';
- if ( $add_parent_tags ) {
- $rules .= "