Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/documentserver_community.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-01-13 17:49:18 +0300
committerRobin Appelman <robin@icewind.nl>2020-01-13 17:49:18 +0300
commitc0eae29251f983346b2f49a6ebf14010e8c86be6 (patch)
treeecc048337f6216775bcdee293f3d6b295820a981 /lib
parent31d6b887c892f60ba35919760e4feed775bb95ed (diff)
fix hooks not triggering when saving document
this fixes, among other things, versions not being created
Diffstat (limited to 'lib')
-rw-r--r--lib/Document/DocumentStore.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Document/DocumentStore.php b/lib/Document/DocumentStore.php
index 23c49da..9dd6174 100644
--- a/lib/Document/DocumentStore.php
+++ b/lib/Document/DocumentStore.php
@@ -21,6 +21,7 @@
namespace OCA\DocumentServer\Document;
+use OC\Files\Filesystem;
use OCP\Files\File;
use OCA\DocumentServer\DocumentConverter;
use OCP\Files\Folder;
@@ -159,6 +160,7 @@ class DocumentStore {
}
$targetExtension = $sourceFile->getExtension();
+ $storage = $sourceFile->getStorage();
$localPath = $this->getLocalPath($docFolder);
@@ -166,6 +168,14 @@ class DocumentStore {
$this->documentConverter->saveChanges($localPath, $changes, $target, $targetExtension);
$savedContent = fopen($target, 'r');
+ if (!Filesystem::$loaded) {
+ // the filesystem needs to be initialized for a user in order for hooks to trigger
+ // just the `getUserFolder` is not enough for this
+ [, $user] = explode('/', $sourceFile->getPath());
+ $userDir = '/' . $user . '/files';
+ Filesystem::init($user, $userDir);
+ }
+
$sourceFile->putContent(stream_get_contents($savedContent));
}