diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 09:30:18 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 16:34:56 +0100 |
commit | b80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch) | |
tree | ec20e0ffa2f86b9b54939a83a785407319f94559 /core | |
parent | 62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff) | |
download | nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip |
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/App/Update.php | 2 | ||||
-rw-r--r-- | core/Command/Encryption/ListModules.php | 2 | ||||
-rw-r--r-- | core/Command/L10n/CreateJs.php | 10 | ||||
-rw-r--r-- | core/Command/Status.php | 4 | ||||
-rw-r--r-- | core/Command/Upgrade.php | 2 | ||||
-rw-r--r-- | core/Command/User/Report.php | 16 | ||||
-rw-r--r-- | core/Controller/LostController.php | 14 | ||||
-rw-r--r-- | core/Controller/OCSController.php | 4 | ||||
-rw-r--r-- | core/Controller/SetupController.php | 8 | ||||
-rw-r--r-- | core/Controller/UserController.php | 6 | ||||
-rw-r--r-- | core/ajax/update.php | 2 | ||||
-rw-r--r-- | core/templates/404.php | 2 | ||||
-rw-r--r-- | core/templates/installation.php | 2 | ||||
-rw-r--r-- | core/templates/update.admin.php | 4 | ||||
-rw-r--r-- | core/templates/update.user.php | 4 |
15 files changed, 41 insertions, 41 deletions
diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index f02da1c66ba..19d0251d824 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -83,7 +83,7 @@ class Update extends Command { $singleAppId = $input->getArgument('app-id'); if ($singleAppId) { - $apps = array($singleAppId); + $apps = [$singleAppId]; try { $this->manager->getAppPath($singleAppId); } catch (\OCP\App\AppPathNotFoundException $e) { diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php index c38571d7c62..dd9290eea81 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -69,7 +69,7 @@ class ListModules extends Base { $encryptionModules = $this->encryptionManager->getEncryptionModules(); $defaultEncryptionModuleId = $this->encryptionManager->getDefaultEncryptionModuleId(); - $encModules = array(); + $encModules = []; foreach ($encryptionModules as $module) { $encModules[$module['id']]['displayName'] = $module['displayName']; $encModules[$module['id']]['default'] = $module['id'] === $defaultEncryptionModuleId; diff --git a/core/Command/L10n/CreateJs.php b/core/Command/L10n/CreateJs.php index f2b833fe914..3e67e1329f0 100644 --- a/core/Command/L10n/CreateJs.php +++ b/core/Command/L10n/CreateJs.php @@ -72,7 +72,7 @@ class CreateJs extends Command implements CompletionAwareInterface { } private function getAllLanguages($path) { - $result = array(); + $result = []; foreach (new DirectoryIterator("$path/l10n") as $fileInfo) { if($fileInfo->isDot()) { continue; @@ -102,7 +102,7 @@ class CreateJs extends Command implements CompletionAwareInterface { return; } $content = "OC.L10N.register(\n \"$app\",\n {\n "; - $jsTrans = array(); + $jsTrans = []; foreach ($translations as $id => $val) { if (is_array($val)) { $val = '[ ' . implode(',', $val) . ']'; @@ -122,21 +122,21 @@ class CreateJs extends Command implements CompletionAwareInterface { $output->writeln("File already exists: $jsFile"); return; } - $content = array('translations' => $translations, 'pluralForm' => $plurals); + $content = ['translations' => $translations, 'pluralForm' => $plurals]; file_put_contents($jsFile, json_encode($content)); $output->writeln("Json translation file generated: $jsFile"); } private function loadTranslations($path, $lang) { $phpFile = "$path/l10n/$lang.php"; - $TRANSLATIONS = array(); + $TRANSLATIONS = []; $PLURAL_FORMS = ''; if (!file_exists($phpFile)) { throw new UnexpectedValueException("PHP translation file <$phpFile> does not exist."); } require $phpFile; - return array($TRANSLATIONS, $PLURAL_FORMS); + return [$TRANSLATIONS, $PLURAL_FORMS]; } /** diff --git a/core/Command/Status.php b/core/Command/Status.php index 8f615004f3c..25632a313f3 100644 --- a/core/Command/Status.php +++ b/core/Command/Status.php @@ -38,12 +38,12 @@ class Status extends Base { } protected function execute(InputInterface $input, OutputInterface $output) { - $values = array( + $values = [ 'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), 'version' => implode('.', \OCP\Util::getVersion()), 'versionstring' => \OC_Util::getVersionString(), 'edition' => '', - ); + ]; $this->writeArrayInOutputFormat($input, $output, $values); } diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 944b1da9f26..0a66d63fd32 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -285,7 +285,7 @@ class Upgrade extends Command { * @param OutputInterface $output output interface */ protected function postUpgradeCheck(InputInterface $input, OutputInterface $output) { - $trustedDomains = $this->config->getSystemValue('trusted_domains', array()); + $trustedDomains = $this->config->getSystemValue('trusted_domains', []); if (empty($trustedDomains)) { $output->write( '<warning>The setting "trusted_domains" could not be ' . diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index 3f15d40dba7..77fbcc124fa 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -52,25 +52,25 @@ class Report extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $table = new Table($output); - $table->setHeaders(array('User Report', '')); + $table->setHeaders(['User Report', '']); $userCountArray = $this->countUsers(); if(!empty($userCountArray)) { $total = 0; - $rows = array(); + $rows = []; foreach($userCountArray as $classname => $users) { $total += $users; - $rows[] = array($classname, $users); + $rows[] = [$classname, $users]; } - $rows[] = array(' '); - $rows[] = array('total users', $total); + $rows[] = [' ']; + $rows[] = ['total users', $total]; } else { - $rows[] = array('No backend enabled that supports user counting', ''); + $rows[] = ['No backend enabled that supports user counting', '']; } $userDirectoryCount = $this->countUserDirectories(); - $rows[] = array(' '); - $rows[] = array('user directories', $userDirectoryCount); + $rows[] = [' ']; + $rows[] = ['user directories', $userDirectoryCount]; $table->setRows($rows); $table->render(); diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index e8d9b8675b6..cdeec469e04 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -170,7 +170,7 @@ class LostController extends Controller { } catch (\Exception $e) { return new TemplateResponse( 'core', 'error', [ - "errors" => array(array("error" => $e->getMessage())) + "errors" => [["error" => $e->getMessage()]] ], 'guest' ); @@ -231,8 +231,8 @@ class LostController extends Controller { * @param array $additional * @return array */ - private function error($message, array $additional=array()) { - return array_merge(array('status' => 'error', 'msg' => $message), $additional); + private function error($message, array $additional=[]) { + return array_merge(['status' => 'error', 'msg' => $message], $additional); } /** @@ -297,7 +297,7 @@ class LostController extends Controller { $instance = call_user_func($module['callback']); // this way we can find out whether per-user keys are used or a system wide encryption key if ($instance->needDetailedAccessList()) { - return $this->error('', array('encryption' => true)); + return $this->error('', ['encryption' => true]); } } } @@ -306,13 +306,13 @@ class LostController extends Controller { $this->checkPasswordResetToken($token, $userId); $user = $this->userManager->get($userId); - \OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'pre_passwordReset', array('uid' => $userId, 'password' => $password)); + \OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'pre_passwordReset', ['uid' => $userId, 'password' => $password]); if (!$user->setPassword($password)) { throw new \Exception(); } - \OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', array('uid' => $userId, 'password' => $password)); + \OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', ['uid' => $userId, 'password' => $password]); $this->twoFactorManager->clearTwoFactorPending($userId); @@ -354,7 +354,7 @@ class LostController extends Controller { $encryptedValue = $this->crypto->encrypt($tokenValue, $email . $this->config->getSystemValue('secret')); $this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue); - $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user->getUID(), 'token' => $token)); + $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]); $emailTemplate = $this->mailer->createEMailTemplate('core.ResetPassword', [ 'link' => $link, diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 664909b0fb9..60ea12f017c 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -92,14 +92,14 @@ class OCSController extends \OCP\AppFramework\OCSController { public function getCapabilities() { $result = []; list($major, $minor, $micro) = \OCP\Util::getVersion(); - $result['version'] = array( + $result['version'] = [ 'major' => $major, 'minor' => $minor, 'micro' => $micro, 'string' => \OC_Util::getVersionString(), 'edition' => '', 'extendedSupport' => \OCP\Util::hasExtendedSupport() - ); + ]; if($this->userSession->isLoggedIn()) { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(); diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 302edccf7a6..0135e01f148 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -74,7 +74,7 @@ class SetupController { if(isset($post['install']) AND $post['install']=='true') { // We have to launch the installation process : $e = $this->setupHelper->install($post); - $errors = array('errors' => $e); + $errors = ['errors' => $e]; if(count($e) > 0) { $options = array_merge($opts, $post, $errors); @@ -93,7 +93,7 @@ class SetupController { } public function display($post) { - $defaults = array( + $defaults = [ 'adminlogin' => '', 'adminpass' => '', 'dbuser' => '', @@ -102,7 +102,7 @@ class SetupController { 'dbtablespace' => '', 'dbhost' => 'localhost', 'dbtype' => '', - ); + ]; $parameters = array_merge($defaults, $post); \OC_Util::addScript('setup'); @@ -133,7 +133,7 @@ class SetupController { public function loadAutoConfig($post) { if( file_exists($this->autoConfigFile)) { \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); - $AUTOCONFIG = array(); + $AUTOCONFIG = []; include $this->autoConfigFile; $post = array_merge ($post, $AUTOCONFIG); } diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php index 23b2eda4e26..54c5202a59f 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -53,7 +53,7 @@ class UserController extends Controller { * @return JSONResponse */ public function getDisplayNames($users) { - $result = array(); + $result = []; foreach ($users as $user) { $userObject = $this->userManager->get($user); @@ -64,10 +64,10 @@ class UserController extends Controller { } } - $json = array( + $json = [ 'users' => $result, 'status' => 'success' - ); + ]; return new JSONResponse($json); diff --git a/core/ajax/update.php b/core/ajax/update.php index 1744e2db18c..fd0e2c80d64 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -186,7 +186,7 @@ if (\OCP\Util::needUpgrade()) { $eventSource->send('success', (string)$l->t('Checked database schema update for apps')); }); $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', array($app, $version))); + $eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version])); }); $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) { $incompatibleApps[]= $app; diff --git a/core/templates/404.php b/core/templates/404.php index 071d57b1b68..925059d4750 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -20,7 +20,7 @@ if(!isset($_)) {//standalone page is not supported anymore - redirect to / <h2><?php p($l->t('File not found')); ?></h2> <p class="infogroup"><?php p($l->t('The document could not be found on the server. Maybe the share was deleted or has expired?')); ?></p> <p><a class="button primary" href="<?php p(\OC::$server->getURLGenerator()->linkTo('', 'index.php')) ?>"> - <?php p($l->t('Back to %s', array($theme->getName()))); ?> + <?php p($l->t('Back to %s', [$theme->getName()])); ?> </a></p> </div> <?php endif; ?> diff --git a/core/templates/installation.php b/core/templates/installation.php index 5a351e97416..25052782e6f 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -81,7 +81,7 @@ script('core', [ <?php foreach($_['databases'] as $type => $label): ?> <?php if(count($_['databases']) === 1): ?> <p class="info"> - <?php p($l->t( 'Only %s is available.', array($label) )); ?> + <?php p($l->t( 'Only %s is available.', [$label] )); ?> <?php p($l->t( 'Install and activate additional PHP modules to choose other database types.' )); ?><br> <a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer noopener"> <?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a> diff --git a/core/templates/update.admin.php b/core/templates/update.admin.php index f4a1c72ae8d..4a010c025be 100644 --- a/core/templates/update.admin.php +++ b/core/templates/update.admin.php @@ -4,7 +4,7 @@ <h2 class="title"><?php p($l->t('App update required')); ?></h2> <?php } else { ?> <h2 class="title"><?php p($l->t('%1$s will be updated to version %2$s', - array($_['productName'], $_['version']))); ?></h2> + [$_['productName'], $_['version']])); ?></h2> <?php } ?> <?php if (!empty($_['appsToUpgrade'])) { ?> <div class="infogroup"> @@ -28,7 +28,7 @@ <?php } ?> <?php if (!empty($_['oldTheme'])) { ?> <div class="infogroup"> - <?php p($l->t('The theme %s has been disabled.', array($_['oldTheme']))) ?> + <?php p($l->t('The theme %s has been disabled.', [$_['oldTheme']])) ?> </div> <?php } ?> <div class="infogroup bold"> diff --git a/core/templates/update.user.php b/core/templates/update.user.php index 661d7d45a30..2c6ffd43444 100644 --- a/core/templates/update.user.php +++ b/core/templates/update.user.php @@ -1,6 +1,6 @@ <div class="body-login-container"> <div class="icon-big icon-error-white"></div> - <h2><?php p($l->t('Maintenance mode', array($theme->getName()))) ?></h2> - <p><?php p($l->t('This %s instance is currently in maintenance mode, which may take a while.', array($theme->getName()))) ?> <?php p($l->t('This page will refresh itself when the instance is available again.')) ?></p> + <h2><?php p($l->t('Maintenance mode', [$theme->getName()])) ?></h2> + <p><?php p($l->t('This %s instance is currently in maintenance mode, which may take a while.', [$theme->getName()])) ?> <?php p($l->t('This page will refresh itself when the instance is available again.')) ?></p> <p><?php p($l->t('Contact your system administrator if this message persists or appeared unexpectedly.')) ?></p> </div> |