Skip to content

Commit

Permalink
Don't die() if there's a problem deleting files. wp_mail() instead. (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
donnchawp authored May 15, 2018
1 parent 71b92a6 commit 758a211
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions wp-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<p>One or more files could not be deleted. These files and directories must be made writeable:</p>\n <ol><li>" . WP_CONTENT_DIR . "</li>\n";
$code = "<ul>\n";
$msg = __( "Dear User,\n\nWP Super Cache was removed from your blog or deactivated but some files could\nnot be deleted.\n\n", 'wp-super-cache' );
foreach( (array)$file_not_deleted as $filename ) {
$msg .= "<li>" . WP_CONTENT_DIR . "/{$filename}</li>";
$code .= "<li><code>chmod 666 " . WP_CONTENT_DIR . "/{$filename}</code></li>\n";
$msg .= WP_CONTENT_DIR . "/{$filename}\n";
}
$code .= "</ul>\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 .= "</ol>\n<p>First try fixing the directory permissions with this command and refresh this page:<br /><br /><code>chmod 777 " . WP_CONTENT_DIR . "</code><br /><br />If you still see this error, you have to fix the permissions on the files themselves and refresh this page again:</p> {$code}\n<p>Don't forget to fix things later:<br /><code>chmod 755 " . WP_CONTENT_DIR . "</code></p><p>If you don't know what <strong>chmod</strong> is read all about it <a href='https://codex.wordpress.org/Changing_File_Permissions#About_Chmod'>here</a> and note the warning about using 777 permission.</p><p>Please refresh this page when the permissions have been modified.</p>";
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() ) ) {
Expand Down

0 comments on commit 758a211

Please sign in to comment.