Ticket #29860: 29860.patch
| File 29860.patch, 7.8 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/plugin.php
804 804 805 805 $plugins_dir = trailingslashit( $plugins_dir ); 806 806 807 $translations_dir = $wp_filesystem->wp_lang_dir(); 808 $translations_dir = trailingslashit( $translations_dir ); 809 810 $plugin_translations = wp_get_installed_translations( 'plugins' ); 811 807 812 $errors = array(); 808 813 809 814 foreach( $plugins as $plugin_file ) { 810 815 // Run Uninstall hook 811 if ( is_uninstallable_plugin( $plugin_file ) ) 816 if ( is_uninstallable_plugin( $plugin_file ) ) { 812 817 uninstall_plugin($plugin_file); 818 } 813 819 814 820 $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) ); 815 821 // If plugin is in its own directory, recursively delete the directory. 816 if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory separator AND that it's not the root plugin folder822 if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder 817 823 $deleted = $wp_filesystem->delete($this_plugin_dir, true); 818 else824 } else { 819 825 $deleted = $wp_filesystem->delete($plugins_dir . $plugin_file); 826 } 820 827 821 if ( ! $deleted ) 828 if ( ! $deleted ) { 822 829 $errors[] = $plugin_file; 830 continue; 831 } 832 833 // Remove language files, silently. 834 $plugin_slug = dirname( $plugin_file ); 835 if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { 836 $translations = $plugin_translations[ $plugin_slug ]; 837 838 foreach ( $translations as $translation => $data ) { 839 $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' ); 840 $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' ); 841 } 842 } 823 843 } 824 844 825 845 // Remove deleted plugins from the plugin updates list. -
src/wp-admin/includes/theme.php
62 62 63 63 $themes_dir = trailingslashit( $themes_dir ); 64 64 $theme_dir = trailingslashit($themes_dir . $stylesheet); 65 $deleted = $wp_filesystem->delete( $theme_dir, true);65 $deleted = $wp_filesystem->delete( $theme_dir, true ); 66 66 67 if ( ! $deleted ) 67 if ( ! $deleted ) { 68 68 return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $stylesheet) ); 69 } 69 70 71 $translations_dir = $wp_filesystem->wp_lang_dir(); 72 $translations_dir = trailingslashit( $translations_dir ); 73 74 $theme_translations = wp_get_installed_translations( 'themes' ); 75 76 // Remove language files, silently. 77 if ( ! empty( $theme_translations[ $stylesheet ] ) ) { 78 $translations = $theme_translations[ $stylesheet ]; 79 80 foreach ( $translations as $translation => $data ) { 81 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); 82 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); 83 } 84 } 85 70 86 // Force refresh of theme update information 71 87 delete_site_transient('update_themes'); 72 88 -
src/wp-admin/network/themes.php
110 110 } 111 111 112 112 $files_to_delete = $theme_info = array(); 113 $theme_translations = wp_get_installed_translations( 'themes' ); 113 114 foreach ( $themes as $key => $theme ) { 114 115 $theme_info[ $theme ] = wp_get_theme( $theme ); 115 $files_to_delete = array_merge( $files_to_delete, list_files( $theme_info[ $theme ]->get_stylesheet_directory() ) ); 116 117 // Locate all the files in that folder 118 $files = list_files( $theme_info[ $theme ]->get_stylesheet_directory() ); 119 if ( $files ) { 120 $files_to_delete = array_merge( $files_to_delete, $files ); 121 } 122 123 // Add translation files 124 $theme_slug = $theme_info[ $theme ]->get_stylesheet(); 125 if ( ! empty( $theme_translations[ $theme_slug ] ) ) { 126 $translations = $theme_translations[ $theme_slug ]; 127 128 foreach ( $translations as $translation => $data ) { 129 $files_to_delete[] = $theme_slug . '-' . $translation . '.po'; 130 $files_to_delete[] = $theme_slug . '-' . $translation . '.mo'; 131 } 132 } 116 133 } 117 134 118 135 if ( empty( $themes ) ) { -
src/wp-admin/plugins.php
237 237 <?php 238 238 $files_to_delete = $plugin_info = array(); 239 239 $have_non_network_plugins = false; 240 $plugin_translations = wp_get_installed_translations( 'plugins' ); 240 241 foreach ( (array) $plugins as $plugin ) { 241 if ( '.' == dirname($plugin) ) { 242 $plugin_slug = dirname( $plugin ); 243 244 if ( '.' == $plugin_slug ) { 242 245 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; 243 if ( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) {246 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { 244 247 $plugin_info[ $plugin ] = $data; 245 248 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 246 249 if ( ! $plugin_info[ $plugin ]['Network'] ) … … 248 251 } 249 252 } else { 250 253 // Locate all the files in that folder 251 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin));254 $files = list_files( WP_PLUGIN_DIR . '/' . $plugin_slug ); 252 255 if ( $files ) { 253 $files_to_delete = array_merge( $files_to_delete, $files);256 $files_to_delete = array_merge( $files_to_delete, $files ); 254 257 } 258 255 259 // Get plugins list from that folder 256 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) {260 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { 257 261 foreach( $folder_plugins as $plugin_file => $data ) { 258 262 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); 259 263 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); … … 261 265 $have_non_network_plugins = true; 262 266 } 263 267 } 268 269 // Add translation files 270 if ( ! empty( $plugin_translations[ $plugin_slug ] ) ) { 271 $translations = $plugin_translations[ $plugin_slug ]; 272 273 foreach ( $translations as $translation => $data ) { 274 $files_to_delete[] = $plugin_slug . '-' . $translation . '.po'; 275 $files_to_delete[] = $plugin_slug . '-' . $translation . '.mo'; 276 } 277 } 264 278 } 265 279 } 266 280 $plugins_to_delete = count( $plugin_info ); -
src/wp-includes/l10n.php
797 797 $language_data = array(); 798 798 799 799 foreach ( $files as $file ) { 800 if ( '.' === $file[0] || is_dir( $file ) ) 800 if ( '.' === $file[0] || is_dir( $file ) ) { 801 801 continue; 802 if ( substr( $file, -3 ) !== '.po' ) 802 } 803 if ( substr( $file, -3 ) !== '.po' ) { 803 804 continue; 804 if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) 805 } 806 if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) { 805 807 continue; 808 } 809 $mo_file = preg_replace('"\.po$"', '.mo', $file ); 810 if ( ! in_array( $mo_file, $files ) ) { 811 continue; 812 } 806 813 807 814 list( , $textdomain, $language ) = $match; 808 if ( '' === $textdomain ) 815 if ( '' === $textdomain ) { 809 816 $textdomain = 'default'; 817 } 810 818 $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" ); 811 819 } 812 820 return $language_data;
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)