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

ufuk bayburt ufukbay at gmail.com
Wed Jun 6 16:24:24 UTC 2007

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.

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.

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.

That's why i think we need a directories table. There is no module
solution since core and other modules uses the file_check_directory
function(which needs to be modified) to create their directories. And
a module implementing this, will require an additional table for the
files-folders relation.

What do you think?

On 6/4/07, Vladimir Zlatanov <vlado at dikini.net> wrote:
> > do you think it would be useful to store directories in DB?
> > is it a core thing or should it be in a contributed module?
> > anybody working on it?
> Depends what you are after
> The core fileapi doesn't care. All it wants to know is where to put and
> manipulate your file. Actually it doesn't touch the database at all.
> update.mpdule in core does have a single sink directory, so it doesn't care
> about directory structures in db or the filesystem
> There are many modules in contrib which do one way or another. Depends on
> your needs. There were a lot of debates what is the right way to do it, but
> it seems there isn't a single solution to satisfy all your needs.
> http://drupal.org/project/webfm is one such solution.
> I'm working on a different one, with a different focus.
> http://drupal.org/project/docs
> There is a GSOC project focused on this topic.
> There are more modules, just check out the file management section in
> modules
> Make your pick.

More information about the development mailing list