summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/Controller/AjaxController.php6
-rw-r--r--apps/files_external/lib/Controller/ApiController.php4
-rw-r--r--apps/files_external/lib/Controller/GlobalStoragesController.php2
-rw-r--r--apps/files_external/lib/Controller/UserGlobalStoragesController.php6
-rw-r--r--apps/files_external/lib/Controller/UserStoragesController.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php28
-rw-r--r--apps/files_external/lib/Lib/Storage/FTP.php4
-rw-r--r--apps/files_external/lib/Lib/Storage/SFTP.php12
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/Swift.php4
-rw-r--r--apps/files_external/lib/config.php8
11 files changed, 39 insertions, 39 deletions
diff --git a/apps/files_external/lib/Controller/AjaxController.php b/apps/files_external/lib/Controller/AjaxController.php
index 347fa02e1b0..b9e414a410a 100644
--- a/apps/files_external/lib/Controller/AjaxController.php
+++ b/apps/files_external/lib/Controller/AjaxController.php
@@ -88,12 +88,12 @@ class AjaxController extends Controller {
public function getSshKeys($keyLength = 1024) {
$key = $this->generateSshKeys($keyLength);
return new JSONResponse(
- array('data' => array(
+ ['data' => [
'private_key' => $key['privatekey'],
'public_key' => $key['publickey']
- ),
+ ],
'status' => 'success'
- ));
+ ]);
}
/**
diff --git a/apps/files_external/lib/Controller/ApiController.php b/apps/files_external/lib/Controller/ApiController.php
index 1882ea31504..aa0c8ddb6a1 100644
--- a/apps/files_external/lib/Controller/ApiController.php
+++ b/apps/files_external/lib/Controller/ApiController.php
@@ -74,7 +74,7 @@ class ApiController extends OCSController {
$permissions |= \OCP\Constants::PERMISSION_DELETE;
}
- $entry = array(
+ $entry = [
'name' => basename($mountPoint),
'path' => $path,
'type' => 'dir',
@@ -83,7 +83,7 @@ class ApiController extends OCSController {
'permissions' => $permissions,
'id' => $mountConfig['id'],
'class' => $mountConfig['class']
- );
+ ];
return $entry;
}
diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php
index c8fc4b00ef8..a3c9fbb284c 100644
--- a/apps/files_external/lib/Controller/GlobalStoragesController.php
+++ b/apps/files_external/lib/Controller/GlobalStoragesController.php
@@ -171,7 +171,7 @@ class GlobalStoragesController extends StoragesController {
} catch (NotFoundException $e) {
return new DataResponse(
[
- 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
+ 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
],
Http::STATUS_NOT_FOUND
);
diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php
index 8e0dac5a898..a3a258c599a 100644
--- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php
+++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php
@@ -124,7 +124,7 @@ class UserGlobalStoragesController extends StoragesController {
} catch (NotFoundException $e) {
return new DataResponse(
[
- 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
+ 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
],
Http::STATUS_NOT_FOUND
);
@@ -164,7 +164,7 @@ class UserGlobalStoragesController extends StoragesController {
} else {
return new DataResponse(
[
- 'message' => (string)$this->l10n->t('Storage with ID "%d" is not user editable', array($id))
+ 'message' => (string)$this->l10n->t('Storage with ID "%d" is not user editable', [$id])
],
Http::STATUS_FORBIDDEN
);
@@ -172,7 +172,7 @@ class UserGlobalStoragesController extends StoragesController {
} catch (NotFoundException $e) {
return new DataResponse(
[
- 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
+ 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
],
Http::STATUS_NOT_FOUND
);
diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php
index 46285c4758a..df42198aeb3 100644
--- a/apps/files_external/lib/Controller/UserStoragesController.php
+++ b/apps/files_external/lib/Controller/UserStoragesController.php
@@ -199,7 +199,7 @@ class UserStoragesController extends StoragesController {
} catch (NotFoundException $e) {
return new DataResponse(
[
- 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
+ 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
],
Http::STATUS_NOT_FOUND
);
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;
}
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index f799fd25f57..a65b3b3a9c2 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -96,7 +96,7 @@ class OC_Mount_Config {
* @deprecated 8.2.0 use UserGlobalStoragesService::getStorages() and UserStoragesService::getStorages()
*/
public static function getAbsoluteMountPoints($uid) {
- $mountPoints = array();
+ $mountPoints = [];
$userGlobalStoragesService = self::$app->getContainer()->query(UserGlobalStoragesService::class);
$userStoragesService = self::$app->getContainer()->query(UserStoragesService::class);
@@ -296,7 +296,7 @@ class OC_Mount_Config {
return $mountPoints;
}
}
- return array();
+ return [];
}
/**
@@ -430,14 +430,14 @@ class OC_Mount_Config {
*/
public static function makeConfigHash($config) {
$data = json_encode(
- array(
+ [
'c' => $config['backend'],
'a' => $config['authMechanism'],
'm' => $config['mountpoint'],
'o' => $config['options'],
'p' => isset($config['priority']) ? $config['priority'] : -1,
'mo' => isset($config['mountOptions']) ? $config['mountOptions'] : [],
- )
+ ]
);
return hash('md5', $data);
}