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

ufuk bayburt ufukbay at gmail.com
Thu Jun 7 10:47:23 UTC 2007


Talking about D6.

Simply, when a file is uploaded, drupal(not upload module) saves it in
files table, but when a directory is created there is no record for
it.

I suggest that;
- we should store an additional directory path field in files table.
- we should maintain a directories table.

That's it. Let them stay there and let the modules decide on managing
permissions, access issues, whatever left etc.


On 6/7/07, Vladimir Zlatanov <vlado at dikini.net> wrote:
> 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.
>


More information about the development mailing list