diff options
Diffstat (limited to 'lib/private/Files/Storage/Wrapper/KnownMtime.php')
-rw-r--r-- | lib/private/Files/Storage/Wrapper/KnownMtime.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/private/Files/Storage/Wrapper/KnownMtime.php b/lib/private/Files/Storage/Wrapper/KnownMtime.php index a7360ae1346..657c6c9250c 100644 --- a/lib/private/Files/Storage/Wrapper/KnownMtime.php +++ b/lib/private/Files/Storage/Wrapper/KnownMtime.php @@ -20,13 +20,13 @@ 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($path, $data) { + public function file_put_contents(string $path, mixed $data): int|float|false { $result = parent::file_put_contents($path, $data); if ($result) { $now = $this->clock->now()->getTimestamp(); @@ -35,7 +35,7 @@ class KnownMtime extends Wrapper { return $result; } - public function stat($path) { + public function stat(string $path): array|false { $stat = parent::stat($path); if ($stat) { $this->applyKnownMtime($path, $stat); @@ -43,7 +43,7 @@ class KnownMtime extends Wrapper { return $stat; } - public function getMetaData($path) { + public function getMetaData(string $path): ?array { $stat = parent::getMetaData($path); if ($stat) { $this->applyKnownMtime($path, $stat); @@ -51,19 +51,19 @@ class KnownMtime extends Wrapper { return $stat; } - private function applyKnownMtime(string $path, array &$stat) { + private function applyKnownMtime(string $path, array &$stat): void { if (isset($stat['mtime'])) { $knownMtime = $this->knowMtimes->get($path) ?? 0; $stat['mtime'] = max($stat['mtime'], $knownMtime); } } - public function filemtime($path) { + public function filemtime(string $path): int|false { $knownMtime = $this->knowMtimes->get($path) ?? 0; return max(parent::filemtime($path), $knownMtime); } - public function mkdir($path) { + public function mkdir(string $path): bool { $result = parent::mkdir($path); if ($result) { $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); @@ -71,7 +71,7 @@ class KnownMtime extends Wrapper { return $result; } - public function rmdir($path) { + public function rmdir(string $path): bool { $result = parent::rmdir($path); if ($result) { $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); @@ -79,7 +79,7 @@ class KnownMtime extends Wrapper { return $result; } - public function unlink($path) { + public function unlink(string $path): bool { $result = parent::unlink($path); if ($result) { $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); @@ -87,7 +87,7 @@ class KnownMtime extends Wrapper { return $result; } - public function rename($source, $target) { + public function rename(string $source, string $target): bool { $result = parent::rename($source, $target); if ($result) { $this->knowMtimes->set($target, $this->clock->now()->getTimestamp()); @@ -96,7 +96,7 @@ class KnownMtime extends Wrapper { return $result; } - public function copy($source, $target) { + public function copy(string $source, string $target): bool { $result = parent::copy($source, $target); if ($result) { $this->knowMtimes->set($target, $this->clock->now()->getTimestamp()); @@ -104,7 +104,7 @@ class KnownMtime extends Wrapper { return $result; } - public function fopen($path, $mode) { + public function fopen(string $path, string $mode) { $result = parent::fopen($path, $mode); if ($result && $mode === 'w') { $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); @@ -112,7 +112,7 @@ class KnownMtime extends Wrapper { return $result; } - public function touch($path, $mtime = null) { + public function touch(string $path, ?int $mtime = null): bool { $result = parent::touch($path, $mtime); if ($result) { $this->knowMtimes->set($path, $mtime ?? $this->clock->now()->getTimestamp()); @@ -120,7 +120,7 @@ class KnownMtime extends Wrapper { return $result; } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { $result = parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); if ($result) { $this->knowMtimes->set($targetInternalPath, $this->clock->now()->getTimestamp()); @@ -128,7 +128,7 @@ class KnownMtime extends Wrapper { return $result; } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { $result = parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); if ($result) { $this->knowMtimes->set($targetInternalPath, $this->clock->now()->getTimestamp()); |