Download & Extend

DX: Make file_scan_directory() use save property names as file_load()

Project:Drupal core
Version:7.x-dev
Component:file system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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?

AttachmentSizeStatusTest resultOperations
file_scan_directory-1.patch49.95 KBIdlePassed: 9752 passes, 0 fails, 0 exceptionsView details

Comments

#1

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

#2

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.

#3

Committed to CVS HEAD. Thanks.

#4

Status:fixed» needs work

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

#5

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

#6

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

#7

Status:fixed» closed (fixed)

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

nobody click here