Fix net admin theme deletion over FTP. see #16117
git-svn-id: http://svn.automattic.com/wordpress/trunk@17237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
50d3a36764
commit
9b88439cb6
|
@ -43,17 +43,19 @@ function current_theme_info() {
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param string $template Template directory of the theme to delete
|
* @param string $template Template directory of the theme to delete
|
||||||
|
* @param string $redirect Redirect to page when complete.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function delete_theme($template) {
|
function delete_theme($template, $redirect = '') {
|
||||||
global $wp_filesystem;
|
global $wp_filesystem;
|
||||||
|
|
||||||
if ( empty($template) )
|
if ( empty($template) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
|
if ( empty( $redirect ) )
|
||||||
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
|
$redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
|
||||||
|
if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
|
||||||
$data = ob_get_contents();
|
$data = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
if ( ! empty($data) ){
|
if ( ! empty($data) ){
|
||||||
|
|
|
@ -160,7 +160,7 @@ if ( $action ) {
|
||||||
} // Endif verify-delete
|
} // Endif verify-delete
|
||||||
|
|
||||||
foreach ( $themes as $theme )
|
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 ) );
|
wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) );
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue