我要说的是,这是不可能的。。。
以下是/wp-admin/network/upgrade.php
:
$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 );
if ( empty( $blogs ) ) {
echo \'<p>\' . __( \'All done!\' ) . \'</p>\';
break;
}
echo "<ul>";
foreach ( (array) $blogs as $details ) {
$siteurl = get_blog_option( $details[\'blog_id\'], \'siteurl\' );
echo "<li>$siteurl</li>";
$response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=upgrade_db", array( \'timeout\' => 120, \'httpversion\' => \'1.1\' ) );
if ( is_wp_error( $response ) )
wp_die( sprintf( __( \'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: <em>%2$s</em>\' ), $siteurl, $response->get_error_message() ) );
do_action( \'after_mu_upgrade\', $response );
do_action( \'wpmu_upgrade_site\', $details[ \'blog_id\' ] );
}
但从那以后,我们可以制作一个小工具来列出所有死亡的博客
和停用每个选项的选项。
复制自/wp-admin/includes/class-wp-ms-sites-list-table.php
.
add_action( \'wp_network_dashboard_setup\', \'wpse_52040_network_dashboard_setup\' );
function wpse_52040_network_dashboard_setup()
{
wp_add_dashboard_widget( \'wpse_52040_dead_blogs_widget\', __( \'Dead blogs\' ), \'wpse_52040_dead_blogs\' );
}
function wpse_52040_dead_blogs()
{
global $wpdb;
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->blogs} WHERE spam = \'0\' AND deleted = \'0\' AND archived = \'0\' ORDER BY registered DESC, 5", ARRAY_A ) );
if ( empty( $blogs ) )
{
echo \'<p>No blogs!</p>\';
break;
}
echo "<ul>";
foreach ( (array) $blogs as $details )
{
$siteurl = get_blog_option( $details->blog_id, \'siteurl\' );
$response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/", array( \'timeout\' => 120, \'httpversion\' => \'1.1\' ) );
if ( is_wp_error( $response ) )
{
$error = $response->get_error_message();
echo "<li><strong>$siteurl</strong><br />";
echo \'<span class="activate"><a href="\' . esc_url( wp_nonce_url( network_admin_url( \'sites.php?action=confirm&action2=deactivateblog&id=\' . $details->blog_id . \'&msg=\' . urlencode( sprintf( __( \'You are about to deactivate the site %s\' ), $details->domain ) ) ), \'confirm\') ) . \'">\' . __( \'Deactivate\' ) . \'</a></span><br />\';
echo "Response -> $error</li>";
}
}
echo "</ul>";
}