Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#6834 closed defect (bug) (fixed)

More descriptive create directory/copy errors in file.php

Reported by: plankers Owned by: westi
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: needs-patch
Focuses: Cc:


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 (1)

file-php-more-verbose-error.patch (885 bytes) - added by plankers 10 years ago.
Patch for more verbose errors for plugin updater

Download all attachments as: .zip

Change History (6)

10 years ago

Patch for more verbose errors for plugin updater

#1 @DD32
10 years ago

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.

#2 @DD32
10 years ago

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.

#3 @westi
10 years ago

  • Keywords needs-patch added; has-patch needs-testing removed
  • Milestone changed from 2.7 to 2.8
  • Owner changed from anonymous to westi
  • Status changed from new to assigned
  • Type changed from enhancement to defect

New patch needed.

#4 @DD32
10 years ago

New patch needed.

I believe its been implemented in one of my other patches: http://trac.wordpress.org/browser/trunk/wp-admin/includes/file.php#L546

However, I'm not sure if its shown upstream in the show_message() function yet.

#5 @westi
10 years ago

  • Milestone changed from 2.8 to 2.7
  • Resolution set to fixed
  • Status changed from assigned to closed

Looks like show_message pulls that data out.

Marking as Fixed.

Note: See TracTickets for help on using tickets.