diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 09:30:18 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 16:34:56 +0100 |
commit | b80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch) | |
tree | ec20e0ffa2f86b9b54939a83a785407319f94559 /apps/files_external/lib/Lib | |
parent | 62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff) | |
download | nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip |
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_external/lib/Lib')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 28 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/FTP.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SFTP.php | 12 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/Swift.php | 4 |
5 files changed, 25 insertions, 25 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 60e39a4d300..0d7cbacd8b5 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -128,10 +128,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { private function headObject($key) { if (!isset($this->objectCache[$key])) { try { - $this->objectCache[$key] = $this->getConnection()->headObject(array( + $this->objectCache[$key] = $this->getConnection()->headObject([ 'Bucket' => $this->bucket, 'Key' => $key - )); + ]); } catch (S3Exception $e) { if ($e->getStatusCode() >= 500) { throw $e; @@ -191,7 +191,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { $stmt = \OC::$server->getDatabaseConnection()->prepare( 'SELECT `numeric_id`, `id` FROM `*PREFIX*storages` WHERE `id` IN (?, ?)' ); - $stmt->execute(array($oldId, $this->id)); + $stmt->execute([$oldId, $this->id]); while ($row = $stmt->fetch()) { $storages[$row['id']] = $row['numeric_id']; } @@ -204,7 +204,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { $stmt = \OC::$server->getDatabaseConnection()->prepare( 'UPDATE `*PREFIX*storages` SET `id` = ? WHERE `id` = ?' ); - $stmt->execute(array($this->id, $oldId)); + $stmt->execute([$this->id, $oldId]); } // only the bucket based id may exist, do nothing } @@ -235,12 +235,12 @@ class AmazonS3 extends \OC\Files\Storage\Common { } try { - $this->getConnection()->putObject(array( + $this->getConnection()->putObject([ 'Bucket' => $this->bucket, 'Key' => $path . '/', 'Body' => '', 'ContentType' => 'httpd/unix-directory' - )); + ]); $this->testTimeout(); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); @@ -284,9 +284,9 @@ class AmazonS3 extends \OC\Files\Storage\Common { } private function batchDelete($path = null) { - $params = array( + $params = [ 'Bucket' => $this->bucket - ); + ]; if ($path !== null) { $params['Prefix'] = $path . '/'; } @@ -326,7 +326,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { } try { - $files = array(); + $files = []; $results = $this->getConnection()->getPaginator('ListObjects', [ 'Bucket' => $this->bucket, 'Delimiter' => '/', @@ -550,7 +550,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { public function touch($path, $mtime = null) { $path = $this->normalizePath($path); - $metadata = array(); + $metadata = []; if (is_null($mtime)) { $mtime = time(); } @@ -599,11 +599,11 @@ class AmazonS3 extends \OC\Files\Storage\Common { if ($this->is_file($path1)) { try { - $this->getConnection()->copyObject(array( + $this->getConnection()->copyObject([ 'Bucket' => $this->bucket, 'Key' => $this->cleanKey($path2), 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1) - )); + ]); $this->testTimeout(); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); @@ -613,11 +613,11 @@ class AmazonS3 extends \OC\Files\Storage\Common { $this->remove($path2); try { - $this->getConnection()->copyObject(array( + $this->getConnection()->copyObject([ 'Bucket' => $this->bucket, 'Key' => $path2 . '/', 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1 . '/') - )); + ]); $this->testTimeout(); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 8f014ce921c..adf7f29a3d6 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -109,7 +109,7 @@ class FTP extends StreamWrapper{ case 'a': case 'ab': //these are supported by the wrapper - $context = stream_context_create(array('ftp' => array('overwrite' => true))); + $context = stream_context_create(['ftp' => ['overwrite' => true]]); $handle = fopen($this->constructUrl($path), $mode, false, $context); return RetryWrapper::wrap($handle); case 'r+': @@ -150,7 +150,7 @@ class FTP extends StreamWrapper{ if (function_exists('ftp_login')) { return true; } else { - return array('ftp'); + return ['ftp']; } } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 5d83bf253e4..eaead3eea45 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -251,8 +251,8 @@ class SFTP extends \OC\Files\Storage\Common { try { $keyPath = $this->hostKeysPath(); if (file_exists($keyPath)) { - $hosts = array(); - $keys = array(); + $hosts = []; + $keys = []; $lines = file($keyPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($lines) { foreach ($lines as $line) { @@ -267,7 +267,7 @@ class SFTP extends \OC\Files\Storage\Common { } } catch (\Exception $e) { } - return array(); + return []; } /** @@ -307,7 +307,7 @@ class SFTP extends \OC\Files\Storage\Common { } $id = md5('sftp:' . $path); - $dirStream = array(); + $dirStream = []; foreach($list as $file) { if ($file !== '.' && $file !== '..') { $dirStream[] = $file; @@ -391,7 +391,7 @@ class SFTP extends \OC\Files\Storage\Common { case 'x+': case 'c': case 'c+': - $context = stream_context_create(array('sftp' => array('session' => $this->getConnection()))); + $context = stream_context_create(['sftp' => ['session' => $this->getConnection()]]); $handle = fopen($this->constructUrl($path), $mode, false, $context); return RetryWrapper::wrap($handle); } @@ -464,7 +464,7 @@ class SFTP extends \OC\Files\Storage\Common { $mtime = $stat ? $stat['mtime'] : -1; $size = $stat ? $stat['size'] : 0; - return array('mtime' => $mtime, 'size' => $size, 'ctime' => -1); + return ['mtime' => $mtime, 'size' => $size, 'ctime' => -1]; } catch (\Exception $e) { return false; } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 6cf7bb7db85..8f7d594cd67 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -472,7 +472,7 @@ class SMB extends Common implements INotifyStorage { } try { - $this->statCache = array(); + $this->statCache = []; $content = $this->share->dir($this->buildPath($path)); foreach ($content as $file) { if ($file->isDirectory()) { diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 0072f91d4ed..daa222def04 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -351,7 +351,7 @@ class Swift extends \OC\Files\Storage\Common { $mtime = floor($mtime); } - $stat = array(); + $stat = []; $stat['size'] = (int)$object->contentLength; $stat['mtime'] = $mtime; $stat['atime'] = time(); @@ -602,7 +602,7 @@ class Swift extends \OC\Files\Storage\Common { } $path = $this->normalizePath($path); $dh = $this->opendir($path); - $content = array(); + $content = []; while (($file = readdir($dh)) !== false) { $content[] = $file; } |