WordPress.org

Make WordPress Core

Changeset 13681


Ignore:
Timestamp:
03/12/10 00:26:31 (4 years ago)
Author:
nacin
Message:

Check for empty(), not !is_array(), when trying to determine if wpdb::get_results() returned results. See #10607

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/ms-upgrade-network.php

    r13590 r13681  
    3030 
    3131        $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A ); 
    32         if ( is_array( $blogs ) ) { 
    33             echo "<ul>"; 
    34             foreach ( (array) $blogs as $details ) { 
    35                 if ( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) { 
    36                     $siteurl = get_blog_option( $details['blog_id'], 'siteurl' ); 
    37                     echo "<li>$siteurl</li>"; 
    38                     $response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=1", array( 'timeout' => 120, 'httpversion' => '1.1' ) ); 
    39                     if ( is_wp_error( $response ) ) 
    40                         wp_die( "<strong>Warning!</strong> Problem updating {$siteurl}. Your server may not be able to connect to sites running on it.<br /> Error message: <em>" . $response->get_error_message() ."</em>" ); 
    41                     do_action( 'after_mu_upgrade', $response ); 
    42                     do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); 
    43                 } 
     32        if ( empty( $blogs ) ) { 
     33            echo '<p>' . __( 'All done!' ) . '</p>'; 
     34            break; 
     35        } 
     36        echo "<ul>"; 
     37        foreach ( (array) $blogs as $details ) { 
     38            if ( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) { 
     39                $siteurl = get_blog_option( $details['blog_id'], 'siteurl' ); 
     40                echo "<li>$siteurl</li>"; 
     41                $response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=1", array( 'timeout' => 120, 'httpversion' => '1.1' ) ); 
     42                if ( is_wp_error( $response ) ) 
     43                    wp_die( "<strong>Warning!</strong> Problem updating {$siteurl}. Your server may not be able to connect to sites running on it.<br /> Error message: <em>" . $response->get_error_message() ."</em>" ); 
     44                do_action( 'after_mu_upgrade', $response ); 
     45                do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); 
    4446            } 
    45             echo "</ul>"; 
    46             ?><p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a class="button" href="ms-upgrade-network.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p> 
    47             <script type='text/javascript'> 
    48             <!-- 
    49             function nextpage() { 
    50                 location.href = "ms-upgrade-network.php?action=upgrade&n=<?php echo ($n + 5) ?>"; 
    51             } 
    52             setTimeout( "nextpage()", 250 ); 
    53             //--> 
    54             </script><?php 
    55         } else { 
    56             echo '<p>'.__('All Done!').'</p>'; 
    5747        } 
     48        echo "</ul>"; 
     49        ?><p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a class="button" href="ms-upgrade-network.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p> 
     50        <script type='text/javascript'> 
     51        <!-- 
     52        function nextpage() { 
     53            location.href = "ms-upgrade-network.php?action=upgrade&n=<?php echo ($n + 5) ?>"; 
     54        } 
     55        setTimeout( "nextpage()", 250 ); 
     56        //--> 
     57        </script><?php 
    5858    break; 
    5959    case 'show': 
Note: See TracChangeset for help on using the changeset viewer.