[ Index ]

PHP Cross Reference of WordPress 3.0 beta 1

[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/wp-admin/ -> ms-upgrade-network.php (source)

   1  <?php
   2  require_once ('admin.php');
   3  
   4  if ( !is_multisite() )
   5      wp_die( __('Multisite support is not enabled.') );
   6  
   7  require_once( ABSPATH . WPINC . '/http.php' );
   8  
   9  $title = __('Update Network');
  10  $parent_file = 'ms-admin.php';
  11  require_once ('admin-header.php');
  12  
  13  if ( ! current_user_can( 'manage_network' ) )
  14      wp_die( __('You do not have permission to access this page.') );
  15  
  16  echo '<div class="wrap">';
  17  screen_icon();
  18  echo '<h2>'.__('Update Network').'</h2>';
  19  
  20  $action = isset($_GET['action']) ? $_GET['action'] : 'show';
  21  
  22  switch ( $action ) {
  23      case "upgrade":
  24          $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
  25  
  26          if ( $n < 5 ) {
  27              global $wp_db_version;
  28              update_site_option( 'wpmu_upgrade_site', $wp_db_version );
  29          }
  30  
  31          $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 ( 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' ] );
  46              }
  47          }
  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
  58      break;
  59      case 'show':
  60      default:
  61          ?><p><?php _e("You can update all the sites on your network through this page. It works by calling the update script of each site automatically. Hit the link below to update."); ?></p>
  62          <p><a class="button" href="ms-upgrade-network.php?action=upgrade"><?php _e("Update Network"); ?></a></p><?php
  63          do_action( 'wpmu_upgrade_page' );
  64      break;
  65  }
  66  ?>
  67  </div>
  68  
  69  <?php include ('admin-footer.php'); ?>


Generated: Mon Apr 5 14:26:09 2010 Cross-referenced by PHPXref 0.7