Create documents directory before copying genesis

pull/1/head
Victor Dubiniuk 11 years ago
parent f1e3e1bf27
commit 477805fe48

@ -38,9 +38,12 @@ class Db_Session extends \OCA\Documents\Db {
public static function start($uid, File $file){
list($ownerView, $path) = $file->getOwnerViewAndPath();
// Create a directory to store genesis
$docView = $ownerView->initDocumentsView();
$oldSession = new Db_Session();
$oldSession->loadBy('file_id', $file->getFileId());
//If there is no existing session we need to start a new one
if (!$oldSession->hasData()){

@ -49,6 +49,10 @@ class View extends \OC\Files\View{
$newName = '/' . sha1($ownerView->file_get_contents($filePath)) . '.odt';
$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;
return $newName;
}

Loading…
Cancel
Save