summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 09:30:18 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 16:34:56 +0100
commitb80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch)
treeec20e0ffa2f86b9b54939a83a785407319f94559 /lib/private
parent62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff)
downloadnextcloud-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 'lib/private')
-rw-r--r--lib/private/Activity/Manager.php4
-rw-r--r--lib/private/AllConfig.php30
-rw-r--r--lib/private/App/AppManager.php2
-rw-r--r--lib/private/App/DependencyAnalyzer.php8
-rw-r--r--lib/private/App/PlatformRepository.php4
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php2
-rw-r--r--lib/private/AppFramework/Http.php4
-rw-r--r--lib/private/Archive/TAR.php20
-rw-r--r--lib/private/Archive/ZIP.php4
-rw-r--r--lib/private/Avatar/Avatar.php8
-rw-r--r--lib/private/BackgroundJob/Legacy/QueuedJob.php4
-rw-r--r--lib/private/Cache/File.php6
-rw-r--r--lib/private/CapabilitiesManager.php2
-rw-r--r--lib/private/Config.php4
-rw-r--r--lib/private/ContactsManager.php18
-rw-r--r--lib/private/DB/Connection.php8
-rw-r--r--lib/private/DB/ConnectionFactory.php4
-rw-r--r--lib/private/DB/MDB2SchemaReader.php6
-rw-r--r--lib/private/DB/Migrator.php6
-rw-r--r--lib/private/DB/OracleConnection.php10
-rw-r--r--lib/private/DB/PgSqlTools.php4
-rw-r--r--lib/private/DB/QueryBuilder/CompositeExpression.php2
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php2
-rw-r--r--lib/private/DB/SQLiteMigrator.php4
-rw-r--r--lib/private/DB/SQLiteSessionInit.php2
-rw-r--r--lib/private/DateTimeFormatter.php4
-rw-r--r--lib/private/Encryption/DecryptAll.php2
-rw-r--r--lib/private/Encryption/File.php6
-rw-r--r--lib/private/Encryption/Manager.php4
-rw-r--r--lib/private/Encryption/Update.php4
-rw-r--r--lib/private/Encryption/Util.php8
-rw-r--r--lib/private/Files/Cache/HomeCache.php4
-rw-r--r--lib/private/Files/Cache/Scanner.php32
-rw-r--r--lib/private/Files/Cache/Storage.php6
-rw-r--r--lib/private/Files/Cache/Updater.php2
-rw-r--r--lib/private/Files/Cache/Watcher.php2
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php6
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheWrapper.php8
-rw-r--r--lib/private/Files/Config/MountProviderCollection.php4
-rw-r--r--lib/private/Files/Filesystem.php16
-rw-r--r--lib/private/Files/Mount/MountPoint.php6
-rw-r--r--lib/private/Files/Node/File.php10
-rw-r--r--lib/private/Files/Node/Folder.php14
-rw-r--r--lib/private/Files/Node/LazyRoot.php4
-rw-r--r--lib/private/Files/Node/Node.php4
-rw-r--r--lib/private/Files/Node/Root.php4
-rw-r--r--lib/private/Files/ObjectStore/NoopScanner.php4
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php6
-rw-r--r--lib/private/Files/ObjectStore/S3ConnectionTrait.php2
-rw-r--r--lib/private/Files/Storage/Common.php4
-rw-r--r--lib/private/Files/Storage/DAV.php6
-rw-r--r--lib/private/Files/Storage/Local.php4
-rw-r--r--lib/private/Files/Storage/Temporary.php2
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php6
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php2
-rw-r--r--lib/private/Files/Stream/Encryption.php12
-rw-r--r--lib/private/Files/Stream/Quota.php8
-rw-r--r--lib/private/Files/Type/Detection.php2
-rw-r--r--lib/private/Files/Type/TemplateManager.php2
-rw-r--r--lib/private/Files/Utils/Scanner.php8
-rw-r--r--lib/private/Files/View.php88
-rw-r--r--lib/private/Group/Backend.php6
-rw-r--r--lib/private/Group/Group.php24
-rw-r--r--lib/private/Group/Manager.php2
-rw-r--r--lib/private/Group/MetaData.php16
-rw-r--r--lib/private/Hooks/EmitterTrait.php10
-rw-r--r--lib/private/Hooks/ForwardingEmitter.php2
-rw-r--r--lib/private/Hooks/LegacyEmitter.php2
-rw-r--r--lib/private/Hooks/PublicEmitter.php2
-rw-r--r--lib/private/L10N/Factory.php18
-rwxr-xr-xlib/private/LargeFileHelper.php2
-rw-r--r--lib/private/Log/ErrorHandler.php16
-rw-r--r--lib/private/Log/File.php2
-rw-r--r--lib/private/Memcache/ArrayCache.php2
-rw-r--r--lib/private/Memcache/Memcached.php2
-rw-r--r--lib/private/NaturalSort.php4
-rw-r--r--lib/private/NavigationManager.php2
-rw-r--r--lib/private/OCS/Result.php6
-rw-r--r--lib/private/Repair.php4
-rw-r--r--lib/private/Repair/CleanTags.php2
-rw-r--r--lib/private/Repair/Collation.php2
-rw-r--r--lib/private/Repair/RepairMimeTypes.php18
-rw-r--r--lib/private/Route/CachingRouter.php2
-rw-r--r--lib/private/Route/Route.php2
-rw-r--r--lib/private/Search.php20
-rw-r--r--lib/private/Search/Provider/File.php2
-rw-r--r--lib/private/Security/CertificateManager.php8
-rw-r--r--lib/private/Server.php36
-rw-r--r--lib/private/Setup.php10
-rw-r--r--lib/private/Setup/AbstractDatabase.php14
-rw-r--r--lib/private/Setup/OCI.php10
-rw-r--r--lib/private/Setup/Sqlite.php2
-rw-r--r--lib/private/Share/Constants.php4
-rw-r--r--lib/private/Share/Helper.php24
-rw-r--r--lib/private/Share/SearchResultSorter.php2
-rw-r--r--lib/private/Share/Share.php84
-rw-r--r--lib/private/Share20/DefaultShareProvider.php2
-rw-r--r--lib/private/Share20/Manager.php6
-rw-r--r--lib/private/SubAdmin.php2
-rw-r--r--lib/private/TagManager.php2
-rw-r--r--lib/private/Tagging/TagMapper.php6
-rw-r--r--lib/private/Tags.php62
-rw-r--r--lib/private/Template/Base.php4
-rw-r--r--lib/private/Template/CSSResourceLocator.php2
-rw-r--r--lib/private/Template/JSCombiner.php2
-rw-r--r--lib/private/Template/JSConfigHelper.php2
-rwxr-xr-xlib/private/Template/ResourceLocator.php4
-rw-r--r--lib/private/TemplateLayout.php12
-rw-r--r--lib/private/URLGenerator.php6
-rw-r--r--lib/private/Updater.php18
-rw-r--r--lib/private/User/Backend.php8
-rw-r--r--lib/private/User/Manager.php14
-rw-r--r--lib/private/User/Session.php8
-rw-r--r--lib/private/User/User.php10
-rw-r--r--lib/private/legacy/api.php12
-rw-r--r--lib/private/legacy/app.php6
-rw-r--r--lib/private/legacy/db.php2
-rw-r--r--lib/private/legacy/db/statementwrapper.php4
-rw-r--r--lib/private/legacy/files.php18
-rw-r--r--lib/private/legacy/helper.php10
-rw-r--r--lib/private/legacy/hook.php18
-rw-r--r--lib/private/legacy/image.php94
-rw-r--r--lib/private/legacy/json.php14
-rw-r--r--lib/private/legacy/template.php16
-rw-r--r--lib/private/legacy/template/functions.php10
-rw-r--r--lib/private/legacy/user.php10
-rw-r--r--lib/private/legacy/util.php88
127 files changed, 655 insertions, 655 deletions
diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php
index 8a3c5b81427..6d9b6b3cd2f 100644
--- a/lib/private/Activity/Manager.php
+++ b/lib/private/Activity/Manager.php
@@ -76,10 +76,10 @@ class Manager implements IManager {
}
/** @var \Closure[] */
- private $consumersClosures = array();
+ private $consumersClosures = [];
/** @var IConsumer[] */
- private $consumers = array();
+ private $consumers = [];
/**
* @return \OCP\Activity\IConsumer[]
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 2eca9d55b28..0111fad246f 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -297,7 +297,7 @@ class AllConfig implements \OCP\IConfig {
// only add to the cache if we already loaded data for the user
if (isset($this->userCache[$userId])) {
if (!isset($this->userCache[$userId][$appName])) {
- $this->userCache[$userId][$appName] = array();
+ $this->userCache[$userId][$appName] = [];
}
$this->userCache[$userId][$appName][$key] = (string)$value;
}
@@ -333,7 +333,7 @@ class AllConfig implements \OCP\IConfig {
if (isset($data[$appName])) {
return array_keys($data[$appName]);
} else {
- return array();
+ return [];
}
}
@@ -350,7 +350,7 @@ class AllConfig implements \OCP\IConfig {
$sql = 'DELETE FROM `*PREFIX*preferences` '.
'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?';
- $this->connection->executeUpdate($sql, array($userId, $appName, $key));
+ $this->connection->executeUpdate($sql, [$userId, $appName, $key]);
if (isset($this->userCache[$userId]) and isset($this->userCache[$userId][$appName])) {
unset($this->userCache[$userId][$appName][$key]);
@@ -368,7 +368,7 @@ class AllConfig implements \OCP\IConfig {
$sql = 'DELETE FROM `*PREFIX*preferences` '.
'WHERE `userid` = ?';
- $this->connection->executeUpdate($sql, array($userId));
+ $this->connection->executeUpdate($sql, [$userId]);
unset($this->userCache[$userId]);
}
@@ -384,7 +384,7 @@ class AllConfig implements \OCP\IConfig {
$sql = 'DELETE FROM `*PREFIX*preferences` '.
'WHERE `appid` = ?';
- $this->connection->executeUpdate($sql, array($appName));
+ $this->connection->executeUpdate($sql, [$appName]);
foreach ($this->userCache as &$userCache) {
unset($userCache[$appName]);
@@ -405,20 +405,20 @@ class AllConfig implements \OCP\IConfig {
return $this->userCache[$userId];
}
if ($userId === null || $userId === '') {
- $this->userCache[$userId]=array();
+ $this->userCache[$userId]=[];
return $this->userCache[$userId];
}
// TODO - FIXME
$this->fixDIInit();
- $data = array();
+ $data = [];
$query = 'SELECT `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?';
- $result = $this->connection->executeQuery($query, array($userId));
+ $result = $this->connection->executeQuery($query, [$userId]);
while ($row = $result->fetch()) {
$appId = $row['appid'];
if (!isset($data[$appId])) {
- $data[$appId] = array();
+ $data[$appId] = [];
}
$data[$appId][$row['configkey']] = $row['configvalue'];
}
@@ -439,13 +439,13 @@ class AllConfig implements \OCP\IConfig {
$this->fixDIInit();
if (empty($userIds) || !is_array($userIds)) {
- return array();
+ return [];
}
$chunkedUsers = array_chunk($userIds, 50, true);
$placeholders50 = implode(',', array_fill(0, 50, '?'));
- $userValues = array();
+ $userValues = [];
foreach ($chunkedUsers as $chunk) {
$queryParams = $chunk;
// create [$app, $key, $chunkedUsers]
@@ -490,9 +490,9 @@ class AllConfig implements \OCP\IConfig {
$sql .= 'AND `configvalue` = ?';
}
- $result = $this->connection->executeQuery($sql, array($appName, $key, $value));
+ $result = $this->connection->executeQuery($sql, [$appName, $key, $value]);
- $userIDs = array();
+ $userIDs = [];
while ($row = $result->fetch()) {
$userIDs[] = $row['userid'];
}
@@ -522,9 +522,9 @@ class AllConfig implements \OCP\IConfig {
$sql .= 'AND LOWER(`configvalue`) = LOWER(?)';
}
- $result = $this->connection->executeQuery($sql, array($appName, $key, $value));
+ $result = $this->connection->executeQuery($sql, [$appName, $key, $value]);
- $userIDs = array();
+ $userIDs = [];
while ($row = $result->fetch()) {
$userIDs[] = $row['userid'];
}
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 937cc511985..1fcf4e8281f 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -540,7 +540,7 @@ class AppManager implements IAppManager {
*/
public function getIncompatibleApps(string $version): array {
$apps = $this->getInstalledApps();
- $incompatibleApps = array();
+ $incompatibleApps = [];
foreach ($apps as $appId) {
$info = $this->getAppInfo($appId);
if ($info === null) {
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php
index a59e8c21735..81ae6e7a168 100644
--- a/lib/private/App/DependencyAnalyzer.php
+++ b/lib/private/App/DependencyAnalyzer.php
@@ -188,7 +188,7 @@ class DependencyAnalyzer {
return $missing;
}
if (!is_array($supportedDatabases)) {
- $supportedDatabases = array($supportedDatabases);
+ $supportedDatabases = [$supportedDatabases];
}
$supportedDatabases = array_map(function ($db) {
return $this->getValue($db);
@@ -212,7 +212,7 @@ class DependencyAnalyzer {
$commands = $dependencies['command'];
if (!is_array($commands)) {
- $commands = array($commands);
+ $commands = [$commands];
}
if (isset($commands['@value'])) {
$commands = [$commands];
@@ -242,7 +242,7 @@ class DependencyAnalyzer {
$libs = $dependencies['lib'];
if (!is_array($libs)) {
- $libs = array($libs);
+ $libs = [$libs];
}
if (isset($libs['@value'])) {
$libs = [$libs];
@@ -294,7 +294,7 @@ class DependencyAnalyzer {
return $this->getValue($os);
}, $oss);
} else {
- $oss = array($oss);
+ $oss = [$oss];
}
$currentOS = $this->platform->getOS();
if (!in_array($currentOS, $oss)) {
diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php
index c285554ae1c..61def8ff434 100644
--- a/lib/private/App/PlatformRepository.php
+++ b/lib/private/App/PlatformRepository.php
@@ -38,11 +38,11 @@ class PlatformRepository {
protected function initialize() {
$loadedExtensions = get_loaded_extensions();
- $packages = array();
+ $packages = [];
// Extensions scanning
foreach ($loadedExtensions as $name) {
- if (in_array($name, array('standard', 'Core'))) {
+ if (in_array($name, ['standard', 'Core'])) {
continue;
}
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index 1dbccf7590b..6f4a48d8907 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -83,7 +83,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @param array $urlParams
* @param ServerContainer|null $server
*/
- public function __construct($appName, $urlParams = array(), ServerContainer $server = null){
+ public function __construct($appName, $urlParams = [], ServerContainer $server = null){
parent::__construct();
$this['AppName'] = $appName;
$this['urlParams'] = $urlParams;
diff --git a/lib/private/AppFramework/Http.php b/lib/private/AppFramework/Http.php
index 383dffb63d3..05eae742641 100644
--- a/lib/private/AppFramework/Http.php
+++ b/lib/private/AppFramework/Http.php
@@ -45,7 +45,7 @@ class Http extends BaseHttp {
$this->server = $server;
$this->protocolVersion = $protocolVersion;
- $this->headers = array(
+ $this->headers = [
self::STATUS_CONTINUE => 'Continue',
self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols',
self::STATUS_PROCESSING => 'Processing',
@@ -105,7 +105,7 @@ class Http extends BaseHttp {
self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard
self::STATUS_NOT_EXTENDED => 'Not extended',
self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status
- );
+ ];
}
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index 20bab49adf8..08c9d23863e 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -52,7 +52,7 @@ class TAR extends Archive {
* @param string $source
*/
public function __construct($source) {
- $types = array(null, 'gz', 'bz2');
+ $types = [null, 'gz', 'bz2'];
$this->path = $source;
$this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]);
}
@@ -103,7 +103,7 @@ class TAR extends Archive {
mkdir($folder);
}
}
- $result = $this->tar->addModify(array($tmpBase . $path), '', $tmpBase);
+ $result = $this->tar->addModify([$tmpBase . $path], '', $tmpBase);
rmdir($tmpBase . $path);
$this->fileList = false;
$this->cachedHeaders = false;
@@ -144,9 +144,9 @@ class TAR extends Archive {
rename($tmp . $source, $tmp . $dest);
$this->tar = null;
unlink($this->path);
- $types = array(null, 'gz', 'bz');
+ $types = [null, 'gz', 'bz'];
$this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]);
- $this->tar->createModify(array($tmp), '', $tmp . '/');
+ $this->tar->createModify([$tmp], '', $tmp . '/');
$this->fileList = false;
$this->cachedHeaders = false;
return true;
@@ -201,7 +201,7 @@ class TAR extends Archive {
*/
public function getFolder($path) {
$files = $this->getFiles();
- $folderContent = array();
+ $folderContent = [];
$pathLength = strlen($path);
foreach ($files as $file) {
if ($file[0] == '/') {
@@ -232,7 +232,7 @@ class TAR extends Archive {
if (!$this->cachedHeaders) {
$this->cachedHeaders = $this->tar->listContent();
}
- $files = array();
+ $files = [];
foreach ($this->cachedHeaders as $header) {
$files[] = $header['filename'];
}
@@ -263,9 +263,9 @@ class TAR extends Archive {
return false;
}
if ($this->fileExists('/' . $path)) {
- $success = $this->tar->extractList(array('/' . $path), $tmp);
+ $success = $this->tar->extractList(['/' . $path], $tmp);
} else {
- $success = $this->tar->extractList(array($path), $tmp);
+ $success = $this->tar->extractList([$path], $tmp);
}
if ($success) {
rename($tmp . $path, $dest);
@@ -329,7 +329,7 @@ class TAR extends Archive {
$this->tar = null;
unlink($this->path);
$this->reopen();
- $this->tar->createModify(array($tmp), '', $tmp);
+ $this->tar->createModify([$tmp], '', $tmp);
return true;
}
@@ -378,7 +378,7 @@ class TAR extends Archive {
$this->tar->_close();
$this->tar = null;
}
- $types = array(null, 'gz', 'bz');
+ $types = [null, 'gz', 'bz'];
$this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]);
}
}
diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php
index 2c3df550f71..cb04b572c03 100644
--- a/lib/private/Archive/ZIP.php
+++ b/lib/private/Archive/ZIP.php
@@ -113,7 +113,7 @@ class ZIP extends Archive{
*/
public function getFolder($path) {
$files=$this->getFiles();
- $folderContent=array();
+ $folderContent=[];
$pathLength=strlen($path);
foreach($files as $file) {
if(substr($file, 0, $pathLength)==$path and $file!=$path) {
@@ -130,7 +130,7 @@ class ZIP extends Archive{
*/
public function getFiles() {
$fileCount=$this->zip->numFiles;
- $files=array();
+ $files=[];
for($i=0;$i<$fileCount;$i++) {
$files[]=$this->zip->getNameIndex($i);
}
diff --git a/lib/private/Avatar/Avatar.php b/lib/private/Avatar/Avatar.php
index 8f8e5e449cc..86df8aada73 100644
--- a/lib/private/Avatar/Avatar.php
+++ b/lib/private/Avatar/Avatar.php
@@ -232,7 +232,7 @@ abstract class Avatar implements IAvatar {
$x = intval(($xi - $xr) / 2);
$y = intval(($yi + $yr) / 2);
- return array($x, $y);
+ return [$x, $y];
}
/**
@@ -242,7 +242,7 @@ abstract class Avatar implements IAvatar {
* @return array [r,g,b] steps for each color to go from $steps to $ends
*/
private function stepCalc($steps, $ends) {
- $step = array();
+ $step = [];
$step[0] = ($ends[1]->r - $ends[0]->r) / $steps;
$step[1] = ($ends[1]->g - $ends[0]->g) / $steps;
$step[2] = ($ends[1]->b - $ends[0]->b) / $steps;
@@ -256,7 +256,7 @@ abstract class Avatar implements IAvatar {
* @return int[] between 0 and $maximum
*/
private function mixPalette($steps, $color1, $color2) {
- $palette = array($color1);
+ $palette = [$color1];
$step = $this->stepCalc($steps, [$color1, $color2]);
for ($i = 1; $i < $steps; $i++) {
$r = intval($color1->r + ($step[0] * $i));
@@ -275,7 +275,7 @@ abstract class Avatar implements IAvatar {
*/
private function hashToInt($hash, $maximum) {
$final = 0;
- $result = array();
+ $result = [];
// Splitting evenly the string
for ($i = 0; $i < strlen($hash); $i++) {
diff --git a/lib/private/BackgroundJob/Legacy/QueuedJob.php b/lib/private/BackgroundJob/Legacy/QueuedJob.php
index ba81041c9de..64c9972ae01 100644
--- a/lib/private/BackgroundJob/Legacy/QueuedJob.php
+++ b/lib/private/BackgroundJob/Legacy/QueuedJob.php
@@ -28,8 +28,8 @@ class QueuedJob extends \OC\BackgroundJob\QueuedJob {
$class = $argument['klass'];
$method = $argument['method'];
$parameters = $argument['parameters'];
- if (is_callable(array($class, $method))) {
- call_user_func(array($class, $method), $parameters);
+ if (is_callable([$class, $method])) {
+ call_user_func([$class, $method], $parameters);
}
}
}
diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php
index 09ddb78d4f3..6e4c790a1f3 100644
--- a/lib/private/Cache/File.php
+++ b/lib/private/Cache/File.php
@@ -193,11 +193,11 @@ class File implements ICache {
}
} catch (\OCP\Lock\LockedException $e) {
// ignore locked chunks
- \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
+ \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', ['app' => 'core']);
} catch (\OCP\Files\ForbiddenException $e) {
- \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "' . $file . '"', array('app' => 'core'));
+ \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "' . $file . '"', ['app' => 'core']);
} catch (\OCP\Files\LockNotAcquiredException $e) {
- \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
+ \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', ['app' => 'core']);
}
}
}
diff --git a/lib/private/CapabilitiesManager.php b/lib/private/CapabilitiesManager.php
index 96337627be2..55e0b0c8967 100644
--- a/lib/private/CapabilitiesManager.php
+++ b/lib/private/CapabilitiesManager.php
@@ -36,7 +36,7 @@ use OCP\ILogger;
class CapabilitiesManager {
/** @var \Closure[] */
- private $capabilities = array();
+ private $capabilities = [];
/** @var ILogger */
private $logger;
diff --git a/lib/private/Config.php b/lib/private/Config.php
index a21c27f1b51..5366cd295d4 100644
--- a/lib/private/Config.php
+++ b/lib/private/Config.php
@@ -45,7 +45,7 @@ class Config {
const ENV_PREFIX = 'NC_';
/** @var array Associative array ($key => $value) */
- protected $cache = array();
+ protected $cache = [];
/** @var string */
protected $configDir;
/** @var string */
@@ -186,7 +186,7 @@ class Config {
*/
private function readData() {
// Default config should always get loaded
- $configFiles = array($this->configFilePath);
+ $configFiles = [$this->configFilePath];
// Add all files in the config dir ending with the same file name
$extra = glob($this->configDir.'*.'.$this->configFileName);
diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php
index ba709baefe5..ca4a7d885cd 100644
--- a/lib/private/ContactsManager.php
+++ b/lib/private/ContactsManager.php
@@ -41,12 +41,12 @@ namespace OC {
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
* @return array an array of contacts which are arrays of key-value-pairs
*/
- public function search($pattern, $searchProperties = array(), $options = array()) {
+ public function search($pattern, $searchProperties = [], $options = []) {
$this->loadAddressBooks();
- $result = array();
+ $result = [];
foreach($this->addressBooks as $addressBook) {
$r = $addressBook->search($pattern, $searchProperties, $options);
- $contacts = array();
+ $contacts = [];
foreach($r as $c){
$c['addressbook-key'] = $addressBook->getKey();
$contacts[] = $c;
@@ -131,7 +131,7 @@ namespace OC {
*/
public function getAddressBooks() {
$this->loadAddressBooks();
- $result = array();
+ $result = [];
foreach($this->addressBooks as $addressBook) {
$result[$addressBook->getKey()] = $addressBook->getDisplayName();
}
@@ -154,19 +154,19 @@ namespace OC {
* removes all registered address book instances
*/
public function clear() {
- $this->addressBooks = array();
- $this->addressBookLoaders = array();
+ $this->addressBooks = [];
+ $this->addressBookLoaders = [];
}
/**
* @var \OCP\IAddressBook[] which holds all registered address books
*/
- private $addressBooks = array();
+ private $addressBooks = [];
/**
* @var \Closure[] to call to load/register address books
*/
- private $addressBookLoaders = array();
+ private $addressBookLoaders = [];
/**
* In order to improve lazy loading a closure can be registered which will be called in case
@@ -203,7 +203,7 @@ namespace OC {
foreach($this->addressBookLoaders as $callable) {
$callable($this);
}
- $this->addressBookLoaders = array();
+ $this->addressBookLoaders = [];
}
}
}
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 8150f08593f..03cd7f1af66 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -190,7 +190,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
*
* @throws \Doctrine\DBAL\DBALException
*/
- public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
+ public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null)
{
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
@@ -211,7 +211,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
*
* @throws \Doctrine\DBAL\DBALException
*/
- public function executeUpdate($query, array $params = array(), array $types = array())
+ public function executeUpdate($query, array $params = [], array $types = [])
{
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
@@ -373,7 +373,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
public function dropTable($table) {
$table = $this->tablePrefix . trim($table);
$schema = $this->getSchemaManager();
- if($schema->tablesExist(array($table))) {
+ if($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
}
@@ -387,7 +387,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
public function tableExists($table){
$table = $this->tablePrefix . trim($table);
$schema = $this->getSchemaManager();
- return $schema->tablesExist(array($table));
+ return $schema->tablesExist([$table]);
}
// internal use
diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php
index 427a292b6b5..3722aa9a05e 100644
--- a/lib/private/DB/ConnectionFactory.php
+++ b/lib/private/DB/ConnectionFactory.php
@@ -106,9 +106,9 @@ class ConnectionFactory {
// \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL
// driver is missing. In this case, we won't be able to connect anyway.
if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) {
- $result['driverOptions'] = array(
+ $result['driverOptions'] = [
\PDO::MYSQL_ATTR_FOUND_ROWS => true,
- );
+ ];
}
return $result;
}
diff --git a/lib/private/DB/MDB2SchemaReader.php b/lib/private/DB/MDB2SchemaReader.php
index b18929cbd19..874537298ee 100644
--- a/lib/private/DB/MDB2SchemaReader.php
+++ b/lib/private/DB/MDB2SchemaReader.php
@@ -155,7 +155,7 @@ class MDB2SchemaReader {
* @throws \DomainException
*/
private function loadField($table, $xml) {
- $options = array( 'notnull' => false );
+ $options = [ 'notnull' => false ];
foreach ($xml->children() as $child) {
/**
* @var \SimpleXMLElement $child
@@ -262,7 +262,7 @@ class MDB2SchemaReader {
$table->addColumn($name, $type, $options);
if (!empty($options['primary']) && $options['primary']) {
- $table->setPrimaryKey(array($name));
+ $table->setPrimaryKey([$name]);
}
}
}
@@ -274,7 +274,7 @@ class MDB2SchemaReader {
*/
private function loadIndex($table, $xml) {
$name = null;
- $fields = array();
+ $fields = [];
foreach ($xml->children() as $child) {
/**
* @var \SimpleXMLElement $child
diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php
index 8b1621a5f55..bda0720b3bb 100644
--- a/lib/private/DB/Migrator.php
+++ b/lib/private/DB/Migrator.php
@@ -155,7 +155,7 @@ class Migrator {
$tmpTable = $this->renameTableSchema($table, $tmpName);
$schemaConfig = new SchemaConfig();
$schemaConfig->setName($this->connection->getDatabase());
- $schema = new Schema(array($tmpTable), array(), $schemaConfig);
+ $schema = new Schema([$tmpTable], [], $schemaConfig);
try {
$this->applySchema($schema);
@@ -180,7 +180,7 @@ class Migrator {
* @var \Doctrine\DBAL\Schema\Index[] $indexes
*/
$indexes = $table->getIndexes();
- $newIndexes = array();
+ $newIndexes = [];
foreach ($indexes as $index) {
if ($index->isPrimary()) {
// do not rename primary key
@@ -193,7 +193,7 @@ class Migrator {
}
// foreign keys are not supported so we just set it to an empty array
- return new Table($newName, $table->getColumns(), $newIndexes, array(), 0, $table->getOptions());
+ return new Table($newName, $table->getColumns(), $newIndexes, [], 0, $table->getOptions());
}
public function createSchema() {
diff --git a/lib/private/DB/OracleConnection.php b/lib/private/DB/OracleConnection.php
index 236d462b02c..4c906a0107d 100644
--- a/lib/private/DB/OracleConnection.php
+++ b/lib/private/DB/OracleConnection.php
@@ -46,7 +46,7 @@ class OracleConnection extends Connection {
/**
* {@inheritDoc}
*/
- public function insert($tableName, array $data, array $types = array()) {
+ public function insert($tableName, array $data, array $types = []) {
if ($tableName[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
$tableName = $this->quoteIdentifier($tableName);
}
@@ -57,7 +57,7 @@ class OracleConnection extends Connection {
/**
* {@inheritDoc}
*/
- public function update($tableName, array $data, array $identifier, array $types = array()) {
+ public function update($tableName, array $data, array $identifier, array $types = []) {
if ($tableName[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
$tableName = $this->quoteIdentifier($tableName);
}
@@ -69,7 +69,7 @@ class OracleConnection extends Connection {
/**
* {@inheritDoc}
*/
- public function delete($tableExpression, array $identifier, array $types = array()) {
+ public function delete($tableExpression, array $identifier, array $types = []) {
if ($tableExpression[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
$tableExpression = $this->quoteIdentifier($tableExpression);
}
@@ -86,7 +86,7 @@ class OracleConnection extends Connection {
$table = $this->tablePrefix . trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
- if($schema->tablesExist(array($table))) {
+ if($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
}
@@ -101,6 +101,6 @@ class OracleConnection extends Connection {
$table = $this->tablePrefix . trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
- return $schema->tablesExist(array($table));
+ return $schema->tablesExist([$table]);
}
}
diff --git a/lib/private/DB/PgSqlTools.php b/lib/private/DB/PgSqlTools.php
index d98116292a4..72e1dfe1b27 100644
--- a/lib/private/DB/PgSqlTools.php
+++ b/lib/private/DB/PgSqlTools.php
@@ -57,10 +57,10 @@ class PgSqlTools {
$sqlInfo = 'SELECT table_schema, table_name, column_name
FROM information_schema.columns
WHERE column_default = ? AND table_catalog = ?';
- $sequenceInfo = $conn->fetchAssoc($sqlInfo, array(
+ $sequenceInfo = $conn->fetchAssoc($sqlInfo, [
"nextval('$sequenceName'::regclass)",
$databaseName
- ));
+ ]);
$tableName = $sequenceInfo['table_name'];
$columnName = $sequenceInfo['column_name'];
$sqlMaxId = "SELECT MAX($columnName) FROM $tableName";
diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php
index ba5ee173352..1e96910af4a 100644
--- a/lib/private/DB/QueryBuilder/CompositeExpression.php
+++ b/lib/private/DB/QueryBuilder/CompositeExpression.php
@@ -44,7 +44,7 @@ class CompositeExpression implements ICompositeExpression, \Countable {
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
- public function addMultiple(array $parts = array()) {
+ public function addMultiple(array $parts = []) {
$this->compositeExpression->addMultiple($parts);
return $this;
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index c9fc3eb5f21..9871e9284f8 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -273,7 +273,7 @@ class QueryBuilder implements IQueryBuilder {
*
* @return $this This QueryBuilder instance.
*/
- public function setParameters(array $params, array $types = array()) {
+ public function setParameters(array $params, array $types = []) {
$this->queryBuilder->setParameters($params, $types);
return $this;
diff --git a/lib/private/DB/SQLiteMigrator.php b/lib/private/DB/SQLiteMigrator.php
index bd9504a3fed..244bbd6f628 100644
--- a/lib/private/DB/SQLiteMigrator.php
+++ b/lib/private/DB/SQLiteMigrator.php
@@ -43,10 +43,10 @@ class SQLiteMigrator extends Migrator {
$tmpFile = $this->buildTempDatabase();
copy($dbFile, $tmpFile);
- $connectionParams = array(
+ $connectionParams = [
'path' => $tmpFile,
'driver' => 'pdo_sqlite',
- );
+ ];
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams);
try {
$this->applySchema($targetSchema, $conn);
diff --git a/lib/private/DB/SQLiteSessionInit.php b/lib/private/DB/SQLiteSessionInit.php
index a34bd509091..ed4d75cb278 100644
--- a/lib/private/DB/SQLiteSessionInit.php
+++ b/lib/private/DB/SQLiteSessionInit.php
@@ -65,6 +65,6 @@ class SQLiteSessionInit implements EventSubscriber {
}
public function getSubscribedEvents() {
- return array(Events::postConnect);
+ return [Events::postConnect];
}
}
diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php
index 4ff3e1e5eaf..b2b628090bf 100644
--- a/lib/private/DateTimeFormatter.php
+++ b/lib/private/DateTimeFormatter.php
@@ -311,8 +311,8 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
$timeZone = $this->getTimeZone($timeZone);
$timestamp = $this->getDateTime($timestamp, $timeZone);
- return $l->l($type, $timestamp, array(
+ return $l->l($type, $timestamp, [
'width' => $format,
- ));
+ ]);
}
}
diff --git a/lib/private/Encryption/DecryptAll.php b/lib/private/Encryption/DecryptAll.php
index f7351ec1bed..63eb40dd098 100644
--- a/lib/private/Encryption/DecryptAll.php
+++ b/lib/private/Encryption/DecryptAll.php
@@ -208,7 +208,7 @@ class DecryptAll {
protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
$this->setupUserFS($uid);
- $directories = array();
+ $directories = [];
$directories[] = '/' . $uid . '/files';
while ($root = array_pop($directories)) {
diff --git a/lib/private/Encryption/File.php b/lib/private/Encryption/File.php
index 1c71ec7dd95..0fc9dcc6866 100644
--- a/lib/private/Encryption/File.php
+++ b/lib/private/Encryption/File.php
@@ -71,10 +71,10 @@ class File implements \OCP\Encryption\IFile {
list($owner, $ownerPath) = $this->util->getUidAndFilename($path);
// always add owner to the list of users with access to the file
- $userIds = array($owner);
+ $userIds = [$owner];
if (!$this->util->isFile($owner . '/' . $ownerPath)) {
- return array('users' => $userIds, 'public' => false);
+ return ['users' => $userIds, 'public' => false];
}
$ownerPath = substr($ownerPath, strlen('/files'));
@@ -121,7 +121,7 @@ class File implements \OCP\Encryption\IFile {
// Remove duplicate UIDs
$uniqueUserIds = array_unique($userIds);
- return array('users' => $uniqueUserIds, 'public' => $public);
+ return ['users' => $uniqueUserIds, 'public' => $public];
}
}
diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php
index 183db55c7ea..c75210564d6 100644
--- a/lib/private/Encryption/Manager.php
+++ b/lib/private/Encryption/Manager.php
@@ -68,7 +68,7 @@ class Manager implements IManager {
* @param ArrayCache $arrayCache
*/
public function __construct(IConfig $config, ILogger $logger, IL10N $l10n, View $rootView, Util $util, ArrayCache $arrayCache) {
- $this->encryptionModules = array();
+ $this->encryptionModules = [];
$this->config = $config;
$this->logger = $logger;
$this->l = $l10n;
@@ -248,7 +248,7 @@ class Manager implements IManager {
// If encryption is disabled and there are no loaded modules it makes no sense to load the wrapper
if (!empty($this->encryptionModules) || $this->isEnabled()) {
$encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger);
- Filesystem::addStorageWrapper('oc_encryption', array($encryptionWrapper, 'wrapStorage'), 2);
+ Filesystem::addStorageWrapper('oc_encryption', [$encryptionWrapper, 'wrapStorage'], 2);
}
}
diff --git a/lib/private/Encryption/Update.php b/lib/private/Encryption/Update.php
index 3bb7680989b..4f4d9555fd4 100644
--- a/lib/private/Encryption/Update.php
+++ b/lib/private/Encryption/Update.php
@@ -158,7 +158,7 @@ class Update {
throw new \InvalidArgumentException('No file found for ' . $info->getId());
}
- return array($owner, $path);
+ return [$owner, $path];
}
/**
@@ -181,7 +181,7 @@ class Update {
if ($this->view->is_dir($path)) {
$allFiles = $this->util->getAllFiles($path);
} else {
- $allFiles = array($path);
+ $allFiles = [$path];
}
diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php
index b173d1eae5c..98652e1ecc5 100644
--- a/lib/private/Encryption/Util.php
+++ b/lib/private/Encryption/Util.php
@@ -164,8 +164,8 @@ class Util {
* @return array with list of files relative to the users files folder
*/
public function getAllFiles($dir) {
- $result = array();
- $dirList = array($dir);
+ $result = [];
+ $dirList = [$dir];
while ($dirList) {
$dir = array_pop($dirList);
@@ -239,7 +239,7 @@ class Util {
$ownerPath = implode('/', array_slice($parts, 2));
- return array($uid, Filesystem::normalizePath($ownerPath));
+ return [$uid, Filesystem::normalizePath($ownerPath)];
}
@@ -325,7 +325,7 @@ class Util {
* @return boolean
*/
private function isMountPointApplicableToUser($mount, $uid) {
- $acceptedUids = array('all', $uid);
+ $acceptedUids = ['all', $uid];
// check if mount point is applicable for the user
$intersection = array_intersect($acceptedUids, $mount['applicable']['users']);
if (!empty($intersection)) {
diff --git a/lib/private/Files/Cache/HomeCache.php b/lib/private/Files/Cache/HomeCache.php
index ec3c8df519d..0691c1d1e44 100644
--- a/lib/private/Files/Cache/HomeCache.php
+++ b/lib/private/Files/Cache/HomeCache.php
@@ -54,14 +54,14 @@ class HomeCache extends Cache {
$sql = 'SELECT SUM(`size`) AS f1 ' .
'FROM `*PREFIX*filecache` ' .
'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
- $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
+ $result = \OC_DB::executeAudited($sql, [$id, $this->getNumericStorageId()]);
if ($row = $result->fetchRow()) {
$result->closeCursor();
list($sum) = array_values($row);
$totalSize = 0 + $sum;
$entry['size'] += 0;
if ($entry['size'] !== $totalSize) {
- $this->update($id, array('size' => $totalSize));
+ $this->update($id, ['size' => $totalSize]);
}
}
}
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index 30688a8da3e..b481a9918b9 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -164,8 +164,8 @@ class Scanner extends BasicEmitter implements IScanner {
// pre-emit only if it was a file. By that we avoid counting/treating folders as files
if ($data['mimetype'] !== 'httpd/unix-directory') {
- $this->emit('\OC\Files\Cache\Scanner', 'scanFile', array($file, $this->storageId));
- \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
+ $this->emit('\OC\Files\Cache\Scanner', 'scanFile', [$file, $this->storageId]);
+ \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', ['path' => $file, 'storage' => $this->storageId]);
}
$parent = dirname($file);
@@ -233,8 +233,8 @@ class Scanner extends BasicEmitter implements IScanner {
// post-emit only if it was a file. By that we avoid counting/treating folders as files
if ($data['mimetype'] !== 'httpd/unix-directory') {
- $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
- \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
+ $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', [$file, $this->storageId]);
+ \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', ['path' => $file, 'storage' => $this->storageId]);
}
} else {
@@ -266,8 +266,8 @@ class Scanner extends BasicEmitter implements IScanner {
}
protected function removeFromCache($path) {
- \OC_Hook::emit('Scanner', 'removeFromCache', array('file' => $path));
- $this->emit('\OC\Files\Cache\Scanner', 'removeFromCache', array($path));
+ \OC_Hook::emit('Scanner', 'removeFromCache', ['file' => $path]);
+ $this->emit('\OC\Files\Cache\Scanner', 'removeFromCache', [$path]);
if ($this->cacheActive) {
$this->cache->remove($path);
}
@@ -283,8 +283,8 @@ class Scanner extends BasicEmitter implements IScanner {
if (isset($data['scan_permissions'])) {
$data['permissions'] = $data['scan_permissions'];
}
- \OC_Hook::emit('Scanner', 'addToCache', array('file' => $path, 'data' => $data));
- $this->emit('\OC\Files\Cache\Scanner', 'addToCache', array($path, $this->storageId, $data));
+ \OC_Hook::emit('Scanner', 'addToCache', ['file' => $path, 'data' => $data]);
+ $this->emit('\OC\Files\Cache\Scanner', 'addToCache', [$path, $this->storageId, $data]);
if ($this->cacheActive) {
if ($fileId !== -1) {
$this->cache->update($fileId, $data);
@@ -303,8 +303,8 @@ class Scanner extends BasicEmitter implements IScanner {
* @param int $fileId
*/
protected function updateCache($path, $data, $fileId = -1) {
- \OC_Hook::emit('Scanner', 'addToCache', array('file' => $path, 'data' => $data));
- $this->emit('\OC\Files\Cache\Scanner', 'updateCache', array($path, $this->storageId, $data));
+ \OC_Hook::emit('Scanner', 'addToCache', ['file' => $path, 'data' => $data]);
+ $this->emit('\OC\Files\Cache\Scanner', 'updateCache', [$path, $this->storageId, $data]);
if ($this->cacheActive) {
if ($fileId !== -1) {
$this->cache->update($fileId, $data);
@@ -357,7 +357,7 @@ class Scanner extends BasicEmitter implements IScanner {
* @return array[]
*/
protected function getExistingChildren($folderId) {
- $existingChildren = array();
+ $existingChildren = [];
$children = $this->cache->getFolderContentsById($folderId);
foreach ($children as $child) {
$existingChildren[$child['name']] = $child;
@@ -372,7 +372,7 @@ class Scanner extends BasicEmitter implements IScanner {
* @return string[]
*/
protected function getNewChildren($folder) {
- $children = array();
+ $children = [];
if ($dh = $this->storage->opendir($folder)) {
if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
@@ -399,7 +399,7 @@ class Scanner extends BasicEmitter implements IScanner {
if ($reuse === -1) {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
}
- $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', array($path, $this->storageId));
+ $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', [$path, $this->storageId]);
$size = 0;
if (!is_null($folderId)) {
$folderId = $this->cache->getId($path);
@@ -415,9 +415,9 @@ class Scanner extends BasicEmitter implements IScanner {
}
}
if ($this->cacheActive) {
- $this->cache->update($folderId, array('size' => $size));
+ $this->cache->update($folderId, ['size' => $size]);
}
- $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', array($path, $this->storageId));
+ $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', [$path, $this->storageId]);
return $size;
}
@@ -531,7 +531,7 @@ class Scanner extends BasicEmitter implements IScanner {
private function runBackgroundScanJob(callable $callback, $path) {
try {
$callback();
- \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
+ \OC_Hook::emit('Scanner', 'correctFolderSize', ['path' => $path]);
if ($this->cacheActive && $this->cache instanceof Cache) {
$this->cache->correctFolderSize($path, null, true);
}
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php
index 13af41acfea..439ed30890c 100644
--- a/lib/private/Files/Cache/Storage.php
+++ b/lib/private/Files/Cache/Storage.php
@@ -127,7 +127,7 @@ class Storage {
public static function getStorageId($numericId) {
$sql = 'SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?';
- $result = \OC_DB::executeAudited($sql, array($numericId));
+ $result = \OC_DB::executeAudited($sql, [$numericId]);
if ($row = $result->fetchRow()) {
return $row['id'];
} else {
@@ -194,11 +194,11 @@ class Storage {
$storageId = self::adjustStorageId($storageId);
$numericId = self::getNumericStorageId($storageId);
$sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
- \OC_DB::executeAudited($sql, array($storageId));
+ \OC_DB::executeAudited($sql, [$storageId]);
if (!is_null($numericId)) {
$sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
- \OC_DB::executeAudited($sql, array($numericId));
+ \OC_DB::executeAudited($sql, [$numericId]);
}
}
}
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index 59cff9b3a41..b093b591d4e 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -247,7 +247,7 @@ class Updater implements IUpdater {
if ($parentId != -1) {
$mtime = $this->storage->filemtime($parent);
if ($mtime !== false) {
- $this->cache->update($parentId, array('storage_mtime' => $mtime));
+ $this->cache->update($parentId, ['storage_mtime' => $mtime]);
}
}
}
diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php
index beb49ff2d65..884054c9a02 100644
--- a/lib/private/Files/Cache/Watcher.php
+++ b/lib/private/Files/Cache/Watcher.php
@@ -35,7 +35,7 @@ class Watcher implements IWatcher {
protected $watchPolicy = self::CHECK_ONCE;
- protected $checkedPaths = array();
+ protected $checkedPaths = [];
/**
* @var \OC\Files\Storage\Storage $storage
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index 92601e38d13..e2ed62b4444 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -209,9 +209,9 @@ class CacheJail extends CacheWrapper {
}
private function formatSearchResults($results) {
- $results = array_filter($results, array($this, 'filterCacheEntry'));
+ $results = array_filter($results, [$this, 'filterCacheEntry']);
$results = array_values($results);
- return array_map(array($this, 'formatCacheEntry'), $results);
+ return array_map([$this, 'formatCacheEntry'], $results);
}
/**
@@ -282,7 +282,7 @@ class CacheJail extends CacheWrapper {
*/
public function getAll() {
// not supported
- return array();
+ return [];
}
/**
diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
index 40bac888673..27aa203655b 100644
--- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php
+++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
@@ -96,7 +96,7 @@ class CacheWrapper extends Cache {
*/
public function getFolderContentsById($fileId) {
$results = $this->getCache()->getFolderContentsById($fileId);
- return array_map(array($this, 'formatCacheEntry'), $results);
+ return array_map([$this, 'formatCacheEntry'], $results);
}
/**
@@ -223,7 +223,7 @@ class CacheWrapper extends Cache {
*/
public function search($pattern) {
$results = $this->getCache()->search($pattern);
- return array_map(array($this, 'formatCacheEntry'), $results);
+ return array_map([$this, 'formatCacheEntry'], $results);
}
/**
@@ -234,12 +234,12 @@ class CacheWrapper extends Cache {
*/
public function searchByMime($mimetype) {
$results = $this->getCache()->searchByMime($mimetype);
- return array_map(array($this, 'formatCacheEntry'), $results);
+ return array_map([$this, 'formatCacheEntry'], $results);
}
public function searchQuery(ISearchQuery $query) {
$results = $this->getCache()->searchQuery($query);
- return array_map(array($this, 'formatCacheEntry'), $results);
+ return array_map([$this, 'formatCacheEntry'], $results);
}
/**
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php
index 4ef3f9f8d94..4b723cc764b 100644
--- a/lib/private/Files/Config/MountProviderCollection.php
+++ b/lib/private/Files/Config/MountProviderCollection.php
@@ -46,7 +46,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
/**
* @var \OCP\Files\Config\IMountProvider[]
*/
- private $providers = array();
+ private $providers = [];
/**
* @var \OCP\Files\Storage\IStorageFactory
@@ -86,7 +86,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
});
$mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) {
return array_merge($mounts, $providerMounts);
- }, array());
+ }, []);
return $this->filterMounts($user, $mounts);
}
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index 24d21ad6049..d4e584c39f9 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -83,7 +83,7 @@ class Filesystem {
*/
static private $defaultInstance;
- static private $usersSetup = array();
+ static private $usersSetup = [];
static private $normalizedPathCache = null;
@@ -300,7 +300,7 @@ class Filesystem {
if (!self::$mounts) {
\OC_Util::setupFS();
}
- $result = array();
+ $result = [];
$mounts = self::$mounts->findIn($path);
foreach ($mounts as $mount) {
$result[] = $mount->getMountPoint();
@@ -356,9 +356,9 @@ class Filesystem {
}
$mount = self::$mounts->find($path);
if ($mount) {
- return array($mount->getStorage(), rtrim($mount->getInternalPath($path), '/'));
+ return [$mount->getStorage(), rtrim($mount->getInternalPath($path), '/')];
} else {
- return array(null, null);
+ return [null, null];
}
}
@@ -461,7 +461,7 @@ class Filesystem {
'/' . $user . '/files'
));
}
- \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user));
+ \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user]);
}
/**
@@ -478,7 +478,7 @@ class Filesystem {
$userObject = $userManager->get($user);
if ($userObject) {
$mounts = $provider->getMountsForUser($userObject, Filesystem::getLoader());
- array_walk($mounts, array(self::$mounts, 'addMount'));
+ array_walk($mounts, [self::$mounts, 'addMount']);
}
}
});
@@ -521,7 +521,7 @@ class Filesystem {
*/
public static function clearMounts() {
if (self::$mounts) {
- self::$usersSetup = array();
+ self::$usersSetup = [];
self::$mounts->clear();
}
}
@@ -619,7 +619,7 @@ class Filesystem {
static public function isFileBlacklisted($filename) {
$filename = self::normalizePath($filename);
- $blacklist = \OC::$server->getConfig()->getSystemValue('blacklisted_files', array('.htaccess'));
+ $blacklist = \OC::$server->getConfig()->getSystemValue('blacklisted_files', ['.htaccess']);
$filename = strtolower(basename($filename));
return in_array($filename, $blacklist);
}
diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php
index 2b5fa3f7199..93f9941d383 100644
--- a/lib/private/Files/Mount/MountPoint.php
+++ b/lib/private/Files/Mount/MountPoint.php
@@ -50,7 +50,7 @@ class MountPoint implements IMountPoint {
*
* @var array
*/
- protected $arguments = array();
+ protected $arguments = [];
protected $mountPoint;
/**
@@ -58,7 +58,7 @@ class MountPoint implements IMountPoint {
*
* @var array
*/
- protected $mountOptions = array();
+ protected $mountOptions = [];
/**
* @var \OC\Files\Storage\StorageFactory $loader
@@ -87,7 +87,7 @@ class MountPoint implements IMountPoint {
*/
public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) {
if (is_null($arguments)) {
- $arguments = array();
+ $arguments = [];
}
if (is_null($loader)) {
$this->loader = new StorageFactory();
diff --git a/lib/private/Files/Node/File.php b/lib/private/Files/Node/File.php
index dcfa0b93ed1..fd5e996627d 100644
--- a/lib/private/Files/Node/File.php
+++ b/lib/private/Files/Node/File.php
@@ -67,12 +67,12 @@ class File extends Node implements \OCP\Files\File {
*/
public function putContent($data) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
- $this->sendHooks(array('preWrite'));
+ $this->sendHooks(['preWrite']);
if ($this->view->file_put_contents($this->path, $data) === false) {
throw new GenericFileException('file_put_contents failed');
}
$this->fileInfo = null;
- $this->sendHooks(array('postWrite'));
+ $this->sendHooks(['postWrite']);
} else {
throw new NotPermittedException();
}
@@ -85,8 +85,8 @@ class File extends Node implements \OCP\Files\File {
* @throws LockedException
*/
public function fopen($mode) {
- $preHooks = array();
- $postHooks = array();
+ $preHooks = [];
+ $postHooks = [];
$requiredPermissions = \OCP\Constants::PERMISSION_READ;
switch ($mode) {
case 'r+':
@@ -126,7 +126,7 @@ class File extends Node implements \OCP\Files\File {
*/
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
- $this->sendHooks(array('preDelete'));
+ $this->sendHooks(['preDelete']);
$fileInfo = $this->getFileInfo();
$this->view->unlink($this->path);
$nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo);
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 727b08e9335..f910eb27fdf 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -205,9 +205,9 @@ class Folder extends Node implements \OCP\Files\Folder {
*/
public function search($query) {
if (is_string($query)) {
- return $this->searchCommon('search', array('%' . $query . '%'));
+ return $this->searchCommon('search', ['%' . $query . '%']);
} else {
- return $this->searchCommon('searchQuery', array($query));
+ return $this->searchCommon('searchQuery', [$query]);
}
}
@@ -218,7 +218,7 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return Node[]
*/
public function searchByMime($mimetype) {
- return $this->searchCommon('searchByMime', array($mimetype));
+ return $this->searchCommon('searchByMime', [$mimetype]);
}
/**
@@ -229,7 +229,7 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return Node[]
*/
public function searchByTag($tag, $userId) {
- return $this->searchCommon('searchByTag', array($tag, $userId));
+ return $this->searchCommon('searchByTag', [$tag, $userId]);
}
/**
@@ -243,7 +243,7 @@ class Folder extends Node implements \OCP\Files\Folder {
throw new \InvalidArgumentException('searching by owner is only allows on the users home folder');
}
- $files = array();
+ $files = [];
$rootLength = strlen($this->path);
$mount = $this->root->getMount($this->path);
$storage = $mount->getStorage();
@@ -256,7 +256,7 @@ class Folder extends Node implements \OCP\Files\Folder {
$cache = $storage->getCache('');
- $results = call_user_func_array(array($cache, $method), $args);
+ $results = call_user_func_array([$cache, $method], $args);
foreach ($results as $result) {
if ($internalRootLength === 0 or substr($result['path'], 0, $internalRootLength) === $internalPath) {
$result['internalPath'] = $result['path'];
@@ -394,7 +394,7 @@ class Folder extends Node implements \OCP\Files\Folder {
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
- $this->sendHooks(array('preDelete'));
+ $this->sendHooks(['preDelete']);
$fileInfo = $this->getFileInfo();
$this->view->rmdir($this->path);
$nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
diff --git a/lib/private/Files/Node/LazyRoot.php b/lib/private/Files/Node/LazyRoot.php
index 8076c3b4f6a..654badbd9d0 100644
--- a/lib/private/Files/Node/LazyRoot.php
+++ b/lib/private/Files/Node/LazyRoot.php
@@ -89,14 +89,14 @@ class LazyRoot implements IRootFolder {
/**
* @inheritDoc
*/
- public function emit($scope, $method, $arguments = array()) {
+ public function emit($scope, $method, $arguments = []) {
$this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
- public function mount($storage, $mountPoint, $arguments = array()) {
+ public function mount($storage, $mountPoint, $arguments = []) {
$this->__call(__FUNCTION__, func_get_args());
}
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php
index 896b3050384..a8b5fea6be8 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -139,9 +139,9 @@ class Node implements \OCP\Files\Node {
*/
public function touch($mtime = null) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
- $this->sendHooks(array('preTouch'));
+ $this->sendHooks(['preTouch']);
$this->view->touch($this->path, $mtime);
- $this->sendHooks(array('postTouch'));
+ $this->sendHooks(['postTouch']);
if ($this->fileInfo) {
if (is_null($mtime)) {
$mtime = time();
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 948715aec04..843069ff50d 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -133,7 +133,7 @@ class Root extends Folder implements IRootFolder {
* @param string $method
* @param Node[] $arguments
*/
- public function emit($scope, $method, $arguments = array()) {
+ public function emit($scope, $method, $arguments = []) {
$this->emitter->emit($scope, $method, $arguments);
}
@@ -142,7 +142,7 @@ class Root extends Folder implements IRootFolder {
* @param string $mountPoint
* @param array $arguments
*/
- public function mount($storage, $mountPoint, $arguments = array()) {
+ public function mount($storage, $mountPoint, $arguments = []) {
$mount = new MountPoint($storage, $mountPoint, $arguments);
$this->mountManager->addMount($mount);
}
diff --git a/lib/private/Files/ObjectStore/NoopScanner.php b/lib/private/Files/ObjectStore/NoopScanner.php
index f82eb7b1ddc..c25594ccb3f 100644
--- a/lib/private/Files/ObjectStore/NoopScanner.php
+++ b/lib/private/Files/ObjectStore/NoopScanner.php
@@ -44,7 +44,7 @@ class NoopScanner extends Scanner {
* @return array an array of metadata of the scanned file
*/
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) {
- return array();
+ return [];
}
/**
@@ -56,7 +56,7 @@ class NoopScanner extends Scanner {
* @return array with the meta data of the scanned file or folder
*/
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
- return array();
+ return [];
}
/**
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index e0d437839a0..0f2d1f244a8 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -245,7 +245,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
$path = $this->normalizePath($path);
try {
- $files = array();
+ $files = [];
$folderContents = $this->getCache()->getFolderContents($path);
foreach ($folderContents as $file) {
$files[] = $file['name'];
@@ -375,14 +375,14 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
// work with all object storage implementations
$this->file_put_contents($path, ' ');
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path);
- $stat = array(
+ $stat = [
'etag' => $this->getETag($path),
'mimetype' => $mimeType,
'size' => 0,
'mtime' => $mtime,
'storage_mtime' => $mtime,
'permissions' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE,
- );
+ ];
$this->getCache()->put($path, $stat);
} catch (\Exception $ex) {
$this->logger->logException($ex, [
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php
index f931b6092a6..f4ed8c5b5c0 100644
--- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php
+++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php
@@ -117,7 +117,7 @@ trait S3ConnectionTrait {
if (!$this->connection->isBucketDnsCompatible($this->bucket)) {
throw new \Exception("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket);
}
- $this->connection->createBucket(array('Bucket' => $this->bucket));
+ $this->connection->createBucket(['Bucket' => $this->bucket]);
$this->testTimeout();
} catch (S3Exception $e) {
$logger->logException($e, [
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 8760fae1185..c976174f8cf 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -296,7 +296,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
* @return array
*/
protected function searchInDir($query, $dir = '') {
- $files = array();
+ $files = [];
$dh = $this->opendir($dir);
if (is_resource($dh)) {
while (($item = readdir($dh)) !== false) {
@@ -434,7 +434,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
$path = '/' . $path;
}
- $output = array();
+ $output = [];
foreach (explode('/', $path) as $chunk) {
if ($chunk == '..') {
array_pop($output);
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index 625e5f3f625..970f3f8c156 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -265,7 +265,7 @@ class DAV extends Common {
try {
$response = $this->client->propFind(
$this->encodePath($path),
- array(
+ [
'{DAV:}getlastmodified',
'{DAV:}getcontentlength',
'{DAV:}getcontenttype',
@@ -273,7 +273,7 @@ class DAV extends Common {
'{http://open-collaboration-services.org/ns}share-permissions',
'{DAV:}resourcetype',
'{DAV:}getetag',
- )
+ ]
);
$this->statCache->set($path, $response);
} catch (ClientHttpException $e) {
@@ -591,7 +591,7 @@ class DAV extends Common {
} catch (\Exception $e) {
$this->convertException($e, $path);
}
- return array();
+ return [];
}
/** {@inheritdoc} */
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 13a3ca87097..e186d29c348 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -107,7 +107,7 @@ class Local extends \OC\Files\Storage\Common {
* @var \SplFileInfo $file
*/
$file = $it->current();
- if (in_array($file->getBasename(), array('.', '..'))) {
+ if (in_array($file->getBasename(), ['.', '..'])) {
$it->next();
continue;
} elseif ($file->isDir()) {
@@ -340,7 +340,7 @@ class Local extends \OC\Files\Storage\Common {
* @return array
*/
protected function searchInDir($query, $dir = '') {
- $files = array();
+ $files = [];
$physicalDir = $this->getSourcePath($dir);
foreach (scandir($physicalDir) as $item) {
if (\OC\Files\Filesystem::isIgnoredDir($item))
diff --git a/lib/private/Files/Storage/Temporary.php b/lib/private/Files/Storage/Temporary.php
index bb501cb5565..2e1d1e33bef 100644
--- a/lib/private/Files/Storage/Temporary.php
+++ b/lib/private/Files/Storage/Temporary.php
@@ -30,7 +30,7 @@ namespace OC\Files\Storage;
*/
class Temporary extends Local{
public function __construct($arguments = null) {
- parent::__construct(array('datadir' => \OC::$server->getTempManager()->getTemporaryFolder()));
+ parent::__construct(['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]);
}
public function cleanUp() {
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 68cf6f99ee5..cbe9b874501 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -87,7 +87,7 @@ class Encryption extends Wrapper {
private $mountManager;
/** @var array remember for which path we execute the repair step to avoid recursions */
- private $fixUnencryptedSizeOf = array();
+ private $fixUnencryptedSizeOf = [];
/** @var ArrayCache */
private $arrayCache;
@@ -125,7 +125,7 @@ class Encryption extends Wrapper {
$this->uid = $uid;
$this->fileHelper = $fileHelper;
$this->keyStorage = $keyStorage;
- $this->unencryptedSize = array();
+ $this->unencryptedSize = [];
$this->update = $update;
$this->mountManager = $mountManager;
$this->arrayCache = $arrayCache;
@@ -892,7 +892,7 @@ class Encryption extends Wrapper {
* @return array
*/
protected function parseRawHeader($rawHeader) {
- $result = array();
+ $result = [];
if (substr($rawHeader, 0, strlen(Util::HEADER_START)) === Util::HEADER_START) {
$header = $rawHeader;
$endAt = strpos($header, Util::HEADER_END);
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 7cb24f9b5b6..3030fa8c7ef 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -503,7 +503,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* @return mixed
*/
public function __call($method, $args) {
- return call_user_func_array(array($this->getWrapperStorage(), $method), $args);
+ return call_user_func_array([$this->getWrapperStorage(), $method], $args);
}
/**
diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php
index dc6cd9cea7f..2ae872de337 100644
--- a/lib/private/Files/Stream/Encryption.php
+++ b/lib/private/Files/Stream/Encryption.php
@@ -109,7 +109,7 @@ class Encryption extends Wrapper {
protected $fileUpdated;
public function __construct() {
- $this->expectedContextProperties = array(
+ $this->expectedContextProperties = [
'source',
'storage',
'internalPath',
@@ -124,7 +124,7 @@ class Encryption extends Wrapper {
'encryptionStorage',
'headerSize',
'signed'
- );
+ ];
}
@@ -165,8 +165,8 @@ class Encryption extends Wrapper {
$signed,
$wrapper = Encryption::class) {
- $context = stream_context_create(array(
- 'ocencryption' => array(
+ $context = stream_context_create([
+ 'ocencryption' => [
'source' => $source,
'storage' => $storage,
'internalPath' => $internalPath,
@@ -181,8 +181,8 @@ class Encryption extends Wrapper {
'encryptionStorage' => $encStorage,
'headerSize' => $headerSize,
'signed' => $signed
- )
- ));
+ ]
+ ]);
return self::wrapSource($source, $context, 'ocencryption', $wrapper, $mode);
}
diff --git a/lib/private/Files/Stream/Quota.php b/lib/private/Files/Stream/Quota.php
index 08272ad61cb..f07c0c2b678 100644
--- a/lib/private/Files/Stream/Quota.php
+++ b/lib/private/Files/Stream/Quota.php
@@ -44,12 +44,12 @@ class Quota extends Wrapper {
* @return resource
*/
static public function wrap($stream, $limit) {
- $context = stream_context_create(array(
- 'quota' => array(
+ $context = stream_context_create([
+ 'quota' => [
'source' => $stream,
'limit' => $limit
- )
- ));
+ ]
+ ]);
return Wrapper::wrapSource($stream, $context, 'quota', self::class);
}
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index 1352963fc67..0db564032ac 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -103,7 +103,7 @@ class Detection implements IMimeTypeDetector {
public function registerType(string $extension,
string $mimetype,
?string $secureMimeType = null): void {
- $this->mimetypes[$extension] = array($mimetype, $secureMimeType);
+ $this->mimetypes[$extension] = [$mimetype, $secureMimeType];
$this->secureMimeTypes[$mimetype] = $secureMimeType ?: $mimetype;
}
diff --git a/lib/private/Files/Type/TemplateManager.php b/lib/private/Files/Type/TemplateManager.php
index 4febf9afbf1..d9afe138171 100644
--- a/lib/private/Files/Type/TemplateManager.php
+++ b/lib/private/Files/Type/TemplateManager.php
@@ -29,7 +29,7 @@ namespace OC\Files\Type;
* @deprecated 18.0.0
*/
class TemplateManager {
- protected $templates = array();
+ protected $templates = [];
public function registerTemplate($mimetype, $path) {
$this->templates[$mimetype] = $path;
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index 943078215b5..49f8177834a 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -131,19 +131,19 @@ class Scanner extends PublicEmitter {
protected function attachListener($mount) {
$scanner = $mount->getStorage()->getScanner();
$scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount) {
- $this->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path));
+ $this->emit('\OC\Files\Utils\Scanner', 'scanFile', [$mount->getMountPoint() . $path]);
$this->dispatcher->dispatchTyped(new BeforeFileScannedEvent($mount->getMountPoint() . $path));
});
$scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount) {
- $this->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path));
+ $this->emit('\OC\Files\Utils\Scanner', 'scanFolder', [$mount->getMountPoint() . $path]);
$this->dispatcher->dispatchTyped(new BeforeFolderScannedEvent($mount->getMountPoint() . $path));
});
$scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount) {
- $this->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path));
+ $this->emit('\OC\Files\Utils\Scanner', 'postScanFile', [$mount->getMountPoint() . $path]);
$this->dispatcher->dispatchTyped(new FileScannedEvent($mount->getMountPoint() . $path));
});
$scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount) {
- $this->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path));
+ $this->emit('\OC\Files\Utils\Scanner', 'postScanFolder', [$mount->getMountPoint() . $path]);
$this->dispatcher->dispatchTyped(new FolderScannedEvent($mount->getMountPoint() . $path));
});
}
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 8ea94626a2a..abfde63be5a 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -266,7 +266,7 @@ class View {
* for \OC\Files\Storage\Storage via basicOperation().
*/
public function mkdir($path) {
- return $this->basicOperation('mkdir', $path, array('create', 'write'));
+ return $this->basicOperation('mkdir', $path, ['create', 'write']);
}
/**
@@ -284,7 +284,7 @@ class View {
$this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true);
\OC_Hook::emit(
Filesystem::CLASSNAME, "umount",
- array(Filesystem::signal_param_path => $relPath)
+ [Filesystem::signal_param_path => $relPath]
);
$this->changeLock($relPath, ILockingProvider::LOCK_EXCLUSIVE, true);
$result = $mount->removeMount();
@@ -292,7 +292,7 @@ class View {
if ($result) {
\OC_Hook::emit(
Filesystem::CLASSNAME, "post_umount",
- array(Filesystem::signal_param_path => $relPath)
+ [Filesystem::signal_param_path => $relPath]
);
}
$this->unlockFile($relPath, ILockingProvider::LOCK_SHARED, true);
@@ -345,7 +345,7 @@ class View {
return $this->removeMount($mount, $absolutePath);
}
if ($this->is_dir($path)) {
- $result = $this->basicOperation('rmdir', $path, array('delete'));
+ $result = $this->basicOperation('rmdir', $path, ['delete']);
} else {
$result = false;
}
@@ -363,7 +363,7 @@ class View {
* @return resource
*/
public function opendir($path) {
- return $this->basicOperation('opendir', $path, array('read'));
+ return $this->basicOperation('opendir', $path, ['read']);
}
/**
@@ -559,7 +559,7 @@ class View {
$mtime = strtotime($mtime);
}
- $hooks = array('touch');
+ $hooks = ['touch'];
if (!$this->file_exists($path)) {
$hooks[] = 'create';
@@ -581,7 +581,7 @@ class View {
$mtime = time();
}
//if native touch fails, we emulate it by changing the mtime in the cache
- $this->putFileInfo($path, array('mtime' => floor($mtime)));
+ $this->putFileInfo($path, ['mtime' => floor($mtime)]);
}
return true;
}
@@ -592,7 +592,7 @@ class View {
* @throws LockedException
*/
public function file_get_contents($path) {
- return $this->basicOperation('file_get_contents', $path, array('read'));
+ return $this->basicOperation('file_get_contents', $path, ['read']);
}
/**
@@ -602,20 +602,20 @@ class View {
*/
protected function emit_file_hooks_pre($exists, $path, &$run) {
if (!$exists) {
- \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, array(
+ \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [
Filesystem::signal_param_path => $this->getHookPath($path),
Filesystem::signal_param_run => &$run,
- ));
+ ]);
} else {
- \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_update, array(
+ \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_update, [
Filesystem::signal_param_path => $this->getHookPath($path),
Filesystem::signal_param_run => &$run,
- ));
+ ]);
}
- \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_write, array(
+ \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_write, [
Filesystem::signal_param_path => $this->getHookPath($path),
Filesystem::signal_param_run => &$run,
- ));
+ ]);
}
/**
@@ -624,17 +624,17 @@ class View {
*/
protected function emit_file_hooks_post($exists, $path) {
if (!$exists) {
- \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_create, array(
+ \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_create, [
Filesystem::signal_param_path => $this->getHookPath($path),
- ));
+ ]);
} else {
- \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_update, array(
+ \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_update, [
Filesystem::signal_param_path => $this->getHookPath($path),
- ));
+ ]);
}
- \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_write, array(
+ \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_write, [
Filesystem::signal_param_path => $this->getHookPath($path),
- ));
+ ]);
}
/**
@@ -690,7 +690,7 @@ class View {
return false;
}
} else {
- $hooks = $this->file_exists($path) ? array('update', 'write') : array('create', 'write');
+ $hooks = $this->file_exists($path) ? ['update', 'write'] : ['create', 'write'];
return $this->basicOperation('file_put_contents', $path, $hooks, $data);
}
}
@@ -770,11 +770,11 @@ class View {
} elseif ($this->shouldEmitHooks($path1)) {
\OC_Hook::emit(
Filesystem::CLASSNAME, Filesystem::signal_rename,
- array(
+ [
Filesystem::signal_param_oldpath => $this->getHookPath($path1),
Filesystem::signal_param_newpath => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
- )
+ ]
);
}
if ($run) {
@@ -844,10 +844,10 @@ class View {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_rename,
- array(
+ [
Filesystem::signal_param_oldpath => $this->getHookPath($path1),
Filesystem::signal_param_newpath => $this->getHookPath($path2)
- )
+ ]
);
}
}
@@ -900,11 +900,11 @@ class View {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_copy,
- array(
+ [
Filesystem::signal_param_oldpath => $this->getHookPath($path1),
Filesystem::signal_param_newpath => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
- )
+ ]
);
$this->emit_file_hooks_pre($exists, $path2, $run);
}
@@ -938,10 +938,10 @@ class View {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_copy,
- array(
+ [
Filesystem::signal_param_oldpath => $this->getHookPath($path1),
Filesystem::signal_param_newpath => $this->getHookPath($path2)
- )
+ ]
);
$this->emit_file_hooks_post($exists, $path2);
}
@@ -968,7 +968,7 @@ class View {
*/
public function fopen($path, $mode) {
$mode = str_replace('b', '', $mode); // the binary flag is a windows only feature which we do not support
- $hooks = array();
+ $hooks = [];
switch ($mode) {
case 'r':
$hooks[] = 'read';
@@ -1087,7 +1087,7 @@ class View {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_read,
- array(Filesystem::signal_param_path => $this->getHookPath($path))
+ [Filesystem::signal_param_path => $this->getHookPath($path)]
);
}
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
@@ -1270,18 +1270,18 @@ class View {
\OC_Hook::emit(
Filesystem::CLASSNAME,
$prefix . $hook,
- array(
+ [
Filesystem::signal_param_run => &$run,
Filesystem::signal_param_path => $path
- )
+ ]
);
} elseif (!$post) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
$prefix . $hook,
- array(
+ [
Filesystem::signal_param_path => $path
- )
+ ]
);
}
}
@@ -1297,7 +1297,7 @@ class View {
* @return bool
*/
public function hasUpdated($path, $time) {
- return $this->basicOperation('hasUpdated', $path, array(), $time);
+ return $this->basicOperation('hasUpdated', $path, [], $time);
}
/**
@@ -1591,7 +1591,7 @@ class View {
* @return FileInfo[]
*/
public function search($query) {
- return $this->searchCommon('search', array('%' . $query . '%'));
+ return $this->searchCommon('search', ['%' . $query . '%']);
}
/**
@@ -1601,7 +1601,7 @@ class View {
* @return FileInfo[]
*/
public function searchRaw($query) {
- return $this->searchCommon('search', array($query));
+ return $this->searchCommon('search', [$query]);
}
/**
@@ -1611,7 +1611,7 @@ class View {
* @return FileInfo[]
*/
public function searchByMime($mimetype) {
- return $this->searchCommon('searchByMime', array($mimetype));
+ return $this->searchCommon('searchByMime', [$mimetype]);
}
/**
@@ -1622,7 +1622,7 @@ class View {
* @return FileInfo[]
*/
public function searchByTag($tag, $userId) {
- return $this->searchCommon('searchByTag', array($tag, $userId));
+ return $this->searchCommon('searchByTag', [$tag, $userId]);
}
/**
@@ -1631,7 +1631,7 @@ class View {
* @return FileInfo[]
*/
private function searchCommon($method, $args) {
- $files = array();
+ $files = [];
$rootLength = strlen($this->fakeRoot);
$mount = $this->getMount('');
@@ -1640,7 +1640,7 @@ class View {
if ($storage) {
$cache = $storage->getCache('');
- $results = call_user_func_array(array($cache, $method), $args);
+ $results = call_user_func_array([$cache, $method], $args);
foreach ($results as $result) {
if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') {
$internalPath = $result['path'];
@@ -1659,7 +1659,7 @@ class View {
$cache = $storage->getCache('');
$relativeMountPoint = substr($mountPoint, $rootLength);
- $results = call_user_func_array(array($cache, $method), $args);
+ $results = call_user_func_array([$cache, $method], $args);
if ($results) {
foreach ($results as $result) {
$internalPath = $result['path'];
@@ -1881,7 +1881,7 @@ class View {
// remove the single file
array_pop($parts);
- $result = array('/');
+ $result = ['/'];
$resultPath = '';
foreach ($parts as $part) {
if ($part) {
diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php
index 06cc8ae846f..dca3a0ed042 100644
--- a/lib/private/Group/Backend.php
+++ b/lib/private/Group/Backend.php
@@ -94,7 +94,7 @@ abstract class Backend implements \OCP\GroupInterface {
* if the user exists at all.
*/
public function getUserGroups($uid) {
- return array();
+ return [];
}
/**
@@ -108,7 +108,7 @@ abstract class Backend implements \OCP\GroupInterface {
*/
public function getGroups($search = '', $limit = -1, $offset = 0) {
- return array();
+ return [];
}
/**
@@ -129,6 +129,6 @@ abstract class Backend implements \OCP\GroupInterface {
* @return array an array of user ids
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
- return array();
+ return [];
}
}
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php
index 26e23e3b1b1..b14489fe0d9 100644
--- a/lib/private/Group/Group.php
+++ b/lib/private/Group/Group.php
@@ -51,7 +51,7 @@ class Group implements IGroup {
private $gid;
/** @var \OC\User\User[] */
- private $users = array();
+ private $users = [];
/** @var bool */
private $usersLoaded;
@@ -127,7 +127,7 @@ class Group implements IGroup {
return $this->users;
}
- $userIds = array();
+ $userIds = [];
foreach ($this->backends as $backend) {
$diff = array_diff(
$backend->usersInGroup($this->gid),
@@ -177,7 +177,7 @@ class Group implements IGroup {
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\Group', 'preAddUser', array($this, $user));
+ $this->emitter->emit('\OC\Group', 'preAddUser', [$this, $user]);
}
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) {
@@ -191,7 +191,7 @@ class Group implements IGroup {
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\Group', 'postAddUser', array($this, $user));
+ $this->emitter->emit('\OC\Group', 'postAddUser', [$this, $user]);
}
return;
}
@@ -209,7 +209,7 @@ class Group implements IGroup {
'user' => $user,
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\Group', 'preRemoveUser', array($this, $user));
+ $this->emitter->emit('\OC\Group', 'preRemoveUser', [$this, $user]);
}
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) {
@@ -222,7 +222,7 @@ class Group implements IGroup {
'user' => $user,
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\Group', 'postRemoveUser', array($this, $user));
+ $this->emitter->emit('\OC\Group', 'postRemoveUser', [$this, $user]);
}
if ($this->users) {
foreach ($this->users as $index => $groupUser) {
@@ -244,7 +244,7 @@ class Group implements IGroup {
* @return \OC\User\User[]
*/
public function searchUsers($search, $limit = null, $offset = null) {
- $users = array();
+ $users = [];
foreach ($this->backends as $backend) {
$userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
$users += $this->getVerifiedUsers($userIds);
@@ -305,7 +305,7 @@ class Group implements IGroup {
* @return \OC\User\User[]
*/
public function searchDisplayName($search, $limit = null, $offset = null) {
- $users = array();
+ $users = [];
foreach ($this->backends as $backend) {
$userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
$users = $this->getVerifiedUsers($userIds);
@@ -330,7 +330,7 @@ class Group implements IGroup {
$result = false;
$this->dispatcher->dispatch(IGroup::class . '::preDelete', new GenericEvent($this));
if ($this->emitter) {
- $this->emitter->emit('\OC\Group', 'preDelete', array($this));
+ $this->emitter->emit('\OC\Group', 'preDelete', [$this]);
}
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::DELETE_GROUP)) {
@@ -341,7 +341,7 @@ class Group implements IGroup {
if ($result) {
$this->dispatcher->dispatch(IGroup::class . '::postDelete', new GenericEvent($this));
if ($this->emitter) {
- $this->emitter->emit('\OC\Group', 'postDelete', array($this));
+ $this->emitter->emit('\OC\Group', 'postDelete', [$this]);
}
}
return $result;
@@ -354,9 +354,9 @@ class Group implements IGroup {
*/
private function getVerifiedUsers($userIds) {
if (!is_array($userIds)) {
- return array();
+ return [];
}
- $users = array();
+ $users = [];
foreach ($userIds as $userId) {
$user = $this->userManager->get($userId);
if (!is_null($user)) {
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php
index 0879138619c..f789e0d358f 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -342,7 +342,7 @@ class Manager extends PublicEmitter implements IGroupManager {
*/
public function getUserGroupNames(IUser $user) {
return array_map(function ($group) {
- return array('displayName' => $group->getDisplayName());
+ return ['displayName' => $group->getDisplayName()];
}, $this->getUserGroups($user));
}
diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php
index 2a0198bc451..a48baa15cfe 100644
--- a/lib/private/Group/MetaData.php
+++ b/lib/private/Group/MetaData.php
@@ -43,7 +43,7 @@ class MetaData {
/** @var bool */
protected $isAdmin;
/** @var array */
- protected $metaData = array();
+ protected $metaData = [];
/** @var IGroupManager */
protected $groupManager;
/** @var bool */
@@ -86,12 +86,12 @@ class MetaData {
return $this->metaData[$key];
}
- $adminGroups = array();
- $groups = array();
+ $adminGroups = [];
+ $groups = [];
$sortGroupsIndex = 0;
- $sortGroupsKeys = array();
+ $sortGroupsKeys = [];
$sortAdminGroupsIndex = 0;
- $sortAdminGroupsKeys = array();
+ $sortAdminGroupsKeys = [];
foreach($this->getGroups($groupSearch) as $group) {
$groupMetaData = $this->generateGroupMetaData($group, $userSearch);
@@ -117,7 +117,7 @@ class MetaData {
$this->sort($groups, $sortGroupsKeys);
$this->sort($adminGroups, $sortAdminGroupsKeys);
- $this->metaData[$key] = array($adminGroups, $groups);
+ $this->metaData[$key] = [$adminGroups, $groups];
return $this->metaData[$key];
}
@@ -163,14 +163,14 @@ class MetaData {
* @return array with the keys 'id', 'name', 'usercount' and 'disabled'
*/
private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) {
- return array(
+ return [
'id' => $group->getGID(),
'name' => $group->getDisplayName(),
'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0,
'disabled' => $group->countDisabled(),
'canAdd' => $group->canAddUser(),
'canRemove' => $group->canRemoveUser(),
- );
+ ];
}
/**
diff --git a/lib/private/Hooks/EmitterTrait.php b/lib/private/Hooks/EmitterTrait.php
index a3c7e2df5da..58b8242ec54 100644
--- a/lib/private/Hooks/EmitterTrait.php
+++ b/lib/private/Hooks/EmitterTrait.php
@@ -28,7 +28,7 @@ trait EmitterTrait {
/**
* @var callable[][] $listeners
*/
- protected $listeners = array();
+ protected $listeners = [];
/**
* @param string $scope
@@ -38,7 +38,7 @@ trait EmitterTrait {
public function listen($scope, $method, callable $callback) {
$eventName = $scope . '::' . $method;
if (!isset($this->listeners[$eventName])) {
- $this->listeners[$eventName] = array();
+ $this->listeners[$eventName] = [];
}
if (array_search($callback, $this->listeners[$eventName], true) === false) {
$this->listeners[$eventName][] = $callback;
@@ -51,7 +51,7 @@ trait EmitterTrait {
* @param callable $callback optional
*/
public function removeListener($scope = null, $method = null, callable $callback = null) {
- $names = array();
+ $names = [];
$allNames = array_keys($this->listeners);
if ($scope and $method) {
$name = $scope . '::' . $method;
@@ -83,7 +83,7 @@ trait EmitterTrait {
unset($this->listeners[$name][$index]);
}
} else {
- $this->listeners[$name] = array();
+ $this->listeners[$name] = [];
}
}
}
@@ -93,7 +93,7 @@ trait EmitterTrait {
* @param string $method
* @param array $arguments optional
*/
- protected function emit($scope, $method, array $arguments = array()) {
+ protected function emit($scope, $method, array $arguments = []) {
$eventName = $scope . '::' . $method;
if (isset($this->listeners[$eventName])) {
foreach ($this->listeners[$eventName] as $callback) {
diff --git a/lib/private/Hooks/ForwardingEmitter.php b/lib/private/Hooks/ForwardingEmitter.php
index d7dc6bfe9b5..431c0333c72 100644
--- a/lib/private/Hooks/ForwardingEmitter.php
+++ b/lib/private/Hooks/ForwardingEmitter.php
@@ -34,7 +34,7 @@ abstract class ForwardingEmitter extends BasicEmitter {
/**
* @var \OC\Hooks\Emitter[] array
*/
- private $forwardEmitters = array();
+ private $forwardEmitters = [];
/**
* @param string $scope
diff --git a/lib/private/Hooks/LegacyEmitter.php b/lib/private/Hooks/LegacyEmitter.php
index 9d4051e5899..84f8b7b413e 100644
--- a/lib/private/Hooks/LegacyEmitter.php
+++ b/lib/private/Hooks/LegacyEmitter.php
@@ -32,7 +32,7 @@ abstract class LegacyEmitter extends BasicEmitter {
*
* @suppress PhanAccessMethodProtected
*/
- protected function emit($scope, $method, array $arguments = array()) {
+ protected function emit($scope, $method, array $arguments = []) {
\OC_Hook::emit($scope, $method, $arguments);
parent::emit($scope, $method, $arguments);
}
diff --git a/lib/private/Hooks/PublicEmitter.php b/lib/private/Hooks/PublicEmitter.php
index 88c3d7ff327..dbccc34f2e9 100644
--- a/lib/private/Hooks/PublicEmitter.php
+++ b/lib/private/Hooks/PublicEmitter.php
@@ -36,7 +36,7 @@ class PublicEmitter extends BasicEmitter {
*
* @suppress PhanAccessMethodProtected
*/
- public function emit($scope, $method, array $arguments = array()) {
+ public function emit($scope, $method, array $arguments = []) {
parent::emit($scope, $method, $arguments);
}
}
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index bba55385882..8cb4bfaccad 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -118,7 +118,7 @@ class Factory implements IFactory {
$app = \OC_App::cleanAppId($app);
if ($lang !== null) {
- $lang = str_replace(array('\0', '/', '\\', '..'), '', (string)$lang);
+ $lang = str_replace(['\0', '/', '\\', '..'], '', (string)$lang);
}
$forceLang = $this->config->getSystemValue('force_language', false);
@@ -532,8 +532,8 @@ class Factory implements IFactory {
$plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] );
$body = str_replace(
- array( 'plural', 'n', '$n$plurals', ),
- array( '$plural', '$n', '$nplurals', ),
+ [ 'plural', 'n', '$n$plurals', ],
+ [ '$plural', '$n', '$nplurals', ],
'nplurals='. $nplurals . '; plural=' . $plural
);
@@ -599,20 +599,20 @@ class Factory implements IFactory {
// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
$potentialName = (string) $l->t('__language_name__');
if ($l->getLanguageCode() === $lang && $potentialName[0] !== '_') {//first check if the language name is in the translation file
- $ln = array(
+ $ln = [
'code' => $lang,
'name' => $potentialName
- );
+ ];
} else if ($lang === 'en') {
- $ln = array(
+ $ln = [
'code' => $lang,
'name' => 'English (US)'
- );
+ ];
} else {//fallback to language code
- $ln = array(
+ $ln = [
'code' => $lang,
'name' => $lang
- );
+ ];
}
// put appropriate languages into appropriate arrays, to print them sorted
diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php
index dd75ec9820c..2706e2ec2c5 100755
--- a/lib/private/LargeFileHelper.php
+++ b/lib/private/LargeFileHelper.php
@@ -125,7 +125,7 @@ class LargeFileHelper {
$data = curl_exec($ch);
curl_close($ch);
if ($data !== false) {
- $matches = array();
+ $matches = [];
preg_match('/Content-Length: (\d+)/', $data, $matches);
if (isset($matches[1])) {
return 0 + $matches[1];
diff --git a/lib/private/Log/ErrorHandler.php b/lib/private/Log/ErrorHandler.php
index 7561486a4a9..5d846da17ce 100644
--- a/lib/private/Log/ErrorHandler.php
+++ b/lib/private/Log/ErrorHandler.php
@@ -44,15 +44,15 @@ class ErrorHandler {
$handler = new ErrorHandler();
if ($debug) {
- set_error_handler(array($handler, 'onAll'), E_ALL);
+ set_error_handler([$handler, 'onAll'], E_ALL);
if (\OC::$CLI) {
- set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
+ set_exception_handler(['OC_Template', 'printExceptionErrorPage']);
}
} else {
- set_error_handler(array($handler, 'onError'));
+ set_error_handler([$handler, 'onError']);
}
- register_shutdown_function(array($handler, 'onShutdown'));
- set_exception_handler(array($handler, 'onException'));
+ register_shutdown_function([$handler, 'onShutdown']);
+ set_exception_handler([$handler, 'onException']);
}
public static function setLogger(ILogger $logger) {
@@ -65,7 +65,7 @@ class ErrorHandler {
if($error && self::$logger) {
//ob_end_clean();
$msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line'];
- self::$logger->critical(self::removePassword($msg), array('app' => 'PHP'));
+ self::$logger->critical(self::removePassword($msg), ['app' => 'PHP']);
}
}
@@ -87,14 +87,14 @@ class ErrorHandler {
return;
}
$msg = $message . ' at ' . $file . '#' . $line;
- self::$logger->error(self::removePassword($msg), array('app' => 'PHP'));
+ self::$logger->error(self::removePassword($msg), ['app' => 'PHP']);
}
//Recoverable handler which catch all errors, warnings and notices
public static function onAll($number, $message, $file, $line) {
$msg = $message . ' at ' . $file . '#' . $line;
- self::$logger->debug(self::removePassword($msg), array('app' => 'PHP'));
+ self::$logger->debug(self::removePassword($msg), ['app' => 'PHP']);
}
diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php
index eb7eedac83e..80e0beeba0d 100644
--- a/lib/private/Log/File.php
+++ b/lib/private/Log/File.php
@@ -106,7 +106,7 @@ class File extends LogDetails implements IWriter, IFileBased {
*/
public function getEntries(int $limit=50, int $offset=0):array {
$minLevel = $this->config->getValue("loglevel", ILogger::WARN);
- $entries = array();
+ $entries = [];
$handle = @fopen($this->logFile, 'rb');
if ($handle) {
fseek($handle, 0, SEEK_END);
diff --git a/lib/private/Memcache/ArrayCache.php b/lib/private/Memcache/ArrayCache.php
index bf1304063a4..4bd2263004c 100644
--- a/lib/private/Memcache/ArrayCache.php
+++ b/lib/private/Memcache/ArrayCache.php
@@ -28,7 +28,7 @@ use OCP\IMemcache;
class ArrayCache extends Cache implements IMemcache {
/** @var array Array with the cached data */
- protected $cachedData = array();
+ protected $cachedData = [];
use CADTrait;
diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php
index 700ed05380e..83828c95268 100644
--- a/lib/private/Memcache/Memcached.php
+++ b/lib/private/Memcache/Memcached.php
@@ -140,7 +140,7 @@ class Memcached extends Cache implements IMemcache {
self::$cache->flush();
return true;
}
- $keys = array();
+ $keys = [];
$prefixLength = strlen($prefix);
foreach ($allKeys as $key) {
if (substr($key, 0, $prefixLength) === $prefix) {
diff --git a/lib/private/NaturalSort.php b/lib/private/NaturalSort.php
index 3cc82222353..32ed9abb069 100644
--- a/lib/private/NaturalSort.php
+++ b/lib/private/NaturalSort.php
@@ -32,7 +32,7 @@ use OCP\ILogger;
class NaturalSort {
private static $instance;
private $collator;
- private $cache = array();
+ private $cache = [];
/**
* Instantiate a new \OC\NaturalSort instance.
@@ -58,7 +58,7 @@ class NaturalSort {
if (isset($this->cache[$t])) {
return $this->cache[$t];
}
- $tz = array();
+ $tz = [];
$x = 0;
$y = -1;
$n = null;
diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php
index 47d20073455..1de5b1d6a14 100644
--- a/lib/private/NavigationManager.php
+++ b/lib/private/NavigationManager.php
@@ -115,7 +115,7 @@ class NavigationManager implements INavigationManager {
foreach ($this->closureEntries as $c) {
$this->add($c());
}
- $this->closureEntries = array();
+ $this->closureEntries = [];
$result = $this->entries;
if ($type !== 'all') {
diff --git a/lib/private/OCS/Result.php b/lib/private/OCS/Result.php
index 0be12f3a234..8f42179f1a0 100644
--- a/lib/private/OCS/Result.php
+++ b/lib/private/OCS/Result.php
@@ -59,9 +59,9 @@ class Result {
*/
public function __construct($data = null, $code = 100, $message = null, $headers = []) {
if ($data === null) {
- $this->data = array();
+ $this->data = [];
} elseif (!is_array($data)) {
- $this->data = array($this->data);
+ $this->data = [$this->data];
} else {
$this->data = $data;
}
@@ -99,7 +99,7 @@ class Result {
* @return array
*/
public function getMeta() {
- $meta = array();
+ $meta = [];
$meta['status'] = $this->succeeded() ? 'ok' : 'failure';
$meta['statuscode'] = $this->statusCode;
$meta['message'] = $this->message;
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index e80d6ec7874..e042ca193cf 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -93,7 +93,7 @@ class Repair implements IOutput {
*/
public function run() {
if (count($this->repairSteps) === 0) {
- $this->emit('\OC\Repair', 'info', array('No repair steps available'));
+ $this->emit('\OC\Repair', 'info', ['No repair steps available']);
return;
}
@@ -207,7 +207,7 @@ class Repair implements IOutput {
public function info($string) {
// for now just emit as we did in the past
- $this->emit('\OC\Repair', 'info', array($string));
+ $this->emit('\OC\Repair', 'info', [$string]);
}
/**
diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php
index d579068e163..1c50ee2505a 100644
--- a/lib/private/Repair/CleanTags.php
+++ b/lib/private/Repair/CleanTags.php
@@ -186,7 +186,7 @@ class CleanTags implements IRepairStep {
);
$result = $qb->execute();
- $orphanItems = array();
+ $orphanItems = [];
while ($row = $result->fetch()) {
$orphanItems[] = (int) $row[$deleteId];
}
diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php
index 891fdd99433..8477d5d0bc9 100644
--- a/lib/private/Repair/Collation.php
+++ b/lib/private/Repair/Collation.php
@@ -126,7 +126,7 @@ class Collation implements IRepairStep {
" WHERE TABLE_SCHEMA = ?" .
" AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" .
" AND TABLE_NAME LIKE '*PREFIX*%'",
- array($dbName)
+ [$dbName]
);
$rows = $statement->fetchAll();
$result = [];
diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php
index c3ad7be72da..0ced7848df4 100644
--- a/lib/private/Repair/RepairMimeTypes.php
+++ b/lib/private/Repair/RepairMimeTypes.php
@@ -90,46 +90,46 @@ class RepairMimeTypes implements IRepairStep {
private function updateMimetypes($updatedMimetypes) {
if (empty($this->folderMimeTypeId)) {
- $result = \OC_DB::executeAudited(self::getIdStmt(), array('httpd/unix-directory'));
+ $result = \OC_DB::executeAudited(self::getIdStmt(), ['httpd/unix-directory']);
$this->folderMimeTypeId = (int)$result->fetchOne();
}
$count = 0;
foreach ($updatedMimetypes as $extension => $mimetype) {
- $result = \OC_DB::executeAudited(self::existsStmt(), array($mimetype));
+ $result = \OC_DB::executeAudited(self::existsStmt(), [$mimetype]);
$exists = $result->fetchOne();
if (!$exists) {
// insert mimetype
- \OC_DB::executeAudited(self::insertStmt(), array($mimetype));
+ \OC_DB::executeAudited(self::insertStmt(), [$mimetype]);
}
// get target mimetype id
- $result = \OC_DB::executeAudited(self::getIdStmt(), array($mimetype));
+ $result = \OC_DB::executeAudited(self::getIdStmt(), [$mimetype]);
$mimetypeId = $result->fetchOne();
// change mimetype for files with x extension
- $count += \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.' . $extension));
+ $count += \OC_DB::executeAudited(self::updateByNameStmt(), [$mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.' . $extension]);
}
return $count;
}
private function introduceImageTypes() {
- $updatedMimetypes = array(
+ $updatedMimetypes = [
'jp2' => 'image/jp2',
'webp' => 'image/webp',
- );
+ ];
return $this->updateMimetypes($updatedMimetypes);
}
private function introduceWindowsProgramTypes() {
- $updatedMimetypes = array(
+ $updatedMimetypes = [
'htaccess' => 'text/plain',
'bat' => 'application/x-msdos-program',
'cmd' => 'application/cmd',
- );
+ ];
return $this->updateMimetypes($updatedMimetypes);
}
diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php
index af68129e57d..6c3bb1fb711 100644
--- a/lib/private/Route/CachingRouter.php
+++ b/lib/private/Route/CachingRouter.php
@@ -49,7 +49,7 @@ class CachingRouter extends Router {
* @param bool $absolute
* @return string
*/
- public function generate($name, $parameters = array(), $absolute = false) {
+ public function generate($name, $parameters = [], $absolute = false) {
asort($parameters);
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute;
$cachedKey = $this->cache->get($key);
diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php
index 645c2449908..38107737a72 100644
--- a/lib/private/Route/Route.php
+++ b/lib/private/Route/Route.php
@@ -133,7 +133,7 @@ class Route extends SymfonyRoute implements IRoute {
* to the class with $function
*/
public function action($class, $function = null) {
- $action = array($class, $function);
+ $action = [$class, $function];
if (is_null($function)) {
$action = $class;
}
diff --git a/lib/private/Search.php b/lib/private/Search.php
index db533ff182a..e8f012c5469 100644
--- a/lib/private/Search.php
+++ b/lib/private/Search.php
@@ -35,8 +35,8 @@ use OCP\Search\Provider;
*/
class Search implements ISearch {
- private $providers = array();
- private $registeredProviders = array();
+ private $providers = [];
+ private $registeredProviders = [];
/**
* Search all providers for $query
@@ -46,9 +46,9 @@ class Search implements ISearch {
* @param int $size, 0 = all
* @return array An array of OC\Search\Result's
*/
- public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) {
+ public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) {
$this->initProviders();
- $results = array();
+ $results = [];
foreach($this->providers as $provider) {
/** @var $provider Provider */
if ( ! $provider->providesResultsFor($inApps) ) {
@@ -65,7 +65,7 @@ class Search implements ISearch {
$results = array_merge($results, $providerResults);
}
} else {
- \OC::$server->getLogger()->warning('Ignoring Unknown search provider', array('provider' => $provider));
+ \OC::$server->getLogger()->warning('Ignoring Unknown search provider', ['provider' => $provider]);
}
}
return $results;
@@ -75,8 +75,8 @@ class Search implements ISearch {
* Remove all registered search providers
*/
public function clearProviders() {
- $this->providers = array();
- $this->registeredProviders = array();
+ $this->providers = [];
+ $this->registeredProviders = [];
}
/**
@@ -91,7 +91,7 @@ class Search implements ISearch {
}
);
// force regeneration of providers on next search
- $this->providers = array();
+ $this->providers = [];
}
/**
@@ -99,8 +99,8 @@ class Search implements ISearch {
* @param string $class class name of a OC\Search\Provider
* @param array $options optional
*/
- public function registerProvider($class, array $options = array()) {
- $this->registeredProviders[] = array('class' => $class, 'options' => $options);
+ public function registerProvider($class, array $options = []) {
+ $this->registeredProviders[] = ['class' => $class, 'options' => $options];
}
/**
diff --git a/lib/private/Search/Provider/File.php b/lib/private/Search/Provider/File.php
index 87927b90768..4e9a253675a 100644
--- a/lib/private/Search/Provider/File.php
+++ b/lib/private/Search/Provider/File.php
@@ -40,7 +40,7 @@ class File extends \OCP\Search\Provider {
*/
public function search($query) {
$files = Filesystem::search($query);
- $results = array();
+ $results = [];
// edit results
foreach ($files as $fileData) {
// skip versions
diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php
index 48ff28a3fb4..9c47076787c 100644
--- a/lib/private/Security/CertificateManager.php
+++ b/lib/private/Security/CertificateManager.php
@@ -88,17 +88,17 @@ class CertificateManager implements ICertificateManager {
public function listCertificates() {
if (!$this->config->getSystemValue('installed', false)) {
- return array();
+ return [];
}
$path = $this->getPathToCertificates() . 'uploads/';
if (!$this->view->is_dir($path)) {
- return array();
+ return [];
}
- $result = array();
+ $result = [];
$handle = $this->view->opendir($path);
if (!is_resource($handle)) {
- return array();
+ return [];
}
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 971b144e1d0..27268981c2b 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -391,44 +391,44 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
$groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger());
$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
- \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
+ \OC_Hook::emit('OC_Group', 'pre_createGroup', ['run' => true, 'gid' => $gid]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid));
});
$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) {
- \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $group->getGID()));
+ \OC_Hook::emit('OC_User', 'post_createGroup', ['gid' => $group->getGID()]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new GroupCreatedEvent($group));
});
$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
- \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
+ \OC_Hook::emit('OC_Group', 'pre_deleteGroup', ['run' => true, 'gid' => $group->getGID()]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group));
});
$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
- \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
+ \OC_Hook::emit('OC_User', 'post_deleteGroup', ['gid' => $group->getGID()]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new GroupDeletedEvent($group));
});
$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
- \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
+ \OC_Hook::emit('OC_Group', 'pre_addToGroup', ['run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user));
});
$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
- \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
+ \OC_Hook::emit('OC_Group', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]);
//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
- \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
+ \OC_Hook::emit('OC_User', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -491,7 +491,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->query(IEventDispatcher::class)
);
$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
- \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
+ \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -499,7 +499,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
+ \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -507,7 +507,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
+ \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]);
$legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
/** @var IEventDispatcher $dispatcher */
@@ -516,7 +516,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'postDelete', function ($user) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
+ \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -524,7 +524,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
+ \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -532,14 +532,14 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
+ \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword));
});
$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
- \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
+ \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -547,7 +547,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin));
+ \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -560,14 +560,14 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
+ \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
$dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password));
});
$userSession->listen('\OC\User', 'logout', function ($user) {
- \OC_Hook::emit('OC_User', 'logout', array());
+ \OC_Hook::emit('OC_User', 'logout', []);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
@@ -580,7 +580,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
/** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
+ \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]);
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->query(IEventDispatcher::class);
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index 26299aaa039..4042d502a7e 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -182,7 +182,7 @@ class Setup {
throw new Exception('Supported databases are not properly configured.');
}
- $supportedDatabases = array();
+ $supportedDatabases = [];
foreach ($configuredDatabases as $database) {
if (array_key_exists($database, $availableDatabases)) {
@@ -263,7 +263,7 @@ class Setup {
];
}
- return array(
+ return [
'hasSQLite' => isset($databases['sqlite']),
'hasMySQL' => isset($databases['mysql']),
'hasPostgreSQL' => isset($databases['pgsql']),
@@ -272,7 +272,7 @@ class Setup {
'directory' => $dataDir,
'htaccessWorking' => $htAccessWorking,
'errors' => $errors,
- );
+ ];
}
/**
@@ -282,7 +282,7 @@ class Setup {
public function install($options) {
$l = $this->l10n;
- $error = array();
+ $error = [];
$dbType = $options['dbtype'];
if (empty($options['adminlogin'])) {
@@ -310,7 +310,7 @@ class Setup {
// validate the data directory
if ((!is_dir($dataDir) && !mkdir($dataDir)) || !is_writable($dataDir)) {
- $error[] = $l->t("Can't create or write into the data directory %s", array($dataDir));
+ $error[] = $l->t("Can't create or write into the data directory %s", [$dataDir]);
}
if (!empty($error)) {
diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php
index d52aaa8882d..c3c873f2d8b 100644
--- a/lib/private/Setup/AbstractDatabase.php
+++ b/lib/private/Setup/AbstractDatabase.php
@@ -67,16 +67,16 @@ abstract class AbstractDatabase {
}
public function validate($config) {
- $errors = array();
+ $errors = [];
if(empty($config['dbuser']) && empty($config['dbname'])) {
- $errors[] = $this->trans->t("%s enter the database username and name.", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]);
} else if(empty($config['dbuser'])) {
- $errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]);
} else if(empty($config['dbname'])) {
- $errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]);
}
if(substr_count($config['dbname'], '.') >= 1) {
- $errors[] = $this->trans->t("%s you may not use dots in the database name", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s you may not use dots in the database name", [$this->dbprettyname]);
}
return $errors;
}
@@ -109,13 +109,13 @@ abstract class AbstractDatabase {
* @return \OC\DB\Connection
*/
protected function connect(array $configOverwrite = []) {
- $connectionParams = array(
+ $connectionParams = [
'host' => $this->dbHost,
'user' => $this->dbUser,
'password' => $this->dbPassword,
'tablePrefix' => $this->tablePrefix,
'dbname' => $this->dbName
- );
+ ];
// adding port support through installer
if (!empty($this->dbPort)) {
diff --git a/lib/private/Setup/OCI.php b/lib/private/Setup/OCI.php
index 75d75254a00..f1dcf6c3b5d 100644
--- a/lib/private/Setup/OCI.php
+++ b/lib/private/Setup/OCI.php
@@ -52,13 +52,13 @@ class OCI extends AbstractDatabase {
}
public function validate($config) {
- $errors = array();
+ $errors = [];
if (empty($config['dbuser']) && empty($config['dbname'])) {
- $errors[] = $this->trans->t("%s enter the database username and name.", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]);
} else if (empty($config['dbuser'])) {
- $errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]);
} else if (empty($config['dbname'])) {
- $errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
+ $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]);
}
return $errors;
}
@@ -101,7 +101,7 @@ class OCI extends AbstractDatabase {
} else {
$error = oci_error();
}
- foreach (array('message', 'code') as $key) {
+ foreach (['message', 'code'] as $key) {
if (isset($error[$key])) {
return $error[$key];
}
diff --git a/lib/private/Setup/Sqlite.php b/lib/private/Setup/Sqlite.php
index 0b97b4c0451..9bb482229ef 100644
--- a/lib/private/Setup/Sqlite.php
+++ b/lib/private/Setup/Sqlite.php
@@ -29,7 +29,7 @@ class Sqlite extends AbstractDatabase {
public $dbprettyname = 'Sqlite';
public function validate($config) {
- return array();
+ return [];
}
public function initialize($config) {
diff --git a/lib/private/Share/Constants.php b/lib/private/Share/Constants.php
index 4ad9c71b511..4ec0a306a9a 100644
--- a/lib/private/Share/Constants.php
+++ b/lib/private/Share/Constants.php
@@ -83,7 +83,7 @@ class Constants {
protected static $shareTypeUserAndGroups = -1;
protected static $shareTypeGroupUserUnique = 2;
- protected static $backends = array();
- protected static $backendTypes = array();
+ protected static $backends = [];
+ protected static $backendTypes = [];
protected static $isResharingAllowed;
}
diff --git a/lib/private/Share/Helper.php b/lib/private/Share/Helper.php
index 2dd91613cbd..ef37b3b3427 100644
--- a/lib/private/Share/Helper.php
+++ b/lib/private/Share/Helper.php
@@ -82,15 +82,15 @@ class Helper extends \OC\Share\Constants {
* @param bool $excludeGroupChildren exclude group children elements
*/
public static function delete($parent, $excludeParent = false, $uidOwner = null, $newParent = null, $excludeGroupChildren = false) {
- $ids = array($parent);
- $deletedItems = array();
- $changeParent = array();
- $parents = array($parent);
+ $ids = [$parent];
+ $deletedItems = [];
+ $changeParent = [];
+ $parents = [$parent];
while (!empty($parents)) {
$parents = "'".implode("','", $parents)."'";
// Check the owner on the first search of reshares, useful for
// finding and deleting the reshares by a single user of a group share
- $params = array();
+ $params = [];
if (count($ids) == 1 && isset($uidOwner)) {
// FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach
$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
@@ -110,15 +110,15 @@ class Helper extends \OC\Share\Constants {
$query = \OC_DB::prepare($queryString);
$result = $query->execute($params);
// Reset parents array, only go through loop again if items are found
- $parents = array();
+ $parents = [];
while ($item = $result->fetchRow()) {
- $tmpItem = array(
+ $tmpItem = [
'id' => $item['id'],
'shareWith' => $item['share_with'],
'itemTarget' => $item['item_target'],
'itemType' => $item['item_type'],
'shareType' => (int)$item['share_type'],
- );
+ ];
if (isset($item['file_target'])) {
$tmpItem['fileTarget'] = $item['file_target'];
}
@@ -141,7 +141,7 @@ class Helper extends \OC\Share\Constants {
if (!empty($changeParent)) {
$idList = "'".implode("','", $changeParent)."'";
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `parent` = ? WHERE `id` IN ('.$idList.')');
- $query->execute(array($newParent));
+ $query->execute([$newParent]);
}
if (!empty($ids)) {
@@ -161,7 +161,7 @@ class Helper extends \OC\Share\Constants {
$config = \OC::$server->getConfig();
- $defaultExpireSettings = array('defaultExpireDateSet' => false);
+ $defaultExpireSettings = ['defaultExpireDateSet' => false];
// get default expire settings
$defaultExpireDate = $config->getAppValue('core', 'shareapi_default_expire_date', 'no');
@@ -277,12 +277,12 @@ class Helper extends \OC\Share\Constants {
\OCP\Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
- array('uid' => &$user1)
+ ['uid' => &$user1]
);
\OCP\Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
- array('uid' => &$user2)
+ ['uid' => &$user2]
);
if ($user1 === $user2) {
diff --git a/lib/private/Share/SearchResultSorter.php b/lib/private/Share/SearchResultSorter.php
index 452b7a4849c..e16150b8e6f 100644
--- a/lib/private/Share/SearchResultSorter.php
+++ b/lib/private/Share/SearchResultSorter.php
@@ -56,7 +56,7 @@ class SearchResultSorter {
if(!isset($a[$this->key]) || !isset($b[$this->key])) {
if(!is_null($this->log)) {
$this->log->error('Sharing dialogue: cannot sort due to ' .
- 'missing array key', array('app' => 'core'));
+ 'missing array key', ['app' => 'core']);
}
return 0;
}
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index ed876022bdd..d54dcb2e0e2 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -76,11 +76,11 @@ class Share extends Constants {
public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) {
if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_enabled', 'yes') == 'yes') {
if (!isset(self::$backendTypes[$itemType])) {
- self::$backendTypes[$itemType] = array(
+ self::$backendTypes[$itemType] = [
'class' => $class,
'collectionOf' => $collectionOf,
'supportedFileExtensions' => $supportedFileExtensions
- );
+ ];
return true;
}
\OCP\Util::writeLog('OCP\Share',
@@ -134,7 +134,7 @@ class Share extends Constants {
* @return array Return list of items with file_target, permissions and expiration
*/
public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null, $shareType = null) {
- $shares = array();
+ $shares = [];
$fileDependent = false;
$where = 'WHERE';
@@ -151,7 +151,7 @@ class Share extends Constants {
$select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent);
$where .= ' `' . $column . '` = ? AND `item_type` = ? ';
- $arguments = array($itemSource, $itemType);
+ $arguments = [$itemSource, $itemType];
// for link shares $user === null
if ($user !== null) {
$where .= ' AND `share_with` = ? ';
@@ -205,8 +205,8 @@ class Share extends Constants {
if (!empty($groups)) {
$where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
- $arguments = array($itemSource, $itemType, $groups);
- $types = array(null, null, IQueryBuilder::PARAM_STR_ARRAY);
+ $arguments = [$itemSource, $itemType, $groups];
+ $types = [null, null, IQueryBuilder::PARAM_STR_ARRAY];
if ($owner !== null) {
$where .= ' AND `uid_owner` = ?';
@@ -347,7 +347,7 @@ class Share extends Constants {
$items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith, $owner, $shareType);
- $toDelete = array();
+ $toDelete = [];
$newParent = null;
$currentUser = $owner ? $owner : \OC_User::getUser();
foreach ($items as $item) {
@@ -423,7 +423,7 @@ class Share extends Constants {
}
// Pass all the vars we have for now, they may be useful
- $hookParams = array(
+ $hookParams = [
'id' => $item['id'],
'itemType' => $item['item_type'],
'itemSource' => $item['item_source'],
@@ -431,7 +431,7 @@ class Share extends Constants {
'shareWith' => $shareWith,
'itemParent' => $item['parent'],
'uidOwner' => $item['uid_owner'],
- );
+ ];
if($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
$hookParams['fileSource'] = $item['file_source'];
$hookParams['fileTarget'] = $item['file_target'];
@@ -464,20 +464,20 @@ class Share extends Constants {
self::$backends[$itemType] = new $class;
if (!(self::$backends[$itemType] instanceof \OCP\Share_Backend)) {
$message = 'Sharing backend %s must implement the interface OCP\Share_Backend';
- $message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', array($class));
+ $message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', [$class]);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), ILogger::ERROR);
throw new \Exception($message_t);
}
return self::$backends[$itemType];
} else {
$message = 'Sharing backend %s not found';
- $message_t = $l->t('Sharing backend %s not found', array($class));
+ $message_t = $l->t('Sharing backend %s not found', [$class]);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), ILogger::ERROR);
throw new \Exception($message_t);
}
}
$message = 'Sharing backend for %s not found';
- $message_t = $l->t('Sharing backend for %s not found', array($itemType));
+ $message_t = $l->t('Sharing backend for %s not found', [$itemType]);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), ILogger::ERROR);
throw new \Exception($message_t);
}
@@ -505,7 +505,7 @@ class Share extends Constants {
* @return array
*/
private static function getCollectionItemTypes($itemType) {
- $collectionTypes = array($itemType);
+ $collectionTypes = [$itemType];
foreach (self::$backendTypes as $type => $backend) {
if (in_array($backend['collectionOf'], $collectionTypes)) {
$collectionTypes[] = $type;
@@ -538,7 +538,7 @@ class Share extends Constants {
public static function getSharedItemsOwners($user, $type, $includeCollections = false, $includeOwner = false) {
// First, we find out if $type is part of a collection (and if that collection is part of
// another one and so on).
- $collectionTypes = array();
+ $collectionTypes = [];
if (!$includeCollections || !$collectionTypes = self::getCollectionItemTypes($type)) {
$collectionTypes[] = $type;
}
@@ -547,7 +547,7 @@ class Share extends Constants {
// list of the ones for which a sharing backend has been registered.
// FIXME: Ideally, we wouldn't need to nest getItemsSharedWith in this loop but just call it
// with its $includeCollections parameter set to true. Unfortunately, this fails currently.
- $allMaybeSharedItems = array();
+ $allMaybeSharedItems = [];
foreach ($collectionTypes as $collectionType) {
if (isset(self::$backends[$collectionType])) {
$allMaybeSharedItems[$collectionType] = self::getItemsSharedWithUser(
@@ -558,7 +558,7 @@ class Share extends Constants {
}
}
- $owners = array();
+ $owners = [];
if ($includeOwner) {
$owners[] = $user;
}
@@ -599,7 +599,7 @@ class Share extends Constants {
$uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1,
$includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) {
if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_enabled', 'yes') != 'yes') {
- return array();
+ return [];
}
$backend = self::getBackend($itemType);
$collectionTypes = false;
@@ -617,7 +617,7 @@ class Share extends Constants {
}
$where .= 'INNER JOIN `*PREFIX*storages` ON `numeric_id` = `*PREFIX*filecache`.`storage` ';
$fileDependent = true;
- $queryArgs = array();
+ $queryArgs = [];
} else {
$fileDependent = false;
$root = '';
@@ -625,7 +625,7 @@ class Share extends Constants {
if ($includeCollections && !isset($item) && $collectionTypes) {
// If includeCollections is true, find collections of this item type, e.g. a music album contains songs
if (!in_array($itemType, $collectionTypes)) {
- $itemTypes = array_merge(array($itemType), $collectionTypes);
+ $itemTypes = array_merge([$itemType], $collectionTypes);
} else {
$itemTypes = $collectionTypes;
}
@@ -634,7 +634,7 @@ class Share extends Constants {
$queryArgs = $itemTypes;
} else {
$where = ' WHERE `item_type` = ?';
- $queryArgs = array($itemType);
+ $queryArgs = [$itemType];
}
}
if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
@@ -754,10 +754,10 @@ class Share extends Constants {
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
ILogger::ERROR);
}
- $items = array();
- $targets = array();
- $switchedItems = array();
- $mounts = array();
+ $items = [];
+ $targets = [];
+ $switchedItems = [];
+ $mounts = [];
while ($row = $result->fetchRow()) {
self::transformDBResults($row);
// Filter out duplicate group shares for users with unique targets
@@ -812,7 +812,7 @@ class Share extends Constants {
if (isset($uidOwner) && isset($row['path'])) {
if (isset($row['parent'])) {
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
- $parentResult = $query->execute(array($row['parent']));
+ $parentResult = $query->execute([$row['parent']]);
if ($result === false) {
\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
@@ -887,7 +887,7 @@ class Share extends Constants {
}
if (!empty($items)) {
- $collectionItems = array();
+ $collectionItems = [];
foreach ($items as &$row) {
// Return only the item instead of a 2-dimensional array
if ($limit == 1 && $row[$column] == $item && ($row['item_type'] == $itemType || $itemType == 'file')) {
@@ -905,7 +905,7 @@ class Share extends Constants {
if (isset($item) && $row['item_type'] == $itemType && $row[$column] == $item) {
$collectionItems[] = $row;
} else {
- $collection = array();
+ $collection = [];
$collection['item_type'] = $row['item_type'];
if ($row['item_type'] == 'file' || $row['item_type'] == 'folder') {
$collection['path'] = basename($row['path']);
@@ -938,7 +938,7 @@ class Share extends Constants {
return $childItem;
} else {
// Unset the items array and break out of both loops
- $items = array();
+ $items = [];
$items[] = $childItem;
break 2;
}
@@ -985,7 +985,7 @@ class Share extends Constants {
// FIXME: Thats a dirty hack to improve file sharing performance,
// see github issue #10588 for more details
// Need to find a solution which works for all back-ends
- $collectionItems = array();
+ $collectionItems = [];
$collectionBackend = self::getBackend('folder');
$sharedParents = $collectionBackend->getParents($item, $shareWith, $uidOwner);
foreach ($sharedParents as $parent) {
@@ -997,7 +997,7 @@ class Share extends Constants {
return self::formatResult($collectionItems, $column, $backend, $format, $parameters);
}
- return array();
+ return [];
}
/**
@@ -1011,7 +1011,7 @@ class Share extends Constants {
$fileSharing = $itemType === 'file' || $itemType === 'folder';
- $result = array();
+ $result = [];
foreach ($items as $item) {
$grouped = false;
@@ -1058,7 +1058,7 @@ class Share extends Constants {
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$permissions) {
- $queriesToExecute = array();
+ $queriesToExecute = [];
$suggestedItemTarget = null;
$groupFileTarget = $fileTarget = $suggestedFileTarget = $filePath = '';
$groupItemTarget = $itemTarget = $fileSource = $parent = 0;
@@ -1074,13 +1074,13 @@ class Share extends Constants {
}
$isGroupShare = false;
- $users = array($shareWith);
+ $users = [$shareWith];
$itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$suggestedItemTarget);
$run = true;
$error = '';
- $preHookData = array(
+ $preHookData = [
'itemType' => $itemType,
'itemSource' => $itemSource,
'shareType' => $shareType,
@@ -1091,7 +1091,7 @@ class Share extends Constants {
'token' => null,
'run' => &$run,
'error' => &$error
- );
+ ];
$preHookData['itemTarget'] = $itemTarget;
$preHookData['shareWith'] = $shareWith;
@@ -1144,7 +1144,7 @@ class Share extends Constants {
}
}
- $queriesToExecute[] = array(
+ $queriesToExecute[] = [
'itemType' => $itemType,
'itemSource' => $itemSource,
'itemTarget' => $itemTarget,
@@ -1158,7 +1158,7 @@ class Share extends Constants {
'token' => null,
'parent' => $parent,
'expiration' => null,
- );
+ ];
}
@@ -1169,7 +1169,7 @@ class Share extends Constants {
$id = self::insertShare($shareQuery);
}
- $postHookData = array(
+ $postHookData = [
'itemType' => $itemType,
'itemSource' => $itemSource,
'parent' => $parent,
@@ -1180,7 +1180,7 @@ class Share extends Constants {
'id' => $parent,
'token' => null,
'expirationDate' => null,
- );
+ ];
$postHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith;
$postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
@@ -1208,7 +1208,7 @@ class Share extends Constants {
private static function checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate) {
$backend = self::getBackend($itemType);
- $result = array();
+ $result = [];
$column = ($itemType === 'file' || $itemType === 'folder') ? 'file_source' : 'item_source';
@@ -1419,7 +1419,7 @@ class Share extends Constants {
if ($format === self::FORMAT_NONE) {
return $items;
} else if ($format === self::FORMAT_STATUSES) {
- $statuses = array();
+ $statuses = [];
foreach ($items as $item) {
if ($item['share_type'] === self::SHARE_TYPE_LINK) {
if ($item['uid_initiator'] !== \OC::$server->getUserSession()->getUser()->getUID()) {
@@ -1507,7 +1507,7 @@ class Share extends Constants {
*/
private static function sendRemoteUnshare($remote, $id, $token) {
$url = rtrim($remote, '/');
- $fields = array('token' => $token, 'format' => 'json');
+ $fields = ['token' => $token, 'format' => 'json'];
$url = self::removeProtocolFromUrl($url);
$result = self::tryHttpPostToShareEndpoint($url, '/'.$id.'/unshare', $fields);
$status = json_decode($result['result'], true);
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index e7f077f4022..3c39b58245e 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -839,7 +839,7 @@ class DefaultShareProvider implements IShareProvider {
$pathSections = explode('/', $data['path'], 2);
// FIXME: would not detect rare md5'd home storage case properly
if ($pathSections[0] !== 'files'
- && in_array(explode(':', $data['storage_string_id'], 2)[0], array('home', 'object'))) {
+ && in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) {
return false;
}
return true;
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 9023e14fd2c..4e1f6567e6b 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -858,7 +858,7 @@ class Manager implements IManager {
'shareWith' => $shareWith,
]);
- $emailTemplate->setSubject($l->t('%1$s shared »%2$s« with you', array($initiatorDisplayName, $filename)));
+ $emailTemplate->setSubject($l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]));
$emailTemplate->addHeader();
$emailTemplate->addHeading($l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]), false);
$text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]);
@@ -1022,7 +1022,7 @@ class Manager implements IManager {
} else {
$userFolder = $this->rootFolder->getUserFolder($share->getSharedBy());
}
- \OC_Hook::emit(Share::class, 'post_update_permissions', array(
+ \OC_Hook::emit(Share::class, 'post_update_permissions', [
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'shareType' => $share->getShareType(),
@@ -1030,7 +1030,7 @@ class Manager implements IManager {
'uidOwner' => $share->getSharedBy(),
'permissions' => $share->getPermissions(),
'path' => $userFolder->getRelativePath($share->getNode()->getPath()),
- ));
+ ]);
}
return $share;
diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php
index b3b40e78b9f..0c9d7bdd84a 100644
--- a/lib/private/SubAdmin.php
+++ b/lib/private/SubAdmin.php
@@ -135,7 +135,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
*/
public function getSubAdminsGroupsName(IUser $user): array {
return array_map(function($group) {
- return array('displayName' => $group->getDisplayName());
+ return ['displayName' => $group->getDisplayName()];
}, $this->getSubAdminsGroups($user));
}
diff --git a/lib/private/TagManager.php b/lib/private/TagManager.php
index a12076196c8..900bd13e849 100644
--- a/lib/private/TagManager.php
+++ b/lib/private/TagManager.php
@@ -77,7 +77,7 @@ class TagManager implements \OCP\ITagManager {
* logged in user
* @return \OCP\ITags
*/
- public function load($type, $defaultTags = array(), $includeShared = false, $userId = null) {
+ public function load($type, $defaultTags = [], $includeShared = false, $userId = null) {
if (is_null($userId)) {
$user = $this->userSession->getUser();
if ($user === null) {
diff --git a/lib/private/Tagging/TagMapper.php b/lib/private/Tagging/TagMapper.php
index fb58c33dd07..500a0a353d6 100644
--- a/lib/private/Tagging/TagMapper.php
+++ b/lib/private/Tagging/TagMapper.php
@@ -52,12 +52,12 @@ class TagMapper extends Mapper {
*/
public function loadTags($owners, $type) {
if(!is_array($owners)) {
- $owners = array($owners);
+ $owners = [$owners];
}
$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
. 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
- return $this->findEntities($sql, array_merge($owners, array($type)));
+ return $this->findEntities($sql, array_merge($owners, [$type]));
}
/**
@@ -70,7 +70,7 @@ class TagMapper extends Mapper {
$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
try {
- $this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName()));
+ $this->findEntity($sql, [$tag->getOwner(), $tag->getType(), $tag->getName()]);
} catch (DoesNotExistException $e) {
return false;
}
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index fe24391a1a5..13618ff518c 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -57,14 +57,14 @@ class Tags implements ITags {
*
* @var array
*/
- private $tags = array();
+ private $tags = [];
/**
* Used for storing objectid/categoryname pairs while rescanning.
*
* @var array
*/
- private static $relations = array();
+ private static $relations = [];
/**
* Type
@@ -93,7 +93,7 @@ class Tags implements ITags {
*
* @var array
*/
- private $owners = array();
+ private $owners = [];
/**
* The Mapper we're using to communicate our Tag objects to the database.
@@ -122,12 +122,12 @@ class Tags implements ITags {
* @param array $defaultTags Tags that should be created at construction.
* @param boolean $includeShared Whether to include tags for items shared with this user by others.
*/
- public function __construct(TagMapper $mapper, $user, $type, $defaultTags = array(), $includeShared = false) {
+ public function __construct(TagMapper $mapper, $user, $type, $defaultTags = [], $includeShared = false) {
$this->mapper = $mapper;
$this->user = $user;
$this->type = $type;
$this->includeShared = $includeShared;
- $this->owners = array($this->user);
+ $this->owners = [$this->user];
if ($this->includeShared) {
$this->owners = array_merge($this->owners, \OC\Share\Share::getSharedItemsOwners($this->user, $this->type, true));
$this->backend = \OC\Share\Share::getBackend($this->type);
@@ -176,13 +176,13 @@ class Tags implements ITags {
*/
public function getTags() {
if(!count($this->tags)) {
- return array();
+ return [];
}
usort($this->tags, function($a, $b) {
return strnatcasecmp($a->getName(), $b->getName());
});
- $tagMap = array();
+ $tagMap = [];
foreach($this->tags as $tag) {
if($tag->getName() !== ITags::TAG_FAVORITE) {
@@ -216,7 +216,7 @@ class Tags implements ITags {
* or false if an error occurred
*/
public function getTagsForObjects(array $objIds) {
- $entries = array();
+ $entries = [];
try {
$conn = \OC::$server->getDatabaseConnection();
@@ -226,13 +226,13 @@ class Tags implements ITags {
'SELECT `category`, `categoryid`, `objid` ' .
'FROM `' . self::RELATION_TABLE . '` r, `' . self::TAG_TABLE . '` ' .
'WHERE `categoryid` = `id` AND `uid` = ? AND r.`type` = ? AND `objid` IN (?)',
- array($this->user, $this->type, $chunk),
- array(null, null, IQueryBuilder::PARAM_INT_ARRAY)
+ [$this->user, $this->type, $chunk],
+ [null, null, IQueryBuilder::PARAM_INT_ARRAY]
);
while ($row = $result->fetch()) {
$objId = (int)$row['objid'];
if (!isset($entries[$objId])) {
- $entries[$objId] = array();
+ $entries[$objId] = [];
}
$entries[$objId][] = $row['category'];
}
@@ -283,13 +283,13 @@ class Tags implements ITags {
);
}
- $ids = array();
+ $ids = [];
$sql = 'SELECT `objid` FROM `' . self::RELATION_TABLE
. '` WHERE `categoryid` = ?';
try {
$stmt = \OC_DB::prepare($sql);
- $result = $stmt->execute(array($tagId));
+ $result = $stmt->execute([$tagId]);
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
return false;
@@ -440,19 +440,19 @@ class Tags implements ITags {
*/
public function addMultiple($names, $sync=false, $id = null) {
if(!is_array($names)) {
- $names = array($names);
+ $names = [$names];
}
$names = array_map('trim', $names);
array_filter($names);
- $newones = array();
+ $newones = [];
foreach($names as $name) {
if(!$this->hasTag($name) && $name !== '') {
$newones[] = new Tag($this->user, $this->type, $name);
}
if(!is_null($id) ) {
// Insert $objectid, $categoryid pairs if not exist.
- self::$relations[] = array('objid' => $id, 'tag' => $name);
+ self::$relations[] = ['objid' => $id, 'tag' => $name];
}
}
$this->tags = array_merge($this->tags, $newones);
@@ -498,11 +498,11 @@ class Tags implements ITags {
if($tagId) {
try {
$dbConnection->insertIfNotExist(self::RELATION_TABLE,
- array(
+ [
'objid' => $relation['objid'],
'categoryid' => $tagId,
'type' => $this->type,
- ));
+ ]);
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'message' => __METHOD__,
@@ -512,7 +512,7 @@ class Tags implements ITags {
}
}
}
- self::$relations = array(); // reset
+ self::$relations = []; // reset
} else {
\OCP\Util::writeLog('core', __METHOD__.', $this->tags is not an array! '
. print_r($this->tags, true), ILogger::ERROR);
@@ -532,7 +532,7 @@ class Tags implements ITags {
try {
$stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
. 'WHERE `uid` = ?');
- $result = $stmt->execute(array($arguments['uid']));
+ $result = $stmt->execute([$arguments['uid']]);
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
}
@@ -550,7 +550,7 @@ class Tags implements ITags {
. 'WHERE `categoryid` = ?');
while( $row = $result->fetchRow()) {
try {
- $stmt->execute(array($row['id']));
+ $stmt->execute([$row['id']]);
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'message' => __METHOD__,
@@ -570,7 +570,7 @@ class Tags implements ITags {
try {
$stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
. 'WHERE `uid` = ?');
- $result = $stmt->execute(array($arguments['uid']));
+ $result = $stmt->execute([$arguments['uid']]);
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
}
@@ -635,7 +635,7 @@ class Tags implements ITags {
'level' => ILogger::ERROR,
'app' => 'core',
]);
- return array();
+ return [];
}
}
@@ -685,11 +685,11 @@ class Tags implements ITags {
}
try {
\OC::$server->getDatabaseConnection()->insertIfNotExist(self::RELATION_TABLE,
- array(
+ [
'objid' => $objid,
'categoryid' => $tagId,
'type' => $this->type,
- ));
+ ]);
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'message' => __METHOD__,
@@ -724,7 +724,7 @@ class Tags implements ITags {
$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?';
$stmt = \OC_DB::prepare($sql);
- $stmt->execute(array($objid, $tagId, $this->type));
+ $stmt->execute([$objid, $tagId, $this->type]);
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'message' => __METHOD__,
@@ -744,7 +744,7 @@ class Tags implements ITags {
*/
public function delete($names) {
if(!is_array($names)) {
- $names = array($names);
+ $names = [$names];
}
$names = array_map('trim', $names);
@@ -774,7 +774,7 @@ class Tags implements ITags {
$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `categoryid` = ?';
$stmt = \OC_DB::prepare($sql);
- $result = $stmt->execute(array($id));
+ $result = $stmt->execute([$id]);
if ($result === null) {
\OCP\Util::writeLog('core',
__METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(),
@@ -801,7 +801,7 @@ class Tags implements ITags {
}
return array_search(strtolower($needle), array_map(
function($tag) use($mem) {
- return strtolower(call_user_func(array($tag, $mem)));
+ return strtolower(call_user_func([$tag, $mem]));
}, $haystack)
);
}
@@ -850,11 +850,11 @@ class Tags implements ITags {
* @return array
*/
private function tagMap(Tag $tag) {
- return array(
+ return [
'id' => $tag->getId(),
'name' => $tag->getName(),
'owner' => $tag->getOwner(),
'type' => $tag->getType()
- );
+ ];
}
}
diff --git a/lib/private/Template/Base.php b/lib/private/Template/Base.php
index dab4e9d9086..cbad438cd2c 100644
--- a/lib/private/Template/Base.php
+++ b/lib/private/Template/Base.php
@@ -48,7 +48,7 @@ class Base {
* @param Defaults $theme
*/
public function __construct($template, $requestToken, $l10n, $theme ) {
- $this->vars = array();
+ $this->vars = [];
$this->vars['requesttoken'] = $requestToken;
$this->l10n = $l10n;
$this->template = $template;
@@ -118,7 +118,7 @@ class Base {
$this->vars[$key][] = $value;
}
else{
- $this->vars[$key] = array( $value );
+ $this->vars[$key] = [ $value ];
}
}
diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php
index 94eac48b61f..ab063dbbdca 100644
--- a/lib/private/Template/CSSResourceLocator.php
+++ b/lib/private/Template/CSSResourceLocator.php
@@ -145,7 +145,7 @@ class CSSResourceLocator extends ResourceLocator {
}
}
- $this->resources[] = array($webRoot? : \OC::$WEBROOT, $webRoot, $file);
+ $this->resources[] = [$webRoot? : \OC::$WEBROOT, $webRoot, $file];
}
}
}
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php
index 83fc717c9c5..e96505b6d40 100644
--- a/lib/private/Template/JSCombiner.php
+++ b/lib/private/Template/JSCombiner.php
@@ -216,7 +216,7 @@ class JSCombiner {
$fileName = array_pop($tmpfileLoc);
$fileName = str_replace('.json', '.js', $fileName);
- return substr($this->urlGenerator->linkToRoute('core.Js.getJs', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
+ return substr($this->urlGenerator->linkToRoute('core.Js.getJs', ['fileName' => $fileName, 'appName' => $appName]), strlen(\OC::$WEBROOT) + 1);
}
/**
diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php
index ec11e8456d1..781cb0d7794 100644
--- a/lib/private/Template/JSConfigHelper.php
+++ b/lib/private/Template/JSConfigHelper.php
@@ -298,7 +298,7 @@ class JSConfigHelper {
}
// Allow hooks to modify the output values
- \OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array));
+ \OC_Hook::emit('\OCP\Config', 'js', ['array' => &$array]);
$result = '';
diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php
index 22595df7964..7761e115353 100755
--- a/lib/private/Template/ResourceLocator.php
+++ b/lib/private/Template/ResourceLocator.php
@@ -37,7 +37,7 @@ abstract class ResourceLocator {
protected $thirdpartyroot;
protected $webroot;
- protected $resources = array();
+ protected $resources = [];
/** @var \OCP\ILogger */
protected $logger;
@@ -185,7 +185,7 @@ abstract class ResourceLocator {
]);
}
}
- $this->resources[] = array($root, $webRoot, $file);
+ $this->resources[] = [$root, $webRoot, $file];
if ($throw && !is_file($root . '/' . $file)) {
throw new ResourceNotFoundException($file, $webRoot);
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 8cecc17dbc1..691f90b788e 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -172,7 +172,7 @@ class TemplateLayout extends \OC_Template {
// Add the js files
$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
- $this->assign('jsfiles', array());
+ $this->assign('jsfiles', []);
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
$jsConfigHelper = new JSConfigHelper(
@@ -220,7 +220,7 @@ class TemplateLayout extends \OC_Template {
$cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
}
- $this->assign('cssfiles', array());
+ $this->assign('cssfiles', []);
$this->assign('printcssfiles', []);
$this->assign('versionHash', self::$versionHash);
foreach($cssFiles as $info) {
@@ -303,8 +303,8 @@ class TemplateLayout extends \OC_Template {
$locator = new \OC\Template\CSSResourceLocator(
\OC::$server->getLogger(),
$theme,
- array( \OC::$SERVERROOT => \OC::$WEBROOT ),
- array( \OC::$SERVERROOT => \OC::$WEBROOT ),
+ [ \OC::$SERVERROOT => \OC::$WEBROOT ],
+ [ \OC::$SERVERROOT => \OC::$WEBROOT ],
$SCSSCacher
);
$locator->find($styles);
@@ -339,8 +339,8 @@ class TemplateLayout extends \OC_Template {
$locator = new \OC\Template\JSResourceLocator(
\OC::$server->getLogger(),
$theme,
- array( \OC::$SERVERROOT => \OC::$WEBROOT ),
- array( \OC::$SERVERROOT => \OC::$WEBROOT ),
+ [ \OC::$SERVERROOT => \OC::$WEBROOT ],
+ [ \OC::$SERVERROOT => \OC::$WEBROOT ],
\OC::$server->query(JSCombiner::class)
);
$locator->find($scripts);
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php
index 4f50f779a83..1a12132cf01 100644
--- a/lib/private/URLGenerator.php
+++ b/lib/private/URLGenerator.php
@@ -77,7 +77,7 @@ class URLGenerator implements IURLGenerator {
*
* Returns a url to the given route.
*/
- public function linkToRoute(string $route, array $parameters = array()): string {
+ public function linkToRoute(string $route, array $parameters = []): string {
// TODO: mock router
return \OC::$server->getRouter()->generate($route, $parameters);
}
@@ -90,7 +90,7 @@ class URLGenerator implements IURLGenerator {
*
* Returns an absolute url to the given route.
*/
- public function linkToRouteAbsolute(string $routeName, array $arguments = array()): string {
+ public function linkToRouteAbsolute(string $routeName, array $arguments = []): string {
return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments));
}
@@ -118,7 +118,7 @@ class URLGenerator implements IURLGenerator {
*
* Returns a url to the given app and file.
*/
- public function linkTo(string $app, string $file, array $args = array()): string {
+ public function linkTo(string $app, string $file, array $args = []): string {
$frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true');
if( $app !== '' ) {
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index 611da73254e..91a0943e048 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -124,22 +124,22 @@ class Updater extends BasicEmitter {
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
$currentVersion = implode('.', \OCP\Util::getVersion());
- $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
+ $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, ['app' => 'core']);
$success = true;
try {
$this->doUpgrade($currentVersion, $installedVersion);
} catch (HintException $exception) {
$this->log->logException($exception, ['app' => 'core']);
- $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint()));
+ $this->emit('\OC\Updater', 'failure', [$exception->getMessage() . ': ' .$exception->getHint()]);
$success = false;
} catch (\Exception $exception) {
$this->log->logException($exception, ['app' => 'core']);
- $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
+ $this->emit('\OC\Updater', 'failure', [get_class($exception) . ': ' .$exception->getMessage()]);
$success = false;
}
- $this->emit('\OC\Updater', 'updateEnd', array($success));
+ $this->emit('\OC\Updater', 'updateEnd', [$success]);
if(!$wasMaintenanceModeEnabled && $success) {
$this->config->setSystemValue('maintenance', false);
@@ -324,7 +324,7 @@ class Updater extends BasicEmitter {
$this->includePreUpdate($appId);
}
if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
- $this->emit('\OC\Updater', 'appSimulateUpdate', array($appId));
+ $this->emit('\OC\Updater', 'appSimulateUpdate', [$appId]);
\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
}
}
@@ -349,15 +349,15 @@ class Updater extends BasicEmitter {
*/
protected function doAppUpgrade() {
$apps = \OC_App::getEnabledApps();
- $priorityTypes = array('authentication', 'filesystem', 'logging');
+ $priorityTypes = ['authentication', 'filesystem', 'logging'];
$pseudoOtherType = 'other';
- $stacks = array($pseudoOtherType => array());
+ $stacks = [$pseudoOtherType => []];
foreach ($apps as $appId) {
$priorityType = false;
foreach ($priorityTypes as $type) {
if(!isset($stacks[$type])) {
- $stacks[$type] = array();
+ $stacks[$type] = [];
}
if (\OC_App::isType($appId, [$type])) {
$stacks[$type][] = $appId;
@@ -409,7 +409,7 @@ class Updater extends BasicEmitter {
throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
}
\OC::$server->getAppManager()->disableApp($app, true);
- $this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
+ $this->emit('\OC\Updater', 'incompatibleAppDisabled', [$app]);
}
// no need to disable any app in case this is a non-core upgrade
if (!$isCoreUpgrade) {
diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php
index a4dbcf77484..a616183dced 100644
--- a/lib/private/User/Backend.php
+++ b/lib/private/User/Backend.php
@@ -47,7 +47,7 @@ abstract class Backend implements UserInterface {
const PROVIDE_AVATAR = 16777216; // 1 << 24
const COUNT_USERS = 268435456; // 1 << 28
- protected $possibleActions = array(
+ protected $possibleActions = [
self::CREATE_USER => 'createUser',
self::SET_PASSWORD => 'setPassword',
self::CHECK_PASSWORD => 'checkPassword',
@@ -56,7 +56,7 @@ abstract class Backend implements UserInterface {
self::SET_DISPLAYNAME => 'setDisplayName',
self::PROVIDE_AVATAR => 'canChangeAvatar',
self::COUNT_USERS => 'countUsers',
- );
+ ];
/**
* Get all supported actions
@@ -108,7 +108,7 @@ abstract class Backend implements UserInterface {
* @return string[] an array of all uids
*/
public function getUsers($search = '', $limit = null, $offset = null) {
- return array();
+ return [];
}
/**
@@ -147,7 +147,7 @@ abstract class Backend implements UserInterface {
* @return array an array of all displayNames (value) and the corresponding uids (key)
*/
public function getDisplayNames($search = '', $limit = null, $offset = null) {
- $displayNames = array();
+ $displayNames = [];
$users = $this->getUsers($search, $limit, $offset);
foreach ( $users as $user) {
$displayNames[$user] = $user;
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index 7fc774630bd..2dd12cf916d 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -69,12 +69,12 @@ class Manager extends PublicEmitter implements IUserManager {
/**
* @var \OCP\UserInterface[] $backends
*/
- private $backends = array();
+ private $backends = [];
/**
* @var \OC\User\User[] $cachedUsers
*/
- private $cachedUsers = array();
+ private $cachedUsers = [];
/** @var IConfig */
private $config;
@@ -121,7 +121,7 @@ class Manager extends PublicEmitter implements IUserManager {
* @param \OCP\UserInterface $backend
*/
public function removeBackend($backend) {
- $this->cachedUsers = array();
+ $this->cachedUsers = [];
if (($i = array_search($backend, $this->backends)) !== false) {
unset($this->backends[$i]);
}
@@ -131,8 +131,8 @@ class Manager extends PublicEmitter implements IUserManager {
* remove all user backends
*/
public function clearBackends() {
- $this->cachedUsers = array();
- $this->backends = array();
+ $this->cachedUsers = [];
+ $this->backends = [];
}
/**
@@ -241,7 +241,7 @@ class Manager extends PublicEmitter implements IUserManager {
* @return \OC\User\User[]
*/
public function search($pattern, $limit = null, $offset = null) {
- $users = array();
+ $users = [];
foreach ($this->backends as $backend) {
$backendUsers = $backend->getUsers($pattern, $limit, $offset);
if (is_array($backendUsers)) {
@@ -270,7 +270,7 @@ class Manager extends PublicEmitter implements IUserManager {
* @return \OC\User\User[]
*/
public function searchDisplayName($pattern, $limit = null, $offset = null) {
- $users = array();
+ $users = [];
foreach ($this->backends as $backend) {
$backendUsers = $backend->getDisplayNames($pattern, $limit, $offset);
if (is_array($backendUsers)) {
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index 602f779c901..3d97ddce7f9 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -440,7 +440,7 @@ class Session implements IUserSession, Emitter {
$currentDelay = $throttler->sleepDelay($request->getRemoteAddress(), 'login');
if ($this->manager instanceof PublicEmitter) {
- $this->manager->emit('\OC\User', 'preLogin', array($user, $password));
+ $this->manager->emit('\OC\User', 'preLogin', [$user, $password]);
}
try {
@@ -500,7 +500,7 @@ class Session implements IUserSession, Emitter {
Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
- array('uid' => &$username)
+ ['uid' => &$username]
);
$user = $this->manager->get($username);
if (is_null($user)) {
@@ -640,7 +640,7 @@ class Session implements IUserSession, Emitter {
// Ignore and use empty string instead
}
- $this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
+ $this->manager->emit('\OC\User', 'preLogin', [$uid, $password]);
$user = $this->manager->get($uid);
if (is_null($user)) {
@@ -841,7 +841,7 @@ class Session implements IUserSession, Emitter {
*/
public function loginWithCookie($uid, $currentToken, $oldSessionId) {
$this->session->regenerateId();
- $this->manager->emit('\OC\User', 'preRememberedLogin', array($uid));
+ $this->manager->emit('\OC\User', 'preRememberedLogin', [$uid]);
$user = $this->manager->get($uid);
if (is_null($user)) {
// user does not exist
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index c68b8b88e31..d3ad6dd5799 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -202,7 +202,7 @@ class User implements IUser {
public function delete() {
$this->dispatcher->dispatch(IUser::class . '::preDelete', new GenericEvent($this));
if ($this->emitter) {
- $this->emitter->emit('\OC\User', 'preDelete', array($this));
+ $this->emitter->emit('\OC\User', 'preDelete', [$this]);
}
// get the home now because it won't return it after user deletion
$homePath = $this->getHome();
@@ -247,7 +247,7 @@ class User implements IUser {
$this->dispatcher->dispatch(IUser::class . '::postDelete', new GenericEvent($this));
if ($this->emitter) {
- $this->emitter->emit('\OC\User', 'postDelete', array($this));
+ $this->emitter->emit('\OC\User', 'postDelete', [$this]);
}
}
return !($result === false);
@@ -266,7 +266,7 @@ class User implements IUser {
'recoveryPassword' => $recoveryPassword,
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\User', 'preSetPassword', array($this, $password, $recoveryPassword));
+ $this->emitter->emit('\OC\User', 'preSetPassword', [$this, $password, $recoveryPassword]);
}
if ($this->backend->implementsActions(Backend::SET_PASSWORD)) {
$result = $this->backend->setPassword($this->uid, $password);
@@ -275,7 +275,7 @@ class User implements IUser {
'recoveryPassword' => $recoveryPassword,
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\User', 'postSetPassword', array($this, $password, $recoveryPassword));
+ $this->emitter->emit('\OC\User', 'postSetPassword', [$this, $password, $recoveryPassword]);
}
return !($result === false);
} else {
@@ -473,7 +473,7 @@ class User implements IUser {
'oldValue' => $oldValue,
]));
if ($this->emitter) {
- $this->emitter->emit('\OC\User', 'changeUser', array($this, $feature, $value, $oldValue));
+ $this->emitter->emit('\OC\User', 'changeUser', [$this, $feature, $value, $oldValue]);
}
}
}
diff --git a/lib/private/legacy/api.php b/lib/private/legacy/api.php
index 44028407034..660ca885dd7 100644
--- a/lib/private/legacy/api.php
+++ b/lib/private/legacy/api.php
@@ -36,7 +36,7 @@ class OC_API {
/**
* api actions
*/
- protected static $actions = array();
+ protected static $actions = [];
/**
* respond to a call
@@ -101,7 +101,7 @@ class OC_API {
* @return string
*/
public static function requestedFormat() {
- $formats = array('json', 'xml');
+ $formats = ['json', 'xml'];
$format = !empty($_GET['format']) && in_array($_GET['format'], $formats) ? $_GET['format'] : 'xml';
return $format;
@@ -167,12 +167,12 @@ class OC_API {
* @return string
*/
public static function renderResult($format, $meta, $data) {
- $response = array(
- 'ocs' => array(
+ $response = [
+ 'ocs' => [
'meta' => $meta,
'data' => $data,
- ),
- );
+ ],
+ ];
if ($format == 'json') {
return OC_JSON::encode($response);
}
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 961e51fe736..996b7a885c6 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -81,7 +81,7 @@ class OC_App {
* @return string
*/
public static function cleanAppId(string $app): string {
- return str_replace(array('\0', '/', '\\', '..'), '', $app);
+ return str_replace(['\0', '/', '\\', '..'], '', $app);
}
/**
@@ -473,10 +473,10 @@ class OC_App {
foreach ($possibleApps as $possibleApp) {
$version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId);
if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) {
- $versionToLoad = array(
+ $versionToLoad = [
'dir' => $possibleApp,
'version' => $version,
- );
+ ];
}
}
$app_dir[$appId] = $versionToLoad['dir'];
diff --git a/lib/private/legacy/db.php b/lib/private/legacy/db.php
index 9371e733d28..1cef0d50e04 100644
--- a/lib/private/legacy/db.php
+++ b/lib/private/legacy/db.php
@@ -121,7 +121,7 @@ class OC_DB {
. ' pass an array with \'limit\' and \'offset\' instead';
throw new \OC\DatabaseException($message);
}
- $stmt = array('sql' => $stmt, 'limit' => null, 'offset' => null);
+ $stmt = ['sql' => $stmt, 'limit' => null, 'offset' => null];
}
if (is_array($stmt)) {
// convert to prepared statement
diff --git a/lib/private/legacy/db/statementwrapper.php b/lib/private/legacy/db/statementwrapper.php
index 4512784d955..cdcf3ad951e 100644
--- a/lib/private/legacy/db/statementwrapper.php
+++ b/lib/private/legacy/db/statementwrapper.php
@@ -42,7 +42,7 @@ class OC_DB_StatementWrapper {
*/
private $statement = null;
private $isManipulation = false;
- private $lastArguments = array();
+ private $lastArguments = [];
/**
* @param boolean $isManipulation
@@ -56,7 +56,7 @@ class OC_DB_StatementWrapper {
* pass all other function directly to the \Doctrine\DBAL\Driver\Statement
*/
public function __call($name,$arguments) {
- return call_user_func_array(array($this->statement,$name), $arguments);
+ return call_user_func_array([$this->statement,$name], $arguments);
}
/**
diff --git a/lib/private/legacy/files.php b/lib/private/legacy/files.php
index adc793ba9b7..ebce0338500 100644
--- a/lib/private/legacy/files.php
+++ b/lib/private/legacy/files.php
@@ -123,7 +123,7 @@ class OC_Files {
if (!is_array($files)) {
$filename = $dir . '/' . $files;
if (!$view->is_dir($filename)) {
- self::getSingleFile($view, $dir, $files, is_null($params) ? array() : $params);
+ self::getSingleFile($view, $dir, $files, is_null($params) ? [] : $params);
return;
}
}
@@ -150,7 +150,7 @@ class OC_Files {
/* Calculate filesize and number of files */
if ($getType === self::ZIP_FILES) {
- $fileInfos = array();
+ $fileInfos = [];
$fileSize = 0;
foreach ($files as $file) {
$fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $file);
@@ -161,7 +161,7 @@ class OC_Files {
} elseif ($getType === self::ZIP_DIR) {
$fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $files);
$fileSize = $fileInfo->getSize();
- $numberOfFiles = self::getNumberOfFiles(array($fileInfo));
+ $numberOfFiles = self::getNumberOfFiles([$fileInfo]);
}
$streamer = new Streamer(\OC::$server->getRequest(), $fileSize, $numberOfFiles);
@@ -239,7 +239,7 @@ class OC_Files {
$minOffset = 0;
$ind = 0;
- $rangeArray = array();
+ $rangeArray = [];
foreach ($rArray as $value) {
$ranges = explode('-', $value);
@@ -258,7 +258,7 @@ class OC_Files {
if ($ranges[1] >= $fileSize) {
$ranges[1] = $fileSize-1;
}
- $rangeArray[$ind++] = array( 'from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize );
+ $rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize ];
$minOffset = $ranges[1] + 1;
if ($minOffset >= $fileSize) {
break;
@@ -266,7 +266,7 @@ class OC_Files {
}
elseif (is_numeric($ranges[0]) && $ranges[0] < $fileSize) {
// case: x-
- $rangeArray[$ind++] = array( 'from' => $ranges[0], 'to' => $fileSize-1, 'size' => $fileSize );
+ $rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $fileSize-1, 'size' => $fileSize ];
break;
}
elseif (is_numeric($ranges[1])) {
@@ -274,7 +274,7 @@ class OC_Files {
if ($ranges[1] > $fileSize) {
$ranges[1] = $fileSize;
}
- $rangeArray[$ind++] = array( 'from' => $fileSize-$ranges[1], 'to' => $fileSize-1, 'size' => $fileSize );
+ $rangeArray[$ind++] = [ 'from' => $fileSize-$ranges[1], 'to' => $fileSize-1, 'size' => $fileSize ];
break;
}
}
@@ -315,7 +315,7 @@ class OC_Files {
OC_Util::obEnd();
$view->lockFile($filename, ILockingProvider::LOCK_SHARED);
- $rangeArray = array();
+ $rangeArray = [];
if (isset($params['range']) && substr($params['range'], 0, 6) === 'bytes=') {
$rangeArray = self::parseHttpRangeHeader(substr($params['range'], 6), $fileSize);
@@ -352,7 +352,7 @@ class OC_Files {
header_remove('Accept-Ranges');
header_remove('Content-Range');
http_response_code(200);
- self::sendHeaders($filename, $name, array());
+ self::sendHeaders($filename, $name, []);
$view->readfile($filename);
}
}
diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php
index 3ddb9d07b14..02002d40f1c 100644
--- a/lib/private/legacy/helper.php
+++ b/lib/private/legacy/helper.php
@@ -100,7 +100,7 @@ class OC_Helper {
return (float)$str;
}
- $bytes_array = array(
+ $bytes_array = [
'b' => 1,
'k' => 1024,
'kb' => 1024,
@@ -112,7 +112,7 @@ class OC_Helper {
't' => 1024 * 1024 * 1024 * 1024,
'pb' => 1024 * 1024 * 1024 * 1024 * 1024,
'p' => 1024 * 1024 * 1024 * 1024 * 1024,
- );
+ ];
$bytes = (float)$str;
@@ -245,7 +245,7 @@ class OC_Helper {
*/
public static function streamCopy($source, $target) {
if (!$source or !$target) {
- return array(0, false);
+ return [0, false];
}
$bufSize = 8192;
$result = true;
@@ -266,7 +266,7 @@ class OC_Helper {
break;
}
}
- return array($count, $result);
+ return [$count, $result];
}
/**
@@ -342,7 +342,7 @@ class OC_Helper {
*/
public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
$case = ($case != MB_CASE_UPPER) ? MB_CASE_LOWER : MB_CASE_UPPER;
- $ret = array();
+ $ret = [];
foreach ($input as $k => $v) {
$ret[mb_convert_case($k, $case, $encoding)] = $v;
}
diff --git a/lib/private/legacy/hook.php b/lib/private/legacy/hook.php
index 6353d1f15db..2918dd4282f 100644
--- a/lib/private/legacy/hook.php
+++ b/lib/private/legacy/hook.php
@@ -36,7 +36,7 @@
class OC_Hook {
public static $thrownExceptions = [];
- static private $registered = array();
+ static private $registered = [];
/**
* connects a function to a hook
@@ -55,12 +55,12 @@ class OC_Hook {
// If we're trying to connect to an emitting class that isn't
// yet registered, register it
if( !array_key_exists($signalClass, self::$registered )) {
- self::$registered[$signalClass] = array();
+ self::$registered[$signalClass] = [];
}
// If we're trying to connect to an emitting method that isn't
// yet registered, register it with the emitting class
if( !array_key_exists( $signalName, self::$registered[$signalClass] )) {
- self::$registered[$signalClass][$signalName] = array();
+ self::$registered[$signalClass][$signalName] = [];
}
// don't connect hooks twice
@@ -70,10 +70,10 @@ class OC_Hook {
}
}
// Connect the hook handler to the requested emitter
- self::$registered[$signalClass][$signalName][] = array(
+ self::$registered[$signalClass][$signalName][] = [
"class" => $slotClass,
"name" => $slotName
- );
+ ];
// No chance for failure ;-)
return true;
@@ -108,7 +108,7 @@ class OC_Hook {
// Call all slots
foreach( self::$registered[$signalClass][$signalName] as $i ) {
try {
- call_user_func( array( $i["class"], $i["name"] ), $params );
+ call_user_func( [ $i["class"], $i["name"] ], $params );
} catch (Exception $e){
self::$thrownExceptions[] = $e;
\OC::$server->getLogger()->logException($e);
@@ -132,12 +132,12 @@ class OC_Hook {
static public function clear($signalClass='', $signalName='') {
if ($signalClass) {
if ($signalName) {
- self::$registered[$signalClass][$signalName]=array();
+ self::$registered[$signalClass][$signalName]=[];
}else{
- self::$registered[$signalClass]=array();
+ self::$registered[$signalClass]=[];
}
}else{
- self::$registered=array();
+ self::$registered=[];
}
}
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php
index e0f2dad3599..4e16b0d8ed7 100644
--- a/lib/private/legacy/image.php
+++ b/lib/private/legacy/image.php
@@ -132,7 +132,7 @@ class OC_Image implements \OCP\IImage {
*/
public function widthTopLeft() {
$o = $this->getOrientation();
- $this->logger->debug('OC_Image->widthTopLeft() Orientation: ' . $o, array('app' => 'core'));
+ $this->logger->debug('OC_Image->widthTopLeft() Orientation: ' . $o, ['app' => 'core']);
switch ($o) {
case -1:
case 1:
@@ -156,7 +156,7 @@ class OC_Image implements \OCP\IImage {
*/
public function heightTopLeft() {
$o = $this->getOrientation();
- $this->logger->debug('OC_Image->heightTopLeft() Orientation: ' . $o, array('app' => 'core'));
+ $this->logger->debug('OC_Image->heightTopLeft() Orientation: ' . $o, ['app' => 'core']);
switch ($o) {
case -1:
case 1:
@@ -201,7 +201,7 @@ class OC_Image implements \OCP\IImage {
}
if ($filePath === null) {
if ($this->filePath === null) {
- $this->logger->error(__METHOD__ . '(): called with no path.', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): called with no path.', ['app' => 'core']);
return false;
} else {
$filePath = $this->filePath;
@@ -225,10 +225,10 @@ class OC_Image implements \OCP\IImage {
}
$isWritable = is_writable(dirname($filePath));
if (!$isWritable) {
- $this->logger->error(__METHOD__ . '(): Directory \'' . dirname($filePath) . '\' is not writable.', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): Directory \'' . dirname($filePath) . '\' is not writable.', ['app' => 'core']);
return false;
} elseif ($isWritable && file_exists($filePath) && !is_writable($filePath)) {
- $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', ['app' => 'core']);
return false;
}
}
@@ -360,11 +360,11 @@ class OC_Image implements \OCP\IImage {
break;
default:
$res = imagepng($this->resource);
- $this->logger->info('OC_Image->data. Could not guess mime-type, defaulting to png', array('app' => 'core'));
+ $this->logger->info('OC_Image->data. Could not guess mime-type, defaulting to png', ['app' => 'core']);
break;
}
if (!$res) {
- $this->logger->error('OC_Image->data. Error getting image data.', array('app' => 'core'));
+ $this->logger->error('OC_Image->data. Error getting image data.', ['app' => 'core']);
}
return ob_get_clean();
}
@@ -399,19 +399,19 @@ class OC_Image implements \OCP\IImage {
}
if ($this->imageType !== IMAGETYPE_JPEG) {
- $this->logger->debug('OC_Image->fixOrientation() Image is not a JPEG.', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Image is not a JPEG.', ['app' => 'core']);
return -1;
}
if (!is_callable('exif_read_data')) {
- $this->logger->debug('OC_Image->fixOrientation() Exif module not enabled.', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Exif module not enabled.', ['app' => 'core']);
return -1;
}
if (!$this->valid()) {
- $this->logger->debug('OC_Image->fixOrientation() No image loaded.', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() No image loaded.', ['app' => 'core']);
return -1;
}
if (is_null($this->filePath) || !is_readable($this->filePath)) {
- $this->logger->debug('OC_Image->fixOrientation() No readable file path set.', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() No readable file path set.', ['app' => 'core']);
return -1;
}
$exif = @exif_read_data($this->filePath, 'IFD0');
@@ -427,11 +427,11 @@ class OC_Image implements \OCP\IImage {
public function readExif($data) {
if (!is_callable('exif_read_data')) {
- $this->logger->debug('OC_Image->fixOrientation() Exif module not enabled.', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Exif module not enabled.', ['app' => 'core']);
return;
}
if (!$this->valid()) {
- $this->logger->debug('OC_Image->fixOrientation() No image loaded.', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() No image loaded.', ['app' => 'core']);
return;
}
@@ -453,7 +453,7 @@ class OC_Image implements \OCP\IImage {
*/
public function fixOrientation() {
$o = $this->getOrientation();
- $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, ['app' => 'core']);
$rotate = 0;
$flip = false;
switch ($o) {
@@ -500,15 +500,15 @@ class OC_Image implements \OCP\IImage {
$this->resource = $res;
return true;
} else {
- $this->logger->debug('OC_Image->fixOrientation() Error during alpha-saving', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Error during alpha-saving', ['app' => 'core']);
return false;
}
} else {
- $this->logger->debug('OC_Image->fixOrientation() Error during alpha-blending', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Error during alpha-blending', ['app' => 'core']);
return false;
}
} else {
- $this->logger->debug('OC_Image->fixOrientation() Error during orientation fixing', array('app' => 'core'));
+ $this->logger->debug('OC_Image->fixOrientation() Error during orientation fixing', ['app' => 'core']);
return false;
}
}
@@ -550,7 +550,7 @@ class OC_Image implements \OCP\IImage {
imagealphablending($this->resource, true);
imagesavealpha($this->resource, true);
} else {
- $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: ' . $imagePath, array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: ' . $imagePath, ['app' => 'core']);
}
break;
case IMAGETYPE_JPEG:
@@ -558,10 +558,10 @@ class OC_Image implements \OCP\IImage {
if (getimagesize($imagePath) !== false) {
$this->resource = @imagecreatefromjpeg($imagePath);
} else {
- $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']);
}
} else {
- $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, ['app' => 'core']);
}
break;
case IMAGETYPE_PNG:
@@ -571,21 +571,21 @@ class OC_Image implements \OCP\IImage {
imagealphablending($this->resource, true);
imagesavealpha($this->resource, true);
} else {
- $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: ' . $imagePath, array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: ' . $imagePath, ['app' => 'core']);
}
break;
case IMAGETYPE_XBM:
if (imagetypes() & IMG_XPM) {
$this->resource = @imagecreatefromxbm($imagePath);
} else {
- $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: ' . $imagePath, array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: ' . $imagePath, ['app' => 'core']);
}
break;
case IMAGETYPE_WBMP:
if (imagetypes() & IMG_WBMP) {
$this->resource = @imagecreatefromwbmp($imagePath);
} else {
- $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: ' . $imagePath, array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: ' . $imagePath, ['app' => 'core']);
}
break;
case IMAGETYPE_BMP:
@@ -620,7 +620,7 @@ class OC_Image implements \OCP\IImage {
// this is mostly file created from encrypted file
$this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath)));
$iType = IMAGETYPE_PNG;
- $this->logger->debug('OC_Image->loadFromFile, Default', array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, Default', ['app' => 'core']);
break;
}
if ($this->valid()) {
@@ -651,7 +651,7 @@ class OC_Image implements \OCP\IImage {
}
if (!$this->resource) {
- $this->logger->debug('OC_Image->loadFromFile, could not load', array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromFile, could not load', ['app' => 'core']);
return false;
}
return $this->resource;
@@ -674,7 +674,7 @@ class OC_Image implements \OCP\IImage {
$this->mimeType = $this->fileInfo->buffer($data);
}
if (!$this->resource) {
- $this->logger->debug('OC_Image->loadFromBase64, could not load', array('app' => 'core'));
+ $this->logger->debug('OC_Image->loadFromBase64, could not load', ['app' => 'core']);
return false;
}
return $this->resource;
@@ -695,7 +695,7 @@ class OC_Image implements \OCP\IImage {
*/
private function imagecreatefrombmp($fileName) {
if (!($fh = fopen($fileName, 'rb'))) {
- $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, array('app' => 'core'));
+ $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, ['app' => 'core']);
return false;
}
// read file header
@@ -703,7 +703,7 @@ class OC_Image implements \OCP\IImage {
// check for bitmap
if ($meta['type'] != 19778) {
fclose($fh);
- $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', array('app' => 'core'));
+ $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', ['app' => 'core']);
return false;
}
// read image header
@@ -727,7 +727,7 @@ class OC_Image implements \OCP\IImage {
$meta['imagesize'] = @filesize($fileName) - $meta['offset'];
if ($meta['imagesize'] < 1) {
fclose($fh);
- $this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', array('app' => 'core'));
+ $this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', ['app' => 'core']);
return false;
}
}
@@ -735,7 +735,7 @@ class OC_Image implements \OCP\IImage {
// calculate colors
$meta['colors'] = !$meta['colors'] ? pow(2, $meta['bits']) : $meta['colors'];
// read color palette
- $palette = array();
+ $palette = [];
if ($meta['bits'] < 16) {
$palette = unpack('l' . $meta['colors'], fread($fh, $meta['colors'] * 4));
// in rare cases the color value is signed
@@ -751,7 +751,7 @@ class OC_Image implements \OCP\IImage {
fclose($fh);
$this->logger->warning(
'imagecreatefrombmp: imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'],
- array('app' => 'core'));
+ ['app' => 'core']);
return false;
}
@@ -768,7 +768,7 @@ class OC_Image implements \OCP\IImage {
case 32:
case 24:
if (!($part = substr($data, $p, 3))) {
- $this->logger->warning($error, array('app' => 'core'));
+ $this->logger->warning($error, ['app' => 'core']);
return $im;
}
$color = @unpack('V', $part . $vide);
@@ -776,7 +776,7 @@ class OC_Image implements \OCP\IImage {
case 16:
if (!($part = substr($data, $p, 2))) {
fclose($fh);
- $this->logger->warning($error, array('app' => 'core'));
+ $this->logger->warning($error, ['app' => 'core']);
return $im;
}
$color = @unpack('v', $part);
@@ -823,7 +823,7 @@ class OC_Image implements \OCP\IImage {
break;
default:
fclose($fh);
- $this->logger->warning('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', array('app' => 'core'));
+ $this->logger->warning('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', ['app' => 'core']);
return false;
}
imagesetpixel($im, $x, $y, $color[1]);
@@ -845,7 +845,7 @@ class OC_Image implements \OCP\IImage {
*/
public function resize($maxSize) {
if (!$this->valid()) {
- $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']);
return false;
}
$widthOrig = imagesx($this->resource);
@@ -871,14 +871,14 @@ class OC_Image implements \OCP\IImage {
*/
public function preciseResize(int $width, int $height): bool {
if (!$this->valid()) {
- $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']);
return false;
}
$widthOrig = imagesx($this->resource);
$heightOrig = imagesy($this->resource);
$process = imagecreatetruecolor($width, $height);
if ($process === false) {
- $this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']);
return false;
}
@@ -891,7 +891,7 @@ class OC_Image implements \OCP\IImage {
$res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
if ($res === false) {
- $this->logger->error(__METHOD__ . '(): Error re-sampling process image', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']);
imagedestroy($process);
return false;
}
@@ -908,7 +908,7 @@ class OC_Image implements \OCP\IImage {
*/
public function centerCrop($size = 0) {
if (!$this->valid()) {
- $this->logger->error('OC_Image->centerCrop, No image loaded', array('app' => 'core'));
+ $this->logger->error('OC_Image->centerCrop, No image loaded', ['app' => 'core']);
return false;
}
$widthOrig = imagesx($this->resource);
@@ -935,7 +935,7 @@ class OC_Image implements \OCP\IImage {
}
$process = imagecreatetruecolor($targetWidth, $targetHeight);
if ($process == false) {
- $this->logger->error('OC_Image->centerCrop, Error creating true color image', array('app' => 'core'));
+ $this->logger->error('OC_Image->centerCrop, Error creating true color image', ['app' => 'core']);
imagedestroy($process);
return false;
}
@@ -949,7 +949,7 @@ class OC_Image implements \OCP\IImage {
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
if ($process == false) {
- $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, array('app' => 'core'));
+ $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']);
imagedestroy($process);
return false;
}
@@ -969,12 +969,12 @@ class OC_Image implements \OCP\IImage {
*/
public function crop(int $x, int $y, int $w, int $h): bool {
if (!$this->valid()) {
- $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']);
return false;
}
$process = imagecreatetruecolor($w, $h);
if ($process == false) {
- $this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']);
imagedestroy($process);
return false;
}
@@ -988,7 +988,7 @@ class OC_Image implements \OCP\IImage {
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h);
if ($process == false) {
- $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, ['app' => 'core']);
imagedestroy($process);
return false;
}
@@ -1008,7 +1008,7 @@ class OC_Image implements \OCP\IImage {
*/
public function fitIn($maxWidth, $maxHeight) {
if (!$this->valid()) {
- $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']);
return false;
}
$widthOrig = imagesx($this->resource);
@@ -1031,7 +1031,7 @@ class OC_Image implements \OCP\IImage {
*/
public function scaleDownToFit($maxWidth, $maxHeight) {
if (!$this->valid()) {
- $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
+ $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']);
return false;
}
$widthOrig = imagesx($this->resource);
@@ -1075,7 +1075,7 @@ if (!function_exists('imagebmp')) {
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) {
- if (!in_array($bit, array(1, 4, 8, 16, 24, 32))) {
+ if (!in_array($bit, [1, 4, 8, 16, 24, 32])) {
$bit = 24;
} else if ($bit == 32) {
$bit = 24;
diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php
index 29d0029a3a0..f83fca0a433 100644
--- a/lib/private/legacy/json.php
+++ b/lib/private/legacy/json.php
@@ -44,7 +44,7 @@ class OC_JSON{
public static function checkAppEnabled($app) {
if( !\OC::$server->getAppManager()->isEnabledForUser($app)) {
$l = \OC::$server->getL10N('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' )));
+ self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]);
exit();
}
}
@@ -60,7 +60,7 @@ class OC_JSON{
|| $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
$l = \OC::$server->getL10N('lib');
http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED);
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
+ self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]);
exit();
}
}
@@ -78,7 +78,7 @@ class OC_JSON{
if( !\OC::$server->getRequest()->passesCSRFCheck()) {
$l = \OC::$server->getL10N('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' )));
+ self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]);
exit();
}
}
@@ -91,7 +91,7 @@ class OC_JSON{
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
$l = \OC::$server->getL10N('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
+ self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]);
exit();
}
}
@@ -101,7 +101,7 @@ class OC_JSON{
* @deprecated Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/
- public static function error($data = array()) {
+ public static function error($data = []) {
$data['status'] = 'error';
header( 'Content-Type: application/json; charset=utf-8');
echo self::encode($data);
@@ -112,7 +112,7 @@ class OC_JSON{
* @deprecated Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/
- public static function success($data = array()) {
+ public static function success($data = []) {
$data['status'] = 'success';
header( 'Content-Type: application/json; charset=utf-8');
echo self::encode($data);
@@ -133,7 +133,7 @@ class OC_JSON{
*/
public static function encode($data) {
if (is_array($data)) {
- array_walk_recursive($data, array('OC_JSON', 'to_string'));
+ array_walk_recursive($data, ['OC_JSON', 'to_string']);
}
return json_encode($data, JSON_HEX_TAG);
}
diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php
index ed1e5627961..279ceb8de0f 100644
--- a/lib/private/legacy/template.php
+++ b/lib/private/legacy/template.php
@@ -54,7 +54,7 @@ class OC_Template extends \OC\Template\Base {
private $path; // The path to the template
/** @var array */
- private $headers = array(); //custom headers
+ private $headers = []; //custom headers
/** @var string */
protected $app; // app id
@@ -154,7 +154,7 @@ class OC_Template extends \OC\Template\Base {
$locator = new \OC\Template\TemplateFileLocator( $dirs );
$template = $locator->find($name);
$path = $locator->getPath();
- return array($path, $template);
+ return [$path, $template];
}
/**
@@ -165,11 +165,11 @@ class OC_Template extends \OC\Template\Base {
* element will be written as empty element. So use "" to get a closing tag.
*/
public function addHeader($tag, $attributes, $text=null) {
- $this->headers[]= array(
+ $this->headers[]= [
'tag' => $tag,
'attributes' => $attributes,
'text' => $text
- );
+ ];
}
/**
@@ -238,7 +238,7 @@ class OC_Template extends \OC\Template\Base {
* @param array $parameters Parameters for the template
* @return boolean|null
*/
- public static function printUserPage( $application, $name, $parameters = array() ) {
+ public static function printUserPage( $application, $name, $parameters = [] ) {
$content = new OC_Template( $application, $name, "user" );
foreach( $parameters as $key => $value ) {
$content->assign( $key, $value );
@@ -253,7 +253,7 @@ class OC_Template extends \OC\Template\Base {
* @param array $parameters Parameters for the template
* @return bool
*/
- public static function printAdminPage( $application, $name, $parameters = array() ) {
+ public static function printAdminPage( $application, $name, $parameters = [] ) {
$content = new OC_Template( $application, $name, "admin" );
foreach( $parameters as $key => $value ) {
$content->assign( $key, $value );
@@ -268,7 +268,7 @@ class OC_Template extends \OC\Template\Base {
* @param array|string $parameters Parameters for the template
* @return bool
*/
- public static function printGuestPage( $application, $name, $parameters = array() ) {
+ public static function printGuestPage( $application, $name, $parameters = [] ) {
$content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest');
foreach( $parameters as $key => $value ) {
$content->assign( $key, $value );
@@ -297,7 +297,7 @@ class OC_Template extends \OC\Template\Base {
http_response_code($statusCode);
try {
$content = new \OC_Template( '', 'error', 'error', false );
- $errors = array(array('error' => $error_msg, 'hint' => $hint));
+ $errors = [['error' => $error_msg, 'hint' => $hint]];
$content->assign( 'errors', $errors );
$content->printPage();
} catch (\Exception $e) {
diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php
index d931e4d129f..9184da21bdb 100644
--- a/lib/private/legacy/template/functions.php
+++ b/lib/private/legacy/template/functions.php
@@ -196,11 +196,11 @@ function component($app, $file) {
if(is_array($file)) {
foreach($file as $f) {
$url = link_to($app, 'component/' . $f . '.html');
- OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
+ OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]);
}
} else {
$url = link_to($app, 'component/' . $file . '.html');
- OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
+ OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]);
}
}
@@ -213,7 +213,7 @@ function component($app, $file) {
*
* For further information have a look at \OCP\IURLGenerator::linkTo
*/
-function link_to( $app, $file, $args = array() ) {
+function link_to( $app, $file, $args = [] ) {
return \OC::$server->getURLGenerator()->linkTo($app, $file, $args);
}
@@ -305,9 +305,9 @@ function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false)
return $formatter->formatTimeSpan($timestamp, $fromTime);
}
-function html_select_options($options, $selected, $params=array()) {
+function html_select_options($options, $selected, $params=[]) {
if (!is_array($selected)) {
- $selected=array($selected);
+ $selected=[$selected];
}
if (isset($params['combine']) && $params['combine']) {
$options = array_combine($options, $options);
diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php
index 6a887063525..736fc2d9702 100644
--- a/lib/private/legacy/user.php
+++ b/lib/private/legacy/user.php
@@ -59,9 +59,9 @@ use OCP\ILogger;
*/
class OC_User {
- private static $_usedBackends = array();
+ private static $_usedBackends = [];
- private static $_setupedBackends = array();
+ private static $_setupedBackends = [];
// bool, stores if a user want to access a resource anonymously, e.g if they open a public link
private static $incognitoMode = false;
@@ -113,7 +113,7 @@ class OC_User {
* remove all used backends
*/
public static function clearBackends() {
- self::$_usedBackends = array();
+ self::$_usedBackends = [];
\OC::$server->getUserManager()->clearBackends();
}
@@ -165,7 +165,7 @@ class OC_User {
$uid = $backend->getCurrentUserId();
$run = true;
- OC_Hook::emit("OC_User", "pre_login", array("run" => &$run, "uid" => $uid, 'backend' => $backend));
+ OC_Hook::emit("OC_User", "pre_login", ["run" => &$run, "uid" => $uid, 'backend' => $backend]);
if ($uid) {
if (self::getUser() !== $uid) {
@@ -385,7 +385,7 @@ class OC_User {
* @deprecated Use \OC::$server->getUserManager->searchDisplayName($search, $limit, $offset) instead.
*/
public static function getDisplayNames($search = '', $limit = null, $offset = null) {
- $displayNames = array();
+ $displayNames = [];
$users = \OC::$server->getUserManager()->searchDisplayName($search, $limit, $offset);
foreach ($users as $user) {
$displayNames[$user->getUID()] = $user->getDisplayName();
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index 63edf34e029..044c3fee7bc 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -69,9 +69,9 @@ use OCP\ILogger;
use OCP\IUser;
class OC_Util {
- public static $scripts = array();
- public static $styles = array();
- public static $headers = array();
+ public static $scripts = [];
+ public static $styles = [];
+ public static $headers = [];
private static $rootMounted = false;
private static $fsSetup = false;
@@ -88,7 +88,7 @@ class OC_Util {
//first set up the local "root" storage
\OC\Files\Filesystem::initMountManager();
if (!self::$rootMounted) {
- \OC\Files\Filesystem::mount('\OC\Files\Storage\Local', array('datadir' => $configDataDirectory), '/');
+ \OC\Files\Filesystem::mount('\OC\Files\Storage\Local', ['datadir' => $configDataDirectory], '/');
self::$rootMounted = true;
}
}
@@ -107,7 +107,7 @@ class OC_Util {
\OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR);
}
if (!isset($config['arguments'])) {
- $config['arguments'] = array();
+ $config['arguments'] = [];
}
// instantiate object store implementation
@@ -141,7 +141,7 @@ class OC_Util {
\OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR);
}
if (!isset($config['arguments'])) {
- $config['arguments'] = array();
+ $config['arguments'] = [];
}
// instantiate object store implementation
@@ -194,7 +194,7 @@ class OC_Util {
}
// load all filesystem apps before, so no setup-hook gets lost
- OC_App::loadApps(array('filesystem'));
+ OC_App::loadApps(['filesystem']);
// the filesystem will finish when $user is not empty,
// mark fs setup here to avoid doing the setup from loading
@@ -254,7 +254,7 @@ class OC_Util {
$user = $storage->getUser()->getUID();
$quota = OC_Util::getUserQuota($user);
if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
- return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
+ return new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => $quota, 'root' => 'files']);
}
}
}
@@ -279,7 +279,7 @@ class OC_Util {
return $storage;
});
- OC_Hook::emit('OC_Filesystem', 'preSetup', array('user' => $user));
+ OC_Hook::emit('OC_Filesystem', 'preSetup', ['user' => $user]);
\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($prevLogging);
@@ -309,7 +309,7 @@ class OC_Util {
//jail the user into his "home" directory
\OC\Files\Filesystem::init($user, $userDir);
- OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
+ OC_Hook::emit('OC_Filesystem', 'setup', ['user' => $user, 'user_dir' => $userDir]);
}
\OC::$server->getEventLogger()->end('setup_fs');
return true;
@@ -695,11 +695,11 @@ class OC_Util {
* @param bool $prepend prepend the header to the beginning of the list
*/
public static function addHeader($tag, $attributes, $text = null, $prepend = false) {
- $header = array(
+ $header = [
'tag' => $tag,
'attributes' => $attributes,
'text' => $text
- );
+ ];
if ($prepend === true) {
array_unshift (self::$headers, $header);
@@ -716,7 +716,7 @@ class OC_Util {
*/
public static function checkServer(\OC\SystemConfig $config) {
$l = \OC::$server->getL10N('lib');
- $errors = array();
+ $errors = [];
$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data');
if (!self::needUpgrade($config) && $config->getValue('installed', false)) {
@@ -744,23 +744,23 @@ class OC_Util {
$availableDatabases = $setup->getSupportedDatabases();
if (empty($availableDatabases)) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'),
'hint' => '' //TODO: sane hint
- );
+ ];
$webServerRestart = true;
}
// Check if config folder is writable.
if(!OC_Helper::isReadOnlyConfigEnabled()) {
if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('Cannot write into "config" directory'),
'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s',
[ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. '
. $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s',
[ $urlGenerator->linkToDocs('admin-config') ] )
- );
+ ];
}
}
@@ -770,12 +770,12 @@ class OC_Util {
|| !is_writable(OC_App::getInstallPath())
|| !is_readable(OC_App::getInstallPath())
) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('Cannot write into "apps" directory'),
'hint' => $l->t('This can usually be fixed by giving the webserver write access to the apps directory'
. ' or disabling the appstore in the config file. See %s',
[$urlGenerator->linkToDocs('admin-dir_permissions')])
- );
+ ];
}
}
// Create root dir.
@@ -812,12 +812,12 @@ class OC_Util {
}
if (!OC_Util::isSetLocaleWorking()) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('Setting locale to %s failed',
- array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/'
- . 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')),
+ ['en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/'
+ . 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8']),
'hint' => $l->t('Please install one of these locales on your system and restart your webserver.')
- );
+ ];
}
// Contains the dependencies that should be checked against
@@ -828,13 +828,13 @@ class OC_Util {
// If the dependency is not found the missing module name is shown to the EndUser
// When adding new checks always verify that they pass on Travis as well
// for ini settings, see https://github.com/owncloud/administration/blob/master/travis-ci/custom.ini
- $dependencies = array(
- 'classes' => array(
+ $dependencies = [
+ 'classes' => [
'ZipArchive' => 'zip',
'DOMDocument' => 'dom',
'XMLWriter' => 'XMLWriter',
'XMLReader' => 'XMLReader',
- ),
+ ],
'functions' => [
'xml_parser_create' => 'libxml',
'mb_strcut' => 'mbstring',
@@ -848,14 +848,14 @@ class OC_Util {
'curl_init' => 'cURL',
'openssl_verify' => 'OpenSSL',
],
- 'defined' => array(
+ 'defined' => [
'PDO::ATTR_DRIVER_NAME' => 'PDO'
- ),
+ ],
'ini' => [
'default_charset' => 'UTF-8',
],
- );
- $missingDependencies = array();
+ ];
+ $missingDependencies = [];
$invalidIniSettings = [];
$moduleHint = $l->t('Please ask your server administrator to install the module.');
@@ -894,10 +894,10 @@ class OC_Util {
}
foreach($missingDependencies as $missingDependency) {
- $errors[] = array(
- 'error' => $l->t('PHP module %s not installed.', array($missingDependency)),
+ $errors[] = [
+ 'error' => $l->t('PHP module %s not installed.', [$missingDependency]),
'hint' => $moduleHint
- );
+ ];
$webServerRestart = true;
}
foreach($invalidIniSettings as $setting) {
@@ -921,10 +921,10 @@ class OC_Util {
*/
if($iniWrapper->getBool('mbstring.func_overload') !== null &&
$iniWrapper->getBool('mbstring.func_overload') === true) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]),
'hint' => $l->t('To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini')
- );
+ ];
}
if(function_exists('xml_parser_create') &&
@@ -935,24 +935,24 @@ class OC_Util {
$minor = floor($version/100);
$version -= ($minor * 100);
$patch = $version;
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]),
'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.')
- );
+ ];
}
if (!self::isAnnotationsWorking()) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible.'),
'hint' => $l->t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')
- );
+ ];
}
if (!\OC::$CLI && $webServerRestart) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('PHP modules have been installed, but they are still listed as missing?'),
'hint' => $l->t('Please ask your server administrator to restart the web server.')
- );
+ ];
}
$errors = array_merge($errors, self::checkDatabaseVersion());
@@ -970,7 +970,7 @@ class OC_Util {
*/
public static function checkDatabaseVersion() {
$l = \OC::$server->getL10N('lib');
- $errors = array();
+ $errors = [];
$dbType = \OC::$server->getSystemConfig()->getValue('dbtype', 'sqlite');
if ($dbType === 'pgsql') {
// check PostgreSQL version
@@ -980,10 +980,10 @@ class OC_Util {
if (isset($data['server_version'])) {
$version = $data['server_version'];
if (version_compare($version, '9.0.0', '<')) {
- $errors[] = array(
+ $errors[] = [
'error' => $l->t('PostgreSQL >= 9 required'),
'hint' => $l->t('Please upgrade your database version')
- );
+ ];
}
}
} catch (\Doctrine\DBAL\DBALException $e) {