aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2023-10-20 09:08:08 +0200
committerThomas Citharel <tcit@tcit.fr>2024-02-02 14:59:21 +0100
commit30798eb6c238a0090fd42d2b44644f4fc24d8c8d (patch)
treeffdc39e7740cb77b057430469a38001afa7dcdeb /lib/private/Files/ObjectStore
parent3be3dbdb3b4d707332a1c7edc1db378bc8e90375 (diff)
downloadnextcloud-server-30798eb6c238a0090fd42d2b44644f4fc24d8c8d.tar.gz
nextcloud-server-30798eb6c238a0090fd42d2b44644f4fc24d8c8d.zip
refactor(objectstorage): cleanup types
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'lib/private/Files/ObjectStore')
-rw-r--r--lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php9
-rw-r--r--lib/private/Files/ObjectStore/HomeObjectStoreStorage.php16
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php11
3 files changed, 21 insertions, 15 deletions
diff --git a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php
index 2f6db935236..2c473cb6da9 100644
--- a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php
@@ -26,9 +26,12 @@ declare(strict_types=1);
namespace OC\Files\ObjectStore;
class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage {
- /** @var string */
- private $internalId;
+ private string $internalId;
+ /**
+ * @param array $params
+ * @throws \Exception
+ */
public function __construct($params) {
if (!isset($params['internal-id'])) {
throw new \Exception('missing id in parameters');
@@ -37,7 +40,7 @@ class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage {
parent::__construct($params);
}
- public function getId() {
+ public function getId(): string {
return 'object::appdata::preview:' . $this->internalId;
}
}
diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php
index feceb706e19..443c5147742 100644
--- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php
@@ -26,6 +26,7 @@
*/
namespace OC\Files\ObjectStore;
+use Exception;
use OCP\Files\IHomeStorage;
use OCP\IUser;
@@ -34,17 +35,19 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage
/**
* The home user storage requires a user object to create a unique storage id
+ *
* @param array $params
+ * @throws Exception
*/
public function __construct($params) {
if (! isset($params['user']) || ! $params['user'] instanceof IUser) {
- throw new \Exception('missing user object in parameters');
+ throw new Exception('missing user object in parameters');
}
$this->user = $params['user'];
parent::__construct($params);
}
- public function getId() {
+ public function getId(): string {
return 'object::user:' . $this->user->getUID();
}
@@ -52,13 +55,10 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage
* get the owner of a path
*
* @param string $path The path to get the owner
- * @return false|string uid
+ * @return string uid
*/
- public function getOwner($path) {
- if (is_object($this->user)) {
- return $this->user->getUID();
- }
- return false;
+ public function getOwner($path): string {
+ return $this->user->getUID();
}
public function getUser(): IUser {
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 5c2881bef0f..3e0fbd15919 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -47,6 +47,7 @@ use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\ObjectStore\IObjectStoreMultiPartUpload;
use OCP\Files\Storage\IChunkedFileWrite;
use OCP\Files\Storage\IStorage;
+use OCP\ILogger;
class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFileWrite {
use CopyDirectory;
@@ -55,13 +56,15 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
protected string $id;
private string $objectPrefix = 'urn:oid:';
- private $logger;
+ private ILogger $logger;
private bool $handleCopiesAsOwned;
+ protected bool $validateWrites = true;
- /** @var bool */
- protected $validateWrites = true;
-
+ /**
+ * @param array $params
+ * @throws \Exception
+ */
public function __construct($params) {
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
$this->objectStore = $params['objectstore'];