Ticket #6834 (new enhancement)

Opened 4 months ago

Last modified 4 months ago

More descriptive create directory/copy errors in file.php

Reported by: plankers Assigned to: anonymous
Priority: normal Milestone: 2.7
Component: Administration Version: 2.5
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

When using the plugin updater it would be helpful if the error messages indicated what directory the operation was acting on, so that if there are permission errors they can be more easily resolved.

The affected code are lines 262 and 268 of wp-admin/includes/file.php, and a patch is attached.

Attachments

file-php-more-verbose-error.patch (0.9 kB) - added by plankers on 04/24/08 20:47:03.
Patch for more verbose errors for plugin updater

Change History

04/24/08 20:47:03 changed by plankers

  • attachment file-php-more-verbose-error.patch added.

Patch for more verbose errors for plugin updater

04/25/08 03:02:21 changed by DD32

You cannot use Variables within translate functions( (), _e() )

Instead you need to use things such as:{{{ return new WP_Error('mkdir_failed', sprintf(('Could not create directory: %s', $to . $tmppath)); }} (Thats just an example).

Another option is to pass the error data along with the WP Error:

return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath ); 

The updater message will show "Could not create directory: $errordata"

I agree that it needs to be a bit more verbose.

04/25/08 14:11:57 changed by DD32

Just a quick note, I've been changing a few of the functions over to utilise WP_Error, But most of them are in file.php, So right now i'm awaiting to see the outcome of #6465 as the changes have been applied to the same install, and any patch will conflict.