diff options
author | provokateurin <kate@provokateurin.de> | 2024-10-08 15:13:16 +0200 |
---|---|---|
committer | Kate <26026535+provokateurin@users.noreply.github.com> | 2024-10-23 13:24:18 +0200 |
commit | 0de4843b73ee4779c7e455dd80c36a6b506e0024 (patch) | |
tree | 67ad68f0b4c925a65b029bdfcaafe5681c527d3a /lib/private/Files/Storage | |
parent | 74cd6e295a8e2e7c64e4fe38ba775986c57509a4 (diff) | |
download | nextcloud-server-refactor/storage/constructors.tar.gz nextcloud-server-refactor/storage/constructors.zip |
refactor(Storage): Align all Storage constructorsrefactor/storage/constructors
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private/Files/Storage')
-rw-r--r-- | lib/private/Files/Storage/Common.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/CommonTest.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/DAV.php | 26 | ||||
-rw-r--r-- | lib/private/Files/Storage/FailedStorage.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/Home.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Local.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Temporary.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Availability.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encoding.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Jail.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/KnownMtime.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/PermissionsMask.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Wrapper.php | 2 |
15 files changed, 44 insertions, 44 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 6006c477440..334ca34294e 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -65,7 +65,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, private ?LoggerInterface $logger = null; private ?IFilenameValidator $filenameValidator = null; - public function __construct($parameters) { + public function __construct(array $parameters) { } protected function remove(string $path): bool { diff --git a/lib/private/Files/Storage/CommonTest.php b/lib/private/Files/Storage/CommonTest.php index bf61dfaec86..da796130899 100644 --- a/lib/private/Files/Storage/CommonTest.php +++ b/lib/private/Files/Storage/CommonTest.php @@ -14,8 +14,8 @@ class CommonTest extends \OC\Files\Storage\Common { */ private $storage; - public function __construct($params) { - $this->storage = new \OC\Files\Storage\Local($params); + public function __construct(array $parameters) { + $this->storage = new \OC\Files\Storage\Local($parameters); } public function getId(): string { diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index e0f7700415f..b849a69246f 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -83,14 +83,14 @@ class DAV extends Common { ]; /** - * @param array $params + * @param array $parameters * @throws \Exception */ - public function __construct($params) { + public function __construct(array $parameters) { $this->statCache = new ArrayCache(); $this->httpClientService = Server::get(IClientService::class); - if (isset($params['host']) && isset($params['user']) && isset($params['password'])) { - $host = $params['host']; + if (isset($parameters['host']) && isset($parameters['user']) && isset($parameters['password'])) { + $host = $parameters['host']; //remove leading http[s], will be generated in createBaseUri() if (str_starts_with($host, 'https://')) { $host = substr($host, 8); @@ -98,16 +98,16 @@ class DAV extends Common { $host = substr($host, 7); } $this->host = $host; - $this->user = $params['user']; - $this->password = $params['password']; - if (isset($params['authType'])) { - $this->authType = $params['authType']; + $this->user = $parameters['user']; + $this->password = $parameters['password']; + if (isset($parameters['authType'])) { + $this->authType = $parameters['authType']; } - if (isset($params['secure'])) { - if (is_string($params['secure'])) { - $this->secure = ($params['secure'] === 'true'); + if (isset($parameters['secure'])) { + if (is_string($parameters['secure'])) { + $this->secure = ($parameters['secure'] === 'true'); } else { - $this->secure = (bool)$params['secure']; + $this->secure = (bool)$parameters['secure']; } } else { $this->secure = false; @@ -116,7 +116,7 @@ class DAV extends Common { // inject mock for testing $this->certManager = \OC::$server->getCertificateManager(); } - $this->root = $params['root'] ?? '/'; + $this->root = $parameters['root'] ?? '/'; $this->root = '/' . ltrim($this->root, '/'); $this->root = rtrim($this->root, '/') . '/'; } else { diff --git a/lib/private/Files/Storage/FailedStorage.php b/lib/private/Files/Storage/FailedStorage.php index 1c91a775525..a8288de48d0 100644 --- a/lib/private/Files/Storage/FailedStorage.php +++ b/lib/private/Files/Storage/FailedStorage.php @@ -20,10 +20,10 @@ class FailedStorage extends Common { protected $e; /** - * @param array $params ['exception' => \Exception] + * @param array $parameters ['exception' => \Exception] */ - public function __construct($params) { - $this->e = $params['exception']; + public function __construct(array $parameters) { + $this->e = $parameters['exception']; if (!$this->e) { throw new \InvalidArgumentException('Missing "exception" argument in FailedStorage constructor'); } diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index 5280cb26ff3..91b8071ac30 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -30,11 +30,11 @@ class Home extends Local implements \OCP\Files\IHomeStorage { /** * Construct a Home storage instance * - * @param array $arguments array with "user" containing the - * storage owner + * @param array $parameters array with "user" containing the + * storage owner */ - public function __construct($arguments) { - $this->user = $arguments['user']; + public function __construct(array $parameters) { + $this->user = $parameters['user']; $datadir = $this->user->getHome(); $this->id = 'home::' . $this->user->getUID(); diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 9e3ec663f03..0b0272ce717 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -40,11 +40,11 @@ class Local extends \OC\Files\Storage\Common { protected bool $caseInsensitive = false; - public function __construct($arguments) { - if (!isset($arguments['datadir']) || !is_string($arguments['datadir'])) { + public function __construct(array $parameters) { + if (!isset($parameters['datadir']) || !is_string($parameters['datadir'])) { throw new \InvalidArgumentException('No data directory set for local storage'); } - $this->datadir = str_replace('//', '/', $arguments['datadir']); + $this->datadir = str_replace('//', '/', $parameters['datadir']); // some crazy code uses a local storage on root... if ($this->datadir === '/') { $this->realDataDir = $this->datadir; @@ -64,7 +64,7 @@ class Local extends \OC\Files\Storage\Common { // support Write-Once-Read-Many file systems $this->unlinkOnTruncate = $this->config->getSystemValueBool('localstorage.unlink_on_truncate', false); - if (isset($arguments['isExternal']) && $arguments['isExternal'] && !$this->stat('')) { + if (isset($parameters['isExternal']) && $parameters['isExternal'] && !$this->stat('')) { // data dir not accessible or available, can happen when using an external storage of type Local // on an unmounted system mount point throw new StorageNotAvailableException('Local storage path does not exist "' . $this->getSourcePath('') . '"'); diff --git a/lib/private/Files/Storage/Temporary.php b/lib/private/Files/Storage/Temporary.php index 429f0fd1e92..ff7a816930d 100644 --- a/lib/private/Files/Storage/Temporary.php +++ b/lib/private/Files/Storage/Temporary.php @@ -11,7 +11,7 @@ namespace OC\Files\Storage; * local storage backend in temporary folder for testing purpose */ class Temporary extends Local { - public function __construct($arguments = []) { + public function __construct(array $parameters = []) { parent::__construct(['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]); } diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index ffe8f08e40f..70212cacab8 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -23,7 +23,7 @@ class Availability extends Wrapper { /** @var IConfig */ protected $config; - public function __construct($parameters) { + public function __construct(array $parameters) { $this->config = $parameters['config'] ?? \OC::$server->getConfig(); parent::__construct($parameters); } diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index 02b70e5ae60..d5afbad9592 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -28,7 +28,7 @@ class Encoding extends Wrapper { /** * @param array $parameters */ - public function __construct($parameters) { + public function __construct(array $parameters) { $this->storage = $parameters['storage']; $this->namesCache = new CappedMemoryCache(); } diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index a29e985377b..c9ed9c7cb53 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -42,7 +42,7 @@ class Encryption extends Wrapper { * @param array $parameters */ public function __construct( - $parameters, + array $parameters, private IManager $encryptionManager, private Util $util, private LoggerInterface $logger, diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index a85f59b87eb..c8db0e94e59 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -30,14 +30,14 @@ class Jail extends Wrapper { protected $rootPath; /** - * @param array $arguments ['storage' => $storage, 'root' => $root] + * @param array $parameters ['storage' => $storage, 'root' => $root] * * $storage: The storage that will be wrapper * $root: The folder in the wrapped storage that will become the root folder of the wrapped storage */ - public function __construct($arguments) { - parent::__construct($arguments); - $this->rootPath = $arguments['root']; + public function __construct(array $parameters) { + parent::__construct($parameters); + $this->rootPath = $parameters['root']; } public function getUnjailedPath(string $path): string { diff --git a/lib/private/Files/Storage/Wrapper/KnownMtime.php b/lib/private/Files/Storage/Wrapper/KnownMtime.php index 37454bdad17..657c6c9250c 100644 --- a/lib/private/Files/Storage/Wrapper/KnownMtime.php +++ b/lib/private/Files/Storage/Wrapper/KnownMtime.php @@ -20,10 +20,10 @@ class KnownMtime extends Wrapper { private CappedMemoryCache $knowMtimes; private ClockInterface $clock; - public function __construct($arguments) { - parent::__construct($arguments); + public function __construct(array $parameters) { + parent::__construct($parameters); $this->knowMtimes = new CappedMemoryCache(); - $this->clock = $arguments['clock']; + $this->clock = $parameters['clock']; } public function file_put_contents(string $path, mixed $data): int|float|false { diff --git a/lib/private/Files/Storage/Wrapper/PermissionsMask.php b/lib/private/Files/Storage/Wrapper/PermissionsMask.php index aed37bc27ba..684040146ba 100644 --- a/lib/private/Files/Storage/Wrapper/PermissionsMask.php +++ b/lib/private/Files/Storage/Wrapper/PermissionsMask.php @@ -25,14 +25,14 @@ class PermissionsMask extends Wrapper { private $mask; /** - * @param array $arguments ['storage' => $storage, 'mask' => $mask] + * @param array $parameters ['storage' => $storage, 'mask' => $mask] * * $storage: The storage the permissions mask should be applied on * $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants */ - public function __construct($arguments) { - parent::__construct($arguments); - $this->mask = $arguments['mask']; + public function __construct(array $parameters) { + parent::__construct($parameters); + $this->mask = $parameters['mask']; } private function checkMask(int $permissions): bool { diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index 3fd46c76d21..3be77ba1b37 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -25,7 +25,7 @@ class Quota extends Wrapper { /** * @param array $parameters */ - public function __construct($parameters) { + public function __construct(array $parameters) { parent::__construct($parameters); $this->quota = $parameters['quota'] ?? null; $this->quotaCallback = $parameters['quotaCallback'] ?? null; diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index e1edbab95c6..6dea439fe25 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -36,7 +36,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea /** * @param array $parameters */ - public function __construct($parameters) { + public function __construct(array $parameters) { $this->storage = $parameters['storage']; } |