[ Root ] [ Search ] [ Index ]

PHP Cross Reference of WordPress MU 2.9.2

Provided by Yoast

title

Body

[close]

/wp-admin/ -> wpmu-upgrade-site.php (source)

   1  <?php
   2  require_once ('admin.php');
   3  require_once( ABSPATH . WPINC . '/http.php' );
   4  
   5  $title = __('WordPress MU &rsaquo; Admin &rsaquo; Upgrade Site');
   6  $parent_file = 'wpmu-admin.php';
   7  require_once ('admin-header.php');
   8  
   9  if( is_site_admin() == false ) {
  10      wp_die( __('You do not have permission to access this page.') );
  11  }
  12  
  13  echo '<div class="wrap">';
  14  echo '<h2>'.__('Upgrade Site').'</h2>';
  15  switch( $_GET['action'] ) {
  16      case "upgrade":
  17          $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
  18  
  19          if ( $n < 5 ) {
  20              global $wp_db_version;
  21              update_site_option( 'wpmu_upgrade_site', $wp_db_version );
  22          }
  23  
  24          $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 );
  25          if( is_array( $blogs ) ) {
  26              echo "<ul>";
  27              foreach( (array) $blogs as $details ) {
  28                  if( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) {
  29                      $siteurl = $wpdb->get_var("SELECT option_value from {$wpdb->base_prefix}{$details['blog_id']}_options WHERE option_name = 'siteurl'");
  30                      echo "<li>$siteurl</li>";
  31                      $response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=1", array( 'timeout' => 120, 'httpversion' => '1.1' ) );
  32                      if( is_wp_error( $response ) ) {
  33                          wp_die( "<strong>Warning!</strong> Problem upgrading {$siteurl}. Your server may not be able to connect to blogs running on it.<br /> Error message: <em>" . $response->get_error_message() ."</em>" );
  34                      }
  35                      do_action( 'after_mu_upgrade', $response );
  36                      do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); 
  37                  }
  38              }
  39              echo "</ul>";
  40              ?><p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a class="button" href="wpmu-upgrade-site.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Blogs"); ?></a></p>
  41              <script type='text/javascript'>
  42              <!--
  43  			function nextpage() {
  44                  location.href = "wpmu-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>";
  45              }
  46              setTimeout( "nextpage()", 250 );
  47              //-->
  48              </script><?php
  49          } else {
  50              echo '<p>'.__('All Done!').'</p>';
  51          }
  52      break;
  53      default: 
  54          ?><p><?php _e("You can upgrade all the blogs on your site through this page. It works by calling the upgrade script of each blog automatically. Hit the link below to upgrade."); ?></p>
  55          <p><a class="button" href="wpmu-upgrade-site.php?action=upgrade"><?php _e("Upgrade Site"); ?></a></p><?php
  56          do_action( 'wpmu_upgrade_page' );
  57      break;
  58  }
  59  ?>
  60  </div>
  61  
  62  <?php include ('admin-footer.php'); ?>


Generated: Mon May 3 12:25:32 2010 Cross-referenced by PHPXref 0.7