Skip to content

Commit

Permalink
fix(Storage): restore compatibility wiht files_external
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Oct 16, 2024
1 parent c903789 commit 50cf174
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions lib/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,12 @@ public function unlink($path) {
}

/**
* @param string $path1
* @param string $path2
* @return bool
* @param string $source
* @param string $target
*/
public function rename($path1, $path2) {
$oldPath = $this->formatPath($path1);
$newPath = $this->formatPath($path2);
public function rename($source, $target): bool {
$oldPath = $this->formatPath($source);
$newPath = $this->formatPath($target);

try {
$item = $this->getFileOrFolder($newPath);
Expand Down Expand Up @@ -472,7 +471,7 @@ public function writeBack($tmpFile, $path) {
* @param string $path
* @return bool
*/
public function isCreatable($path) {
public function isCreatable($path): bool {
try {
return $this->hasPermission($path, self::SP_PERMISSION_CREATE);
} catch (\Exception $e) {
Expand All @@ -484,7 +483,7 @@ public function isCreatable($path) {
* @param string $path
* @return bool
*/
public function isUpdatable($path) {
public function isUpdatable($path): bool {
try {
return $this->hasPermission($path, self::SP_PERMISSION_UPDATE);
} catch (\Exception $e) {
Expand All @@ -496,7 +495,7 @@ public function isUpdatable($path) {
* @param string $path
* @return bool
*/
public function isReadable($path) {
public function isReadable($path): bool {
try {
return $this->hasPermission($path, self::SP_PERMISSION_READ);
} catch (\Exception $e) {
Expand All @@ -508,7 +507,7 @@ public function isReadable($path) {
* @param string $path
* @return bool
*/
public function isDeletable($path) {
public function isDeletable($path): bool {
try {
return $this->hasPermission($path, self::SP_PERMISSION_DELETE);
} catch (\Exception $e) {
Expand All @@ -521,7 +520,7 @@ public function isDeletable($path) {
* @param int $permissionType
* @return bool
*/
private function hasPermission($path, $permissionType) {
private function hasPermission($path, $permissionType): bool {
$serverUrl = $this->formatPath($path);
return $this->getUserPermissions($serverUrl)->has($permissionType);
}
Expand All @@ -535,7 +534,7 @@ private function hasPermission($path, $permissionType) {
* @return bool
* @since 6.0.0
*/
public function touch($path, $mtime = null) {
public function touch($path, $mtime = null): bool {
return false;
}

Expand All @@ -544,7 +543,7 @@ public function touch($path, $mtime = null) {
*
* @param array $parameters
*/
private function fixDI(array $parameters) {
private function fixDI(array $parameters): void {
if (isset($parameters['contextFactory'])
&& $parameters['contextFactory'] instanceof ContextsFactory) {
$this->contextsFactory = $parameters['contextFactory'];
Expand Down Expand Up @@ -583,7 +582,7 @@ private function fixDI(array $parameters) {
* @param $serverUrl
* @return ClientObjectCollection[]
*/
private function getFolderContents($serverUrl) {
private function getFolderContents($serverUrl): array {
$folder = $this->getFileOrFolder($serverUrl);
$entry = $this->fileCache->get($serverUrl);
if ($entry === null || !isset($entry['children'])) {
Expand Down

0 comments on commit 50cf174

Please sign in to comment.