This issue is based on the following request on Drupal core improvements » File system:
“file_scan_directory() should return objects that have the same properties as the $file object returned by file_load(). Right now the file path is $file->path instead of $file->filepath, base name is $file->basename instead of $file->filename. The main complication of this patch is that there are quite a few core functions that directly return the results of this function so the change cascades out.”

I've made a patch that changes this, however, it doesn't go all the way and enforce this terminology throughout Drupal. E.g. it does not rename {registry}.filename to {registry}.filepath even though the fields contains a path a not just a path-less filename. Do we want to do that? And do we want to do it in one big issue, or is this better handled in separate issues?

CommentFileSizeAuthor
file_scan_directory-1.patch49.95 KBc960657
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

c960657’s picture

Title: DX: Make file_scan_directory() use save property names as file_load() » DX: Make file_scan_directory() use same property names as file_load()
Dries’s picture

Title: DX: Make file_scan_directory() use same property names as file_load() » DX: Make file_scan_directory() use save property names as file_load()
Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Dries’s picture

Committed to CVS HEAD. Thanks.

drewish’s picture

Status: Fixed » Needs work

Uh wow, record commit time... we do need to document this in the upgrade instructions.

c960657’s picture

I suggest the following for http://drupal.org/node/224333. I don't have permission to edit that page.

file_scan_directory() now use same property names as file_load()

(issue) file_scan_directory() previously returned objects with the properties filename, basename, and name (e.g., respectively, "foo/bar.txt," "bar.txt" and "bar"). filename has been renamed to filepath, and basename has been renamed to filename, i.e. the same names as used in objects returned by file_load().

c960657’s picture

Status: Needs work » Fixed

Apparently I now have access to edit the page, so I did:
http://drupal.org/node/224333#file_scan_directory_property_names

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.