Versions app doesn't work with shared files
The files_versions apps doesn't work with shared files. There also seems to be some fixes for this in stable45 that don't appear in master. I'd do it myself, but I'm in the middle of exam week :( Sorry
Recommended solution:
- Remove getUidAndFilename()
- Use the new getOwner() filesystem method to find the real owner and mount that fil
- If the real owner does not math OCP\User::getUser() call getFileInfo() and to get the file id
- Pass the file id to getPath() to get the file path for the owner
- Continue the copying process
@karlitschek @icewind1991
I tried following code as a replacement for getUidAndFilename():
$owner = \OC\Files\Filesystem::getOwner($filename);
if ( $owner != \OCP\User::getUser() ) {
$datadir = \OC_Config::getValue( "datadirectory", \OC::$SERVERROOT."/data" );
\OC\Files\Filesystem::mount( '\OC\Files\Storage\Local', array('datadir'=>$datadir), '/'.$owner );
$info = \OC\Files\Filesystem::getFileInfo($filename);
$id = $info['fileid'];
$path = \OC\Files\Filesystem::getPath($id);
}
I get the right file ID but always an empty path. @icewind1991 can you give me an pointer what I'm doing wrong here?
@karlitschek Will you block the complete OC namespace for apps in ownCloud5? Because it seems like we still relay on a lot of OC... classes to access the file system.
Yes. tha's the idea for ownCloud 6. We need proper public API for a lot of the filesystem stuff. This no opimal how it is today. We let's discuss this during he ownCloud 6 cycle.
Thanks for clarification. If it is planed for OC6 we still have some time to sort things out.