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

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2020-09-08 12:31:31 +0300
committerSergey Linnik <sergey.linnik@onlyoffice.com>2020-09-15 11:26:34 +0300
commit57e7141ae580414a0902c0805fb19d7c9dfab524 (patch)
tree82d35713ceca284115245420f1d97fdabb8f8aa7 /lib/fileutility.php
parente65c8910f3d3ae8d588549710752d00c7a895f07 (diff)
storing key in db
Diffstat (limited to 'lib/fileutility.php')
-rw-r--r--lib/fileutility.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/fileutility.php b/lib/fileutility.php
index 5dc4690..bcd0843 100644
--- a/lib/fileutility.php
+++ b/lib/fileutility.php
@@ -30,6 +30,7 @@ use OCP\Share\IManager;
use OCA\Files_Sharing\External\Storage as SharingExternalStorage;
use OCA\Onlyoffice\AppConfig;
+use OCA\Onlyoffice\KeyManager;
/**
* File utility
@@ -217,6 +218,8 @@ class FileUtility {
* @return string
*/
public function getKey($file, $origin = false) {
+ $fileId = $file->getId();
+
if ($origin
&& $file->getStorage()->instanceOfStorage(SharingExternalStorage::class)) {
@@ -227,13 +230,19 @@ class FileUtility {
return $key;
}
} catch (\Exception $e) {
- $this->logger->logException($e, ["message" => "Failed to request federated key " . $file->getId(), "app" => $this->appName]);
+ $this->logger->logException($e, ["message" => "Failed to request federated key $fileId", "app" => $this->appName]);
}
}
- $instanceId = $this->config->GetSystemValue("instanceid", true);
+ $key = KeyManager::get($fileId);
+
+ if (empty($key) ) {
+ $instanceId = $this->config->GetSystemValue("instanceid", true);
- $key = $instanceId . "_" . $file->getEtag();
+ $key = $instanceId . "_" . $file->getEtag();
+
+ KeyManager::set($fileId, $key);
+ }
return $key;
}