From f4082cc63a7a8a7c198f552097b53eb08cf0da25 Mon Sep 17 00:00:00 2001 From: patrickebates Date: Tue, 22 Apr 2014 09:55:56 -0500 Subject: [PATCH] Remove additional MySQL LIMIT commands --- wp-admin/includes/upgrade.php | 2 +- wp-includes/functions.php | 2 +- wp-includes/http.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index f07b4f655..dd0f1c633 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -443,7 +443,7 @@ function upgrade_network() { delete_site_option( 'deactivated_sitewide_plugins' ); $start = 0; - while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) { + while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id OFFSET $start ROWS FETCH NEXT 20 ROWS ONLY" ) ) { foreach( $rows as $row ) { $value = $row->meta_value; if ( !@unserialize( $value ) ) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index f69992ec6..8c2278c38 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3569,7 +3569,7 @@ function is_main_network( $network_id = null ) { if ( $primary_network_id ) return $network_id === $primary_network_id; - $primary_network_id = (int) $wpdb->get_var( "SELECT id FROM $wpdb->site ORDER BY id LIMIT 1" ); + $primary_network_id = (int) $wpdb->get_var( "SELECT TOP 1 id FROM $wpdb->site ORDER BY id" ); wp_cache_add( 'primary_network_id', $primary_network_id, 'site-options' ); return $network_id === $primary_network_id; diff --git a/wp-includes/http.php b/wp-includes/http.php index 57746ff80..c4a09484d 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -553,6 +553,6 @@ function ms_allowed_http_request_hosts( $is_external, $host ) { return true; if ( isset( $queried[ $host ] ) ) return $queried[ $host ]; - $queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ); + $queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT TOP 1 domain FROM $wpdb->blogs WHERE domain = %s", $host ) ); return $queried[ $host ]; }