|
|
|
@ -12,20 +12,28 @@ class View extends \OC\Files\View{
|
|
|
|
|
$view->mkdir(self::OFFICE_DIRNAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!self::$officeView){
|
|
|
|
|
self::$officeView = new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
|
|
|
|
}
|
|
|
|
|
//if (!self::$officeView){
|
|
|
|
|
// self::$officeView = new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
return self::$officeView;
|
|
|
|
|
// it was a bad idea to use a static method.
|
|
|
|
|
// to be changed later
|
|
|
|
|
return new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function storeDocument($uid, $path){
|
|
|
|
|
$view = new \OC\Files\View('/' . $uid);
|
|
|
|
|
|
|
|
|
|
$proxyStatus = \OC_FileProxy::$enabled;
|
|
|
|
|
\OC_FileProxy::$enabled = false;
|
|
|
|
|
$view->copy('/files' . $path, self::OFFICE_DIRNAME . $path);
|
|
|
|
|
|
|
|
|
|
$newName = '/' . self::getHashByGenesis($uid, $path) . '.odt';
|
|
|
|
|
$view = new \OC\Files\View('/' . $uid);
|
|
|
|
|
$view->copy('/files' . $path, self::OFFICE_DIRNAME . $newName);
|
|
|
|
|
\OC_FileProxy::$enabled = $proxyStatus;
|
|
|
|
|
return $path;
|
|
|
|
|
return $newName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getHashByGenesis($uid, $genesisPath){
|
|
|
|
|
$officeView = self::initOfficeView($uid);
|
|
|
|
|
return sha1($officeView->file_get_contents($genesisPath));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|