[Owncloud] Is it possible for a file's parent storage to be different from its own storage?

Robin Appelman icewind at owncloud.com
Tue Apr 30 01:32:43 UTC 2013


On Monday 29 April 2013 15:23:39 Sarah Jones wrote:
> Hi,
> 
> I'm looking at the code in core lib/files/cache.cache.php.
> 
> For my app I need the storage string, and to cut everything before /data.
>  I'm building a multiinstance owncloud app, so I cannot use "fileid" from
> filecache between instances; I'm using the storage and path as a key
> instead.
> However, if the storage string is more than 64 chars, the storageid is
> hashed, which makes this not possible.
> 
> I can work around this for the current file, but I need it's parent's
> storage as well.  Is it safe to assume that a child file and its parent
> will always have the same storageid?
> 
> Thanks,
> ~Sarah Jones

Using the cache alone it's not possible to get the parent storage, the cache 
holds no information about the context of a storage.

You can get the parent storage using information from the mount configuration 
by getting the full path of a file (getPath on either \OC\Files\Filesystem or 
\OC\Files\View), get the parent path and resolve that back to the cache but 
this is not always unqiue, if the same storage is mounted in different places 
it has multiple parent paths, this is one of the reason why we don't storage 
that information in the cache.

 - Robin Appelman



More information about the Owncloud mailing list