From 758a211078267e2be3959099f38e057163d13517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Caoimh?= Date: Tue, 15 May 2018 12:55:32 +0100 Subject: [PATCH] Don't die() if there's a problem deleting files. wp_mail() instead. (#551) * Don't die() if there's a problem deleting files. wp_mail() instead. * Add the language domain to these translations * Added filter "wpsc_send_uninstall_errors" to disable sending errors Return 0 and uninstall errors won't send an email to the admin --- wp-cache.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wp-cache.php b/wp-cache.php index b4f33be8..ddce2777 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -3601,16 +3601,16 @@ function wp_cache_disable_plugin( $delete_config_file = true ) { $file_not_deleted[] = 'wp-cache-config.php'; } if ( $file_not_deleted ) { - $msg = "

One or more files could not be deleted. These files and directories must be made writeable:

\n
  1. " . WP_CONTENT_DIR . "
  2. \n"; - $code = "\n"; + $msg .= "\n"; + $msg .= sprintf( __( "You should delete these files manually.\nYou may need to change the permissions of the files or parent directory.\nYou can read more about this in the Codex at\n%s\n\nThank you.", 'wp-super-cache' ), 'https://codex.wordpress.org/Changing_File_Permissions#About_Chmod' ); - $msg .= "
\n

First try fixing the directory permissions with this command and refresh this page:

chmod 777 " . WP_CONTENT_DIR . "

If you still see this error, you have to fix the permissions on the files themselves and refresh this page again:

{$code}\n

Don't forget to fix things later:
chmod 755 " . WP_CONTENT_DIR . "

If you don't know what chmod is read all about it here and note the warning about using 777 permission.

Please refresh this page when the permissions have been modified.

"; - wp_die( $msg ); + if ( apply_filters( 'wpsc_send_uninstall_errors', 1 ) ) { + wp_mail( get_option( 'admin_email' ), __( 'WP Super Cache: could not delete files', 'wp-super-cache' ), $msg ); + } } extract( wpsc_get_htaccess_info() ); // $document_root, $apache_root, $home_path, $home_root, $home_root_lc, $inst_root, $wprules, $scrules, $condition_rules, $rules, $gziprules if ( $scrules != '' && insert_with_markers( $home_path.'.htaccess', 'WPSuperCache', array() ) ) {