Fix net admin theme deletion over FTP. see #16117

git-svn-id: https://develop.svn.wordpress.org/trunk@17237 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2011-01-07 19:01:34 +00:00
parent 26e7626463
commit 5cd255f193
2 changed files with 6 additions and 4 deletions

View File

@ -43,17 +43,19 @@ function current_theme_info() {
* @since 2.8.0
*
* @param string $template Template directory of the theme to delete
* @param string $redirect Redirect to page when complete.
* @return mixed
*/
function delete_theme($template) {
function delete_theme($template, $redirect = '') {
global $wp_filesystem;
if ( empty($template) )
return false;
ob_start();
$url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
if ( empty( $redirect ) )
$redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
$data = ob_get_contents();
ob_end_clean();
if ( ! empty($data) ){

View File

@ -160,7 +160,7 @@ if ( $action ) {
} // Endif verify-delete
foreach ( $themes as $theme )
$delete_result = delete_theme( $theme );
$delete_result = delete_theme( $theme, esc_url( add_query_arg( array('verify-delete' => 1), $_SERVER['REQUEST_URI'] ) ) );
wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) );
exit;
break;