Ticket #7519: 7519.3.diff
File 7519.3.diff, 1.8 KB (added by , 16 years ago) |
---|
-
wp-admin/update.php
102 102 return; 103 103 } 104 104 105 // TODO: Is theme currently active?106 $was_current = false; //is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is105 //Is the current theme active? If so, Put the blog into maintainence mode before update. 106 $was_current = strtolower(get_option('stylesheet')) == strtolower($theme) || strtolower(get_option('template')) == strtolower($theme); 107 107 108 if ( $was_current ) { 109 show_message( __('Blog has been put into maintainence mode for duration of theme update') ); 110 // Create maintenance file to signal that we are upgrading 111 $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; 112 $maintenance_file = $wp_filesystem->abspath() . '.maintenance'; 113 $wp_filesystem->delete($maintenance_file); 114 $wp_filesystem->put_contents($maintenance_file, $maintenance_string, 0644); 115 } 116 108 117 $result = wp_update_theme($theme, 'show_message'); 109 118 119 if ( $was_current ) { 120 // Remove maintenance file, we're done. 121 $wp_filesystem->delete($maintenance_file); 122 } 123 110 124 if ( is_wp_error($result) ) { 111 125 show_message($result); 112 126 show_message( __('Installation Failed') ); 113 127 } else { 114 //Result is the new plugin file relative to WP_PLUGIN_DIR115 128 show_message( __('Theme upgraded successfully') ); 116 if( $result && $was_current ){117 show_message(__('Setting theme as Current'));118 //TODO: Actually set it as active again.119 //echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>';120 }121 129 } 122 130 echo '</div>'; 123 131 }