Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
file system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2008 at 01:54 UTC
Updated:
24 Jul 2009 at 11:26 UTC
When calling file_check_directory() to ensure that a directory exists, the specified directory will be created if it is not found. This works fine if all the parent directories on the path exist, but breaks if they don't.
Example:
file_check_directory('/www/files/xxx/yyy', FILE_CREATE_DIRECTORY)
will succeed if /www/files/xxx exists, but fail if only /www/files exists.
This can be corrected for PHP5 and above users by using the $recursive flag when mkdir is called. If PHP 4 is detected, the path would need to be built a level at a time, from a loop.
This fix would also require passing a $mode argument to mkdir, which would need to be also added to file_check_directory().
Comments
Comment #1
btully commentedsubscribing
Comment #2
alan d. commentedThe solution is finally here for Drupal 7. It probably will not be back-ported, as PHP5 dependent solution.