core icon indicating copy to clipboard operation
core copied to clipboard

Versions app doesn't work with shared files

Open MTGap opened this issue 13 years ago • 3 comments

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

MTGap avatar Feb 14 '13 01:02 MTGap

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.

schiessle avatar Feb 14 '13 10:02 schiessle

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.

karlitschek avatar Feb 14 '13 10:02 karlitschek

Thanks for clarification. If it is planed for OC6 we still have some time to sort things out.

schiessle avatar Feb 14 '13 10:02 schiessle