Create documents directory before copying genesis
This commit is contained in:
parent
f1e3e1bf27
commit
477805fe48
@ -38,9 +38,12 @@ class Db_Session extends \OCA\Documents\Db {
|
|||||||
public static function start($uid, File $file){
|
public static function start($uid, File $file){
|
||||||
list($ownerView, $path) = $file->getOwnerViewAndPath();
|
list($ownerView, $path) = $file->getOwnerViewAndPath();
|
||||||
|
|
||||||
|
// Create a directory to store genesis
|
||||||
|
$docView = $ownerView->initDocumentsView();
|
||||||
|
|
||||||
$oldSession = new Db_Session();
|
$oldSession = new Db_Session();
|
||||||
$oldSession->loadBy('file_id', $file->getFileId());
|
$oldSession->loadBy('file_id', $file->getFileId());
|
||||||
|
|
||||||
//If there is no existing session we need to start a new one
|
//If there is no existing session we need to start a new one
|
||||||
if (!$oldSession->hasData()){
|
if (!$oldSession->hasData()){
|
||||||
|
|
||||||
|
@ -49,6 +49,10 @@ class View extends \OC\Files\View{
|
|||||||
$newName = '/' . sha1($ownerView->file_get_contents($filePath)) . '.odt';
|
$newName = '/' . sha1($ownerView->file_get_contents($filePath)) . '.odt';
|
||||||
|
|
||||||
$ownerView->copy($filePath, self::DOCUMENTS_DIRNAME . $newName);
|
$ownerView->copy($filePath, self::DOCUMENTS_DIRNAME . $newName);
|
||||||
|
if (!$ownerView->file_exists(self::DOCUMENTS_DIRNAME . $newName)){
|
||||||
|
throw new \Exception('Failed to copy genesis');
|
||||||
|
}
|
||||||
|
|
||||||
\OC_FileProxy::$enabled = $proxyStatus;
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
return $newName;
|
return $newName;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user