directory handling (after the great file API)
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?
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.
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? Darrel? On 6/4/07, Vladimir Zlatanov <vlado@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.
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.
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@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.
participants (2)
-
ufuk bayburt -
Vladimir Zlatanov