Changeset 8989 for trunk/wp-admin/update.php
- Timestamp:
- 09/26/2008 06:43:53 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/update.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/update.php
r8885 r8989 57 57 show_message(__('Attempting reactivation of the plugin')); 58 58 echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>'; 59 } 60 } 61 echo '</div>'; 62 } 63 64 /** 65 * Theme upgrade display. 66 * 67 * @since 2.5 68 * 69 * @param string $plugin Plugin 70 */ 71 function do_theme_upgrade($theme) { 72 global $wp_filesystem; 73 74 $url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($theme), 'upgrade-plugin_' . urlencode($theme)); 75 if ( false === ($credentials = request_filesystem_credentials($url)) ) 76 return; 77 78 if ( ! WP_Filesystem($credentials) ) { 79 $error = true; 80 if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() ) 81 $error = $wp_filesystem->errors; 82 request_filesystem_credentials($url, '', $error); //Failed to connect, Error and request again 83 return; 84 } 85 86 echo '<div class="wrap">'; 87 echo '<h2>' . __('Upgrade Theme') . '</h2>'; 88 if ( $wp_filesystem->errors->get_error_code() ) { 89 foreach ( $wp_filesystem->errors->get_error_messages() as $message ) 90 show_message($message); 91 echo '</div>'; 92 return; 93 } 94 95 //TODO: Is theme currently active? 96 $was_current = false; //is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is 97 98 $result = wp_update_theme($theme, 'show_message'); 99 100 if ( is_wp_error($result) ) { 101 show_message($result); 102 show_message( __('Installation Failed') ); 103 } else { 104 //Result is the new plugin file relative to WP_PLUGIN_DIR 105 show_message( __('Theme upgraded successfully') ); 106 if( $result && $was_current ){ 107 show_message(__('Setting theme as Current')); 108 //TODO: Actually set it as active again. 109 //echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>'; 59 110 } 60 111 } … … 145 196 if ( isset($_GET['action']) ) { 146 197 $plugin = isset($_GET['plugin']) ? trim($_GET['plugin']) : ''; 147 148 if ( 'upgrade-plugin' == $_GET['action'] ) { 198 $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : ''; 199 $action = isset($_GET['action']) ? $_GET['action'] : ''; 200 201 if ( 'upgrade-plugin' == $action ) { 149 202 check_admin_referer('upgrade-plugin_' . $plugin); 150 203 $title = __('Upgrade Plugin'); … … 153 206 do_plugin_upgrade($plugin); 154 207 include('admin-footer.php'); 155 } elseif ('activate-plugin' == $ _GET['action']) {208 } elseif ('activate-plugin' == $action ) { 156 209 check_admin_referer('activate-plugin_' . $plugin); 157 210 if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { … … 183 236 } 184 237 echo "</body></html>"; 185 } elseif ( 'upgrade-core' == $ _GET['action']) {238 } elseif ( 'upgrade-core' == $action ) { 186 239 $title = __('Upgrade WordPress'); 187 240 $parent_file = 'index.php'; … … 189 242 core_upgrade_preamble(); 190 243 include('admin-footer.php'); 191 } elseif ( 'do-core-upgrade' ) {244 } elseif ( 'do-core-upgrade' == $action ) { 192 245 check_admin_referer('upgrade-core'); 193 246 $title = __('Upgrade WordPress'); … … 196 249 do_core_upgrade(); 197 250 include('admin-footer.php'); 251 } elseif ( 'upgrade-theme' == $action ) { 252 check_admin_referer('upgrade-theme_' . $theme); 253 $title = __('Upgrade Theme'); 254 $parent_file = 'themes.php'; 255 require_once('admin-header.php'); 256 do_theme_upgrade($theme); 257 include('admin-footer.php'); 198 258 } 199 259 }
Note: See TracChangeset
for help on using the changeset viewer.