Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.3.0

Request #14067 Add overlay driver
Submitted: 2008-06-04 11:24 UTC
From: jorrit Assigned:
Status: Wont fix Package: VFS (version 0.2.0)
PHP Version: 5.2.6 OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 50 - 16 = ?

 
 [2008-06-04 11:24 UTC] jorrit (Jorrit Schippers)
Description: ------------ I would like to suggest a pseudo driver that gets an ordered list of backends as arguments and will execute the requests in such a way that the request will be redirected to each of the backends. The first backend that is able to serve the request will handle the request, just like the include path works for including files in PHP. Of course not all requests can be handled in this way, but someone using VFS in this way will realize that (hopefully). For instance, creating folders can't be handled automatically. The configuration of this backend could perhaps allow to assign a specific backend to receive the createFolder requests. When multiple backends contain the same file or folder, the first in the list will receive the request. This feature request is created to discuss this topic, I would like to know what others think about it. I think this could be a feature that would make VFS much more unique. Similar to this feature, a RAID-1 mimicking driver could also be developed, to name just another pseudo driver that could be useful. I'm imagining something like the following code: Test script: --------------- ls dir1: dir1a dir1b ls dir2: dir2a dir2b $dir1 = VFS::factory('file', array('vfsroot' => 'dir1/')); $dir2 = VFS::factory('file', array('vfsroot' => 'dir2/')); $vfs = VFS::factory('overlay', array('backends' => array($dir1, $dir2), 'createbackend' => $dir1) ); var_dump($vfs->listFolders()); Expected result: ---------------- dir1a dir1b dir2a dir2b

Comments

 [2008-12-01 15:17 UTC] chagenbu (Chuck Hagenbuch)
What's the use case for only one driver handling the request? I get the utility of running the same command on multiple backends.
 [2008-12-02 18:34 UTC] jorrit (Jorrit Schippers)
I was imagining the following use case: I have two directories in which files are saved. I want to get the file from the first dir if it's there, otherwise from the second dir. The difference is in this case that the first dir is not, and the second dir is kept in source control.
 [2008-12-02 20:01 UTC] chagenbu (Chuck Hagenbuch)
And why don't you want to use the second dir only?
 [2008-12-02 21:12 UTC] jorrit (Jorrit Schippers)
Because users are allowed to upload data to the first directory. But you can disregard this request, it is not relevant for me anymore and obviously I'm the only one that will use it. I will implement it myself if I need it.