Skip to content

Commit

Permalink
Remove additional MySQL LIMIT commands
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickebates committed Apr 22, 2014
1 parent 74fc235 commit f4082cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
}

0 comments on commit f4082cc

Please sign in to comment.