[development] directory handling (after the great file API)

Vladimir Zlatanov vlado at dikini.net
Thu Jun 7 08:04:07 UTC 2007


Well, really depends what are you after.

Not seeking for a module.
> Actually i'm working on a ftp-like file browser and i wonder if the
> file browsing could be possible by just querying the DB. Drupal DB has
> the files but not the directories.


In core only upload deals with files, facing a user. And upload doesn't need
directories. The functionality it provides is similar to email attachments.

What i was thinking about is a {directories} table and an additional
> "directory" field in {files} table in order to get the files per
> directory. We should also change the file_check_directory() function
> to make it insert the directories it creates to the DB.


No we shouldn't - the fileapi is concerned itself with physical files and
their locations. All
db logic should go in extra modules. There are too many different use cases
to satisfy
all needs acceptably.

With the current file management in drupal a file browser gets files
> from DB and requires to scan all files and folders by a physical disk
> access in order to get directories only. A physical disk access plus a
> DB hit! I cant think of any other way.


Not exactly.The directory/file check is just that a check for its existance,
no more. The db logic in core
is upload's.


What do you think?
>
while( true ) {
Having directories in db? Maybe, or maybe not. How do you maintain the
consistency of the structure in db
and the filesystem?

What if your filesystem is remote? like S3, ftp, ...?

How would you maintain the mapping of permissions to files and directories
without db?

Whould you allow non-drupal access to the directory structure? via ftp, ssh,
webdav, ....
}


You can see that a single solution to solve all problems is tough. Your
suggestions have merit, but their are one
of the solutions. I believe there are modules in contrib which do nearly
that. They do make compromises, because
they target specific use cases.

I do believe there will be change in that space with D6. It is too early to
tell though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070607/b984512d/attachment.htm 


More information about the development mailing list