diff --git a/apps/accessibility/lib/AccessibilityProvider.php b/apps/accessibility/lib/AccessibilityProvider.php index ce9489df5f263..c922c7e285085 100644 --- a/apps/accessibility/lib/AccessibilityProvider.php +++ b/apps/accessibility/lib/AccessibilityProvider.php @@ -57,7 +57,7 @@ public function __construct(string $appName, } public function getThemes() { - return array( + return [ [ 'id' => 'dark', 'img' => $this->urlGenerator->imagePath($this->appName, 'theme-dark.jpg'), @@ -65,7 +65,7 @@ public function getThemes() { 'enableLabel' => $this->l->t('Enable dark theme'), 'text' => $this->l->t('A dark theme to ease your eyes by reducing the overall luminosity and brightness. It is still under development, so please report any issues you may find.') ] - ); + ]; } public function getHighContrast() { @@ -79,7 +79,7 @@ public function getHighContrast() { } public function getFonts() { - return array( + return [ [ 'id' => 'fontdyslexic', 'img' => $this->urlGenerator->imagePath($this->appName, 'font-opendyslexic.jpg'), @@ -87,7 +87,7 @@ public function getFonts() { 'enableLabel' => $this->l->t('Enable dyslexia font'), 'text' => $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.') ] - ); + ]; } } diff --git a/apps/accessibility/lib/Controller/ConfigController.php b/apps/accessibility/lib/Controller/ConfigController.php index a84281501cad5..d089feda3001d 100644 --- a/apps/accessibility/lib/Controller/ConfigController.php +++ b/apps/accessibility/lib/Controller/ConfigController.php @@ -113,7 +113,7 @@ public function setConfig(string $key, $value): DataResponse { } $themes = $this->accessibilityProvider->getThemes(); - $highcontrast = array($this->accessibilityProvider->getHighContrast()); + $highcontrast = [$this->accessibilityProvider->getHighContrast()]; $fonts = $this->accessibilityProvider->getFonts(); $availableOptions = array_map(function($option) { diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php index c31ff10e1d733..db5f48adf239a 100644 --- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php +++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php @@ -290,7 +290,7 @@ private function mapUid($uid) { \OCP\Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', - array('uid' => &$uid) + ['uid' => &$uid] ); $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php index bd883071adce3..9a9df25edfdad 100644 --- a/apps/comments/lib/AppInfo/Application.php +++ b/apps/comments/lib/AppInfo/Application.php @@ -44,7 +44,7 @@ class Application extends App { const APP_ID = 'comments'; - public function __construct (array $urlParams = array()) { + public function __construct (array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); $container = $this->getContainer(); diff --git a/apps/dav/appinfo/v1/caldav.php b/apps/dav/appinfo/v1/caldav.php index 529fa576b4ad0..82fddd152e649 100644 --- a/apps/dav/appinfo/v1/caldav.php +++ b/apps/dav/appinfo/v1/caldav.php @@ -69,10 +69,10 @@ $addressBookRoot = new CalendarRoot($principalBackend, $calDavBackend); $addressBookRoot->disableListing = !$debugging; // Disable listing -$nodes = array( +$nodes = [ $principalCollection, $addressBookRoot, -); +]; // Fire up server $server = new \Sabre\DAV\Server($nodes); diff --git a/apps/dav/appinfo/v1/carddav.php b/apps/dav/appinfo/v1/carddav.php index b8886c0d15268..b2e812c2c184a 100644 --- a/apps/dav/appinfo/v1/carddav.php +++ b/apps/dav/appinfo/v1/carddav.php @@ -69,10 +69,10 @@ $addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend, $pluginManager); $addressBookRoot->disableListing = !$debugging; // Disable listing -$nodes = array( +$nodes = [ $principalCollection, $addressBookRoot, -); +]; // Fire up server $server = new \Sabre\DAV\Server($nodes); diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index f0e3cc6438dd4..53f1b0d62b458 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -79,7 +79,7 @@ // FIXME: should not add storage wrappers outside of preSetup, need to find a better way $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) { - return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE)); + return new \OC\Files\Storage\Wrapper\PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE]); }); \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog); diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 96459566a5a10..7280288c02d56 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1944,7 +1944,7 @@ function createSubscription($principalUri, $uri, array $properties) { } } - $valuesToInsert = array(); + $valuesToInsert = []; $query = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 982c579d3bb96..3b66e84fc2bcb 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -237,13 +237,13 @@ public function schedule(Message $iTipMessage) { break; } - $data = array( + $data = [ 'attendee_name' => (string)$meetingAttendeeName ?: $defaultVal, 'invitee_name' => (string)$meetingInviteeName ?: $defaultVal, 'meeting_title' => (string)$meetingTitle ?: $defaultVal, 'meeting_description' => (string)$meetingDescription ?: $defaultVal, 'meeting_url' => (string)$meetingUrl ?: $defaultVal, - ); + ]; $fromEMail = \OCP\Util::getDefaultEmailAddress('invitations-noreply'); $fromName = $l10n->t('%1$s via %2$s', [$senderName, $this->defaults->getName()]); diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 24b91f7cec365..bd89b233aeedd 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -74,9 +74,9 @@ class CardDavBackend implements BackendInterface, SyncSupport { private $sharingBackend; /** @var array properties to index */ - public static $indexProperties = array( + public static $indexProperties = [ 'BDAY', 'UID', 'N', 'FN', 'TITLE', 'ROLE', 'NOTE', 'NICKNAME', - 'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO', 'CLOUD'); + 'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO', 'CLOUD']; /** * @var string[] Map of uid => display name @@ -909,7 +909,7 @@ public function updateShares(IShareable $shareable, $add, $remove) { * - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are * @return array an array of contacts which are arrays of key-value-pairs */ - public function search($addressBookId, $pattern, $searchProperties, $options = array()) { + public function search($addressBookId, $pattern, $searchProperties, $options = []) { $query = $this->db->getQueryBuilder(); $query2 = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php index 139044f9535af..947b2960eab50 100644 --- a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php @@ -74,7 +74,7 @@ public function __construct($app, IAppManager $appManager) { public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('beforeMethod', array($this, 'checkAppEnabled'), 30); + $this->server->on('beforeMethod', [$this, 'checkAppEnabled'], 30); } /** diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index 1a069e548b4e1..22f0104940df8 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -67,7 +67,7 @@ public function __construct(ICommentsManager $commentsManager, IUserSession $use */ function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('propFind', array($this, 'handleGetProperties')); + $this->server->on('propFind', [$this, 'handleGetProperties']); } /** diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index d17cfb8177731..9b44997fb601f 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -267,7 +267,7 @@ public function getChildren() { throw new Locked(); } - $nodes = array(); + $nodes = []; foreach ($folderContent as $info) { $node = $this->getChild($info->getName(), $info); $nodes[] = $node; @@ -336,13 +336,13 @@ public function getQuotaInfo() { } else { $free = $storageInfo['free']; } - $this->quotaInfo = array( + $this->quotaInfo = [ $storageInfo['used'], $free - ); + ]; return $this->quotaInfo; } catch (\OCP\Files\StorageNotAvailableException $e) { - return array(0, 0); + return [0, 0]; } } diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php index dc595197965a3..cf617152eb84d 100644 --- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php @@ -103,7 +103,7 @@ public function __construct($loggerAppName, $logger) { */ public function initialize(\Sabre\DAV\Server $server) { - $server->on('exception', array($this, 'logException'), 10); + $server->on('exception', [$this, 'logException'], 10); } /** diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 098961ce1309c..0bd01de408b2c 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -359,20 +359,20 @@ private function emitPreHooks($exists, $path = null) { $run = true; if (!$exists) { - \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_create, array( + \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_create, [ \OC\Files\Filesystem::signal_param_path => $hookPath, \OC\Files\Filesystem::signal_param_run => &$run, - )); + ]); } else { - \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_update, array( + \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_update, [ \OC\Files\Filesystem::signal_param_path => $hookPath, \OC\Files\Filesystem::signal_param_run => &$run, - )); + ]); } - \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_write, array( + \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_write, [ \OC\Files\Filesystem::signal_param_path => $hookPath, \OC\Files\Filesystem::signal_param_run => &$run, - )); + ]); return $run; } @@ -385,17 +385,17 @@ private function emitPostHooks($exists, $path = null) { } $hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path)); if (!$exists) { - \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, array( + \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, [ \OC\Files\Filesystem::signal_param_path => $hookPath - )); + ]); } else { - \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_update, array( + \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_update, [ \OC\Files\Filesystem::signal_param_path => $hookPath - )); + ]); } - \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, array( + \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, [ \OC\Files\Filesystem::signal_param_path => $hookPath - )); + ]); } /** diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 498058f7c0375..a35db1e77e452 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -173,12 +173,12 @@ public function initialize(\Sabre\DAV\Server $server) { $server->protectedProperties = array_diff($server->protectedProperties, $allowedProperties); $this->server = $server; - $this->server->on('propFind', array($this, 'handleGetProperties')); - $this->server->on('propPatch', array($this, 'handleUpdateProperties')); - $this->server->on('afterBind', array($this, 'sendFileIdHeader')); - $this->server->on('afterWriteContent', array($this, 'sendFileIdHeader')); + $this->server->on('propFind', [$this, 'handleGetProperties']); + $this->server->on('propPatch', [$this, 'handleUpdateProperties']); + $this->server->on('afterBind', [$this, 'sendFileIdHeader']); + $this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']); $this->server->on('afterMethod:GET', [$this,'httpGet']); - $this->server->on('afterMethod:GET', array($this, 'handleDownloadToken')); + $this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']); $this->server->on('afterResponse', function($request, ResponseInterface $response) { $body = $response->getBody(); if (is_resource($body)) { diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 41de6ea4ed8f8..a2de82fa9c541 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -154,7 +154,7 @@ public function initialize(\Sabre\DAV\Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $this->server = $server; - $this->server->on('report', array($this, 'onReport')); + $this->server->on('report', [$this, 'onReport']); } /** diff --git a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php index d015bcbc21cdc..4076abe59feb3 100644 --- a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php +++ b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php @@ -67,7 +67,7 @@ public function __construct(IConfig $config = null) { */ public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('beforeMethod', array($this, 'checkMaintenanceMode'), 1); + $this->server->on('beforeMethod', [$this, 'checkMaintenanceMode'], 1); } /** diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index f178b2fbfbdfe..5f9ecf8814259 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -200,15 +200,15 @@ public function getETag() { * @return int file id of updated file or -1 on failure */ public function setETag($etag) { - return $this->fileView->putFileInfo($this->path, array('etag' => $etag)); + return $this->fileView->putFileInfo($this->path, ['etag' => $etag]); } public function setCreationTime(int $time) { - return $this->fileView->putFileInfo($this->path, array('creation_time' => $time)); + return $this->fileView->putFileInfo($this->path, ['creation_time' => $time]); } public function setUploadTime(int $time) { - return $this->fileView->putFileInfo($this->path, array('upload_time' => $time)); + return $this->fileView->putFileInfo($this->path, ['upload_time' => $time]); } /** diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index a4baa65948e1b..9d543e55a4b65 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -107,7 +107,7 @@ public function initialize(\Sabre\DAV\Server $server) { $server->protectedProperties[] = self::SHAREES_PROPERTYNAME; $this->server = $server; - $this->server->on('propFind', array($this, 'handleGetProperties')); + $this->server->on('propFind', [$this, 'handleGetProperties']); } private function getShare(\OCP\Files\Node $node): array { diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index fe19b434648e8..2ac7c01f42678 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -98,7 +98,7 @@ public function __construct(\Sabre\DAV\Tree $tree, \OCP\ITagManager $tagManager) $this->tree = $tree; $this->tagManager = $tagManager; $this->tagger = null; - $this->cachedTags = array(); + $this->cachedTags = []; } /** @@ -118,8 +118,8 @@ public function initialize(\Sabre\DAV\Server $server) { $server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class; $this->server = $server; - $this->server->on('propFind', array($this, 'handleGetProperties')); - $this->server->on('propPatch', array($this, 'handleUpdateProperties')); + $this->server->on('propFind', [$this, 'handleGetProperties']); + $this->server->on('propPatch', [$this, 'handleUpdateProperties']); } /** @@ -151,7 +151,7 @@ private function getTagsAndFav($fileId) { unset($tags[$favPos]); } } - return array($tags, $isFav); + return [$tags, $isFav]; } /** @@ -164,10 +164,10 @@ private function getTags($fileId) { if (isset($this->cachedTags[$fileId])) { return $this->cachedTags[$fileId]; } else { - $tags = $this->getTagger()->getTagsForObjects(array($fileId)); + $tags = $this->getTagger()->getTagsForObjects([$fileId]); if ($tags !== false) { if (empty($tags)) { - return array(); + return []; } return current($tags); } @@ -232,7 +232,7 @@ public function handleGetProperties( $tags = $this->getTagger()->getTagsForObjects($fileIds); if ($tags === false) { // the tags API returns false on error... - $tags = array(); + $tags = []; } $this->cachedTags = $this->cachedTags + $tags; diff --git a/apps/dav/lib/Files/BrowserErrorPagePlugin.php b/apps/dav/lib/Files/BrowserErrorPagePlugin.php index 9bc169601afdf..7b0d39f2fbbd5 100644 --- a/apps/dav/lib/Files/BrowserErrorPagePlugin.php +++ b/apps/dav/lib/Files/BrowserErrorPagePlugin.php @@ -48,7 +48,7 @@ class BrowserErrorPagePlugin extends ServerPlugin { */ function initialize(Server $server) { $this->server = $server; - $server->on('exception', array($this, 'logException'), 1000); + $server->on('exception', [$this, 'logException'], 1000); } /** diff --git a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php index b940fa55b5b8d..f580b7fe47acb 100644 --- a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php +++ b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php @@ -88,7 +88,7 @@ protected function removeOrphanChildren($childTable, $parentTable, $parentId): i $result = $qb->execute(); - $orphanItems = array(); + $orphanItems = []; while ($row = $result->fetch()) { $orphanItems[] = (int) $row['id']; } diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index c86f621a67d8a..d44b21b24c977 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -107,8 +107,8 @@ public function initialize(\Sabre\DAV\Server $server) { $server->protectedProperties[] = self::ID_PROPERTYNAME; - $server->on('propFind', array($this, 'handleGetProperties')); - $server->on('propPatch', array($this, 'handleUpdateProperties')); + $server->on('propFind', [$this, 'handleGetProperties']); + $server->on('propPatch', [$this, 'handleUpdateProperties']); $server->on('method:POST', [$this, 'httpPost']); $this->server = $server; diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 257c6665dfefa..cc942b5662c50 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -130,7 +130,7 @@ public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead, $l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function ($text, $parameters = array()) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 9a9f36c930922..42cbeb1c0b971 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -53,7 +53,7 @@ protected function setUp(): void { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function ($text, $parameters = array()) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); } diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php index 5cd4e69b7f5ae..518c0b9402a89 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php @@ -97,9 +97,9 @@ protected function tearDown(): void { ' WHERE `userid` = ?' ); $deleteStatement->execute( - array( + [ $this->user->getUID(), - ) + ] ); $deleteStatement->closeCursor(); } @@ -121,10 +121,10 @@ private function createTestNode($class) { private function applyDefaultProps($path = '/dummypath') { // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ 'customprop' => 'value1', 'customprop2' => 'value2', - )); + ]); $this->plugin->propPatch( $path, @@ -146,11 +146,11 @@ private function applyDefaultProps($path = '/dummypath') { public function testPropFindMissingFileSoftFail() { $propFind = new \Sabre\DAV\PropFind( '/dummypath', - array( + [ 'customprop', 'customprop2', 'unsetprop', - ), + ], 0 ); @@ -176,11 +176,11 @@ public function testSetGetPropertiesForFile() { $propFind = new \Sabre\DAV\PropFind( '/dummypath', - array( + [ 'customprop', 'customprop2', 'unsetprop', - ), + ], 0 ); @@ -191,7 +191,7 @@ public function testSetGetPropertiesForFile() { $this->assertEquals('value1', $propFind->get('customprop')); $this->assertEquals('value2', $propFind->get('customprop2')); - $this->assertEquals(array('unsetprop'), $propFind->get404Properties()); + $this->assertEquals(['unsetprop'], $propFind->get404Properties()); } /** @@ -201,11 +201,11 @@ public function testGetPropertiesForDirectory() { $this->applyDefaultProps('/dummypath'); $this->applyDefaultProps('/dummypath/test.txt'); - $propNames = array( + $propNames = [ 'customprop', 'customprop2', 'unsetprop', - ); + ]; $propFindRoot = new \Sabre\DAV\PropFind( '/dummypath', @@ -234,11 +234,11 @@ public function testGetPropertiesForDirectory() { $this->assertEquals('value1', $propFindRoot->get('customprop')); $this->assertEquals('value2', $propFindRoot->get('customprop2')); - $this->assertEquals(array('unsetprop'), $propFindRoot->get404Properties()); + $this->assertEquals(['unsetprop'], $propFindRoot->get404Properties()); $this->assertEquals('value1', $propFindSub->get('customprop')); $this->assertEquals('value2', $propFindSub->get('customprop2')); - $this->assertEquals(array('unsetprop'), $propFindSub->get404Properties()); + $this->assertEquals(['unsetprop'], $propFindSub->get404Properties()); } /** @@ -247,9 +247,9 @@ public function testGetPropertiesForDirectory() { public function testDeleteProperty() { $this->applyDefaultProps(); - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ 'customprop' => null, - )); + ]); $this->plugin->propPatch( '/dummypath', diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 1bf0b53396652..9ace061fd0ede 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -201,7 +201,7 @@ public function testGetChildren() { $this->view->expects($this->once()) ->method('getDirectoryContent') ->with('') - ->willReturn(array($info1, $info2)); + ->willReturn([$info1, $info2]); $this->view->expects($this->any()) ->method('getRelativePath') diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 96f5a2c385c95..a898ba5dee7c2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -202,9 +202,9 @@ function ($path) use ($storage) { ->method('getRelativePath') ->willReturnArgument(0); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -631,10 +631,10 @@ public function testPutOverwriteChunkedFileTriggersHooks() { } public static function cancellingHook($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_create, 'params' => $params - ); + ]; } /** @@ -683,9 +683,9 @@ public function testSimplePutFailsSizeCheck() { $_SERVER['CONTENT_LENGTH'] = 123456; $_SERVER['REQUEST_METHOD'] = 'PUT'; - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -716,9 +716,9 @@ public function testSimplePutFailsMoveFromStorage() { // simulate situation where the target file is locked $view->lockFile('/test.txt', ILockingProvider::LOCK_EXCLUSIVE); - $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -790,9 +790,9 @@ public function testSimplePutInvalidChars() { ->method('getRelativePath') ->willReturnArgument(0); - $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action @@ -829,9 +829,9 @@ public function testSetNameInvalidChars() { ->method('getRelativePath') ->willReturnArgument(0); - $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $file->setName('/super*star.txt'); } @@ -856,9 +856,9 @@ public function testUploadAbort() { $_SERVER['CONTENT_LENGTH'] = 12345; $_SERVER['REQUEST_METHOD'] = 'PUT'; - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -890,9 +890,9 @@ public function testDeleteWhenAllowed() { ->method('unlink') ->willReturn(true); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -908,9 +908,9 @@ public function testDeleteThrowsWhenDeletionNotAllowed() { $view = $this->getMockBuilder(View::class) ->getMock(); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => 0 - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -931,9 +931,9 @@ public function testDeleteThrowsWhenDeletionFailed() { ->method('unlink') ->willReturn(false); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -954,9 +954,9 @@ public function testDeleteThrowsWhenDeletionThrows() { ->method('unlink') ->willThrowException(new ForbiddenException('', true)); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -1122,9 +1122,9 @@ public function testGetFopenFails() { ->method('fopen') ->willReturn(false); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -1142,9 +1142,9 @@ public function testGetFopenThrows() { ->method('fopen') ->willThrowException(new ForbiddenException('', true)); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index d1e863b18bac4..06495ccd5e2a3 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -181,7 +181,7 @@ public function testGetPropertiesForFile() { $propFind = new PropFind( '/dummyPath', - array( + [ self::GETETAG_PROPERTYNAME, self::FILEID_PROPERTYNAME, self::INTERNAL_FILEID_PROPERTYNAME, @@ -191,7 +191,7 @@ public function testGetPropertiesForFile() { self::OWNER_ID_PROPERTYNAME, self::OWNER_DISPLAY_NAME_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME, - ), + ], 0 ); @@ -208,7 +208,7 @@ public function testGetPropertiesForFile() { $node->expects($this->once()) ->method('getDirectDownload') - ->willReturn(array('url' => 'http://example.com/')); + ->willReturn(['url' => 'http://example.com/']); $node->expects($this->exactly(2)) ->method('getOwner') ->willReturn($user); @@ -236,9 +236,9 @@ public function testGetPropertiesStorageNotAvailable() { $propFind = new PropFind( '/dummyPath', - array( + [ self::DOWNLOADURL_PROPERTYNAME, - ), + ], 0 ); @@ -293,14 +293,14 @@ public function testGetPropertiesForDirectory() { $propFind = new PropFind( '/dummyPath', - array( + [ self::GETETAG_PROPERTYNAME, self::FILEID_PROPERTYNAME, self::SIZE_PROPERTYNAME, self::PERMISSIONS_PROPERTYNAME, self::DOWNLOADURL_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME, - ), + ], 0 ); @@ -405,10 +405,10 @@ public function testUpdateProps() { ->willReturn(true); // properties to set - $propPatch = new PropPatch(array( + $propPatch = new PropPatch([ self::GETETAG_PROPERTYNAME => 'newetag', self::LASTMODIFIED_PROPERTYNAME => $testDate - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -425,14 +425,14 @@ public function testUpdateProps() { } public function testUpdatePropsForbidden() { - $propPatch = new PropPatch(array( + $propPatch = new PropPatch([ self::OWNER_ID_PROPERTYNAME => 'user2', self::OWNER_DISPLAY_NAME_PROPERTYNAME => 'User Two', self::FILEID_PROPERTYNAME => 12345, self::PERMISSIONS_PROPERTYNAME => 'C', self::SIZE_PROPERTYNAME => 123, self::DOWNLOADURL_PROPERTYNAME => 'http://example.com/', - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -588,9 +588,9 @@ public function testHasPreview() { $propFind = new PropFind( '/dummyPath', - array( + [ self::HAS_PREVIEW_PROPERTYNAME - ), + ], 0 ); diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index 5d71a705362f6..93542f803686a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -42,19 +42,19 @@ */ class NodeTest extends \Test\TestCase { public function davPermissionsProvider() { - return array( - array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RGDNVW'), - array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RGDNVCK'), - array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRGDNVW'), - array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMGDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SGDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RGD'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RGNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RGDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'file', false, false, 'RDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RGDNV'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'dir', false, false, 'RDNVCK'), - ); + return [ + [\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RGDNVW'], + [\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RGDNVCK'], + [\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRGDNVW'], + [\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMGDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SGDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RGD'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RGNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RGDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'file', false, false, 'RDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RGDNV'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'dir', false, false, 'RDNVCK'], + ]; } /** @@ -63,7 +63,7 @@ public function davPermissionsProvider() { public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) { $info = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() - ->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType')) + ->setMethods(['getPermissions', 'isShared', 'isMounted', 'getType']) ->getMock(); $info->expects($this->any()) ->method('getPermissions') diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 76ebbe301893b..3a2c8d8c438fc 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -201,72 +201,72 @@ public function testGetNodeForPath( } function nodeForPathProvider() { - return array( + return [ // regular file - array( + [ 'regularfile.txt', 'regularfile.txt', 'regularfile.txt', 'file', false - ), + ], // regular directory - array( + [ 'regulardir', 'regulardir', 'regulardir', 'dir', false - ), + ], // regular file with chunking - array( + [ 'regularfile.txt', 'regularfile.txt', 'regularfile.txt', 'file', true - ), + ], // regular directory with chunking - array( + [ 'regulardir', 'regulardir', 'regulardir', 'dir', true - ), + ], // file with chunky file name - array( + [ 'regularfile.txt-chunking-123566789-10-1', 'regularfile.txt', 'regularfile.txt', 'file', true - ), + ], // regular file in subdir - array( + [ 'subdir/regularfile.txt', 'subdir/regularfile.txt', 'regularfile.txt', 'file', false - ), + ], // regular directory in subdir - array( + [ 'subdir/regulardir', 'subdir/regulardir', 'regulardir', 'dir', false - ), + ], // file with chunky file name in subdir - array( + [ 'subdir/regularfile.txt-chunking-123566789-10-1', 'subdir/regularfile.txt', 'regularfile.txt', 'file', true - ), - ); + ], + ]; } diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 57613c19f6466..55528a0f87f19 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -410,7 +410,7 @@ public function testSetGroupMembershipProxy() { } public function testUpdatePrincipal() { - $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch(array()))); + $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([]))); } public function testSearchPrincipalsWithEmptySearchProperties() { diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php index 50b3ff1c394df..d7554741fc076 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -112,30 +112,30 @@ public function testCheckQuotaOnPath($quota, $headers) { } public function quotaOkayProvider() { - return array( - array(1024, array()), - array(1024, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(1024, array('CONTENT-LENGTH' => '512')), - array(1024, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - - array(FileInfo::SPACE_UNKNOWN, array()), - array(FileInfo::SPACE_UNKNOWN, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(FileInfo::SPACE_UNKNOWN, array('CONTENT-LENGTH' => '512')), - array(FileInfo::SPACE_UNKNOWN, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - - array(FileInfo::SPACE_UNLIMITED, array()), - array(FileInfo::SPACE_UNLIMITED, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(FileInfo::SPACE_UNLIMITED, array('CONTENT-LENGTH' => '512')), - array(FileInfo::SPACE_UNLIMITED, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - ); + return [ + [1024, []], + [1024, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [1024, ['CONTENT-LENGTH' => '512']], + [1024, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + + [FileInfo::SPACE_UNKNOWN, []], + [FileInfo::SPACE_UNKNOWN, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [FileInfo::SPACE_UNKNOWN, ['CONTENT-LENGTH' => '512']], + [FileInfo::SPACE_UNKNOWN, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + + [FileInfo::SPACE_UNLIMITED, []], + [FileInfo::SPACE_UNLIMITED, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [FileInfo::SPACE_UNLIMITED, ['CONTENT-LENGTH' => '512']], + [FileInfo::SPACE_UNLIMITED, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + ]; } public function quotaExceededProvider() { - return array( - array(1023, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(511, array('CONTENT-LENGTH' => '512')), - array(2047, array('OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024')), - ); + return [ + [1023, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [511, ['CONTENT-LENGTH' => '512']], + [2047, ['OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024']], + ]; } public function lengthProvider() { @@ -155,22 +155,22 @@ public function lengthProvider() { } public function quotaChunkedOkProvider() { - return array( - array(1024, 0, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(1024, 0, array('CONTENT-LENGTH' => '512')), - array(1024, 0, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), + return [ + [1024, 0, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [1024, 0, ['CONTENT-LENGTH' => '512']], + [1024, 0, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], // with existing chunks (allowed size = total length - chunk total size) - array(400, 128, array('X-EXPECTED-ENTITY-LENGTH' => '512')), - array(400, 128, array('CONTENT-LENGTH' => '512')), - array(400, 128, array('OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500')), + [400, 128, ['X-EXPECTED-ENTITY-LENGTH' => '512']], + [400, 128, ['CONTENT-LENGTH' => '512']], + [400, 128, ['OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500']], // \OCP\Files\FileInfo::SPACE-UNKNOWN = -2 - array(-2, 0, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(-2, 0, array('CONTENT-LENGTH' => '512')), - array(-2, 0, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - array(-2, 128, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(-2, 128, array('CONTENT-LENGTH' => '512')), - array(-2, 128, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - ); + [-2, 0, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [-2, 0, ['CONTENT-LENGTH' => '512']], + [-2, 0, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + [-2, 128, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [-2, 128, ['CONTENT-LENGTH' => '512']], + [-2, 128, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + ]; } /** @@ -197,15 +197,15 @@ public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) { } public function quotaChunkedFailProvider() { - return array( - array(400, 0, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(400, 0, array('CONTENT-LENGTH' => '512')), - array(400, 0, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), + return [ + [400, 0, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [400, 0, ['CONTENT-LENGTH' => '512']], + [400, 0, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], // with existing chunks (allowed size = total length - chunk total size) - array(380, 128, array('X-EXPECTED-ENTITY-LENGTH' => '512')), - array(380, 128, array('CONTENT-LENGTH' => '512')), - array(380, 128, array('OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500')), - ); + [380, 128, ['X-EXPECTED-ENTITY-LENGTH' => '512']], + [380, 128, ['CONTENT-LENGTH' => '512']], + [380, 128, ['OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500']], + ]; } /** diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index c1eaaae42c3ba..c0450d3bbb653 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -108,8 +108,8 @@ public function testGetProperties($tags, $requestedProperties, $expectedProperti $this->tagger->expects($this->exactly($expectedCallCount)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123))) - ->willReturn(array(123 => $tags)); + ->with($this->equalTo([123])) + ->willReturn([123 => $tags]); $propFind = new \Sabre\DAV\PropFind( '/dummyPath', @@ -162,16 +162,16 @@ public function testPreloadThenGetProperties($tags, $requestedProperties, $expec ->willReturn(123); $node->expects($this->exactly($expectedCallCount)) ->method('getChildren') - ->willReturn(array($node1, $node2)); + ->willReturn([$node1, $node2]); $this->tagger->expects($this->exactly($expectedCallCount)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123, 111, 222))) + ->with($this->equalTo([123, 111, 222])) ->willReturn( - array( + [ 111 => $tags, 123 => $tags - ) + ] ); // simulate sabre recursive PROPFIND traversal @@ -212,58 +212,58 @@ public function testPreloadThenGetProperties($tags, $requestedProperties, $expec } function tagsGetPropertiesDataProvider() { - return array( + return [ // request both, receive both - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME), - array( - 200 => array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2')), + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME], + [ + 200 => [ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']), self::FAVORITE_PROPERTYNAME => true, - ) - ) - ), + ] + ] + ], // request tags alone - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(self::TAGS_PROPERTYNAME), - array( - 200 => array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2')), - ) - ) - ), + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [self::TAGS_PROPERTYNAME], + [ + 200 => [ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']), + ] + ] + ], // request fav alone - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(self::FAVORITE_PROPERTYNAME), - array( - 200 => array( + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [self::FAVORITE_PROPERTYNAME], + [ + 200 => [ self::FAVORITE_PROPERTYNAME => true, - ) - ) - ), + ] + ] + ], // request none - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(), - array( - 200 => array() - ), - ), + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [], + [ + 200 => [] + ], + ], // request both with none set, receive both - array( - array(), - array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME), - array( - 200 => array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array()), + [ + [], + [self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME], + [ + 200 => [ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList([]), self::FAVORITE_PROPERTYNAME => false, - ) - ) - ), - ); + ] + ] + ], + ]; } public function testUpdateTags() { @@ -283,8 +283,8 @@ public function testUpdateTags() { $this->tagger->expects($this->at(0)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123))) - ->willReturn(array(123 => array('tagkeep', 'tagremove', self::TAG_FAVORITE))); + ->with($this->equalTo([123])) + ->willReturn([123 => ['tagkeep', 'tagremove', self::TAG_FAVORITE]]); // then tag as tag1 and tag2 $this->tagger->expects($this->at(1)) @@ -300,9 +300,9 @@ public function testUpdateTags() { ->with(123, 'tagremove'); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) - )); + $propPatch = new \Sabre\DAV\PropPatch([ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2', 'tagkeep']) + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -334,8 +334,8 @@ public function testUpdateTagsFromScratch() { $this->tagger->expects($this->at(0)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123))) - ->willReturn(array()); + ->with($this->equalTo([123])) + ->willReturn([]); // then tag as tag1 and tag2 $this->tagger->expects($this->at(1)) @@ -346,9 +346,9 @@ public function testUpdateTagsFromScratch() { ->with(123, 'tag2'); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) - )); + $propPatch = new \Sabre\DAV\PropPatch([ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2', 'tagkeep']) + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -386,9 +386,9 @@ public function testUpdateFav() { ->with(123, self::TAG_FAVORITE); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::FAVORITE_PROPERTYNAME => true - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -411,9 +411,9 @@ public function testUpdateFav() { ->with(123, self::TAG_FAVORITE); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::FAVORITE_PROPERTYNAME => false - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', diff --git a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php index 08239dfd46aca..6a78c2a0862de 100644 --- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php +++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php @@ -184,7 +184,7 @@ public function testSetGroupMembership() { } public function testUpdatePrincipal() { - $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch(array()))); + $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([]))); } public function testSearchPrincipalsWithEmptySearchProperties() { diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index f634c71709301..ecd65e7587c0d 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -308,12 +308,12 @@ public function testUpdatePropertiesAdmin() { ->with($systemTag, ['group1', 'group2']); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::DISPLAYNAME_PROPERTYNAME => 'Test changed', self::USERVISIBLE_PROPERTYNAME => 'false', self::USERASSIGNABLE_PROPERTYNAME => 'true', self::GROUPS_PROPERTYNAME => 'group1|group2', - )); + ]); $this->plugin->handleUpdateProperties( '/systemtag/1', @@ -364,9 +364,9 @@ public function testUpdatePropertiesForbidden() { ->method('setTagGroups'); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::GROUPS_PROPERTYNAME => 'group1|group2', - )); + ]); $this->plugin->handleUpdateProperties( '/systemtag/1', diff --git a/apps/encryption/lib/AppInfo/Application.php b/apps/encryption/lib/AppInfo/Application.php index 6d7c00687e303..745dfe59aa710 100644 --- a/apps/encryption/lib/AppInfo/Application.php +++ b/apps/encryption/lib/AppInfo/Application.php @@ -58,7 +58,7 @@ class Application extends \OCP\AppFramework\App { /** * @param array $urlParams */ - public function __construct($urlParams = array()) { + public function __construct($urlParams = []) { parent::__construct('encryption', $urlParams); $this->encryptionManager = \OC::$server->getEncryptionManager(); $this->config = \OC::$server->getConfig(); diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php index 4865f06277ef0..1820140337c8b 100644 --- a/apps/encryption/lib/Crypto/EncryptAll.php +++ b/apps/encryption/lib/Crypto/EncryptAll.php @@ -120,7 +120,7 @@ public function __construct( $this->questionHelper = $questionHelper; $this->secureRandom = $secureRandom; // store one time passwords for the users - $this->userPasswords = array(); + $this->userPasswords = []; } /** @@ -265,7 +265,7 @@ protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) { protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) { $this->setupUserFS($uid); - $directories = array(); + $directories = []; $directories[] = '/' . $uid . '/files'; while($root = array_pop($directories)) { @@ -322,11 +322,11 @@ protected function encryptFile($path) { */ protected function outputPasswords() { $table = new Table($this->output); - $table->setHeaders(array('Username', 'Private key password')); + $table->setHeaders(['Username', 'Private key password']); //create rows - $newPasswords = array(); - $unchangedPasswords = array(); + $newPasswords = []; + $unchangedPasswords = []; foreach ($this->userPasswords as $uid => $password) { if (empty($password)) { $unchangedPasswords[] = $uid; @@ -451,7 +451,7 @@ protected function sendPasswordsByMail() { $this->output->writeln("\n\nPassword successfully send to all users"); } else { $table = new Table($this->output); - $table->setHeaders(array('Username', 'Private key password')); + $table->setHeaders(['Username', 'Private key password']); $this->output->writeln("\n\nCould not send password to following users:\n"); $rows = []; foreach ($noMail as $uid) { diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php index 8b5ec5e1e0596..edeb04ce8572b 100644 --- a/apps/encryption/lib/Crypto/Encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php @@ -236,7 +236,7 @@ public function begin($path, $user, $mode, array $header, array $accessList) { $this->cipher = $this->crypt->getLegacyCipher(); } - return array('cipher' => $this->cipher, 'signed' => 'true'); + return ['cipher' => $this->cipher, 'signed' => 'true']; } /** @@ -266,7 +266,7 @@ public function end($path, $position = 0) { $result = $this->crypt->symmetricEncryptFileContent($this->writeCache, $this->fileKey, $this->version + 1, $position); $this->writeCache = ''; } - $publicKeys = array(); + $publicKeys = []; if ($this->useMasterPassword === true) { $publicKeys[$this->keyManager->getMasterKeyId()] = $this->keyManager->getPublicMasterKey(); } else { @@ -402,7 +402,7 @@ public function update($path, $uid, array $accessList) { if (!empty($fileKey)) { - $publicKeys = array(); + $publicKeys = []; if ($this->useMasterPassword === true) { $publicKeys[$this->keyManager->getMasterKeyId()] = $this->keyManager->getPublicMasterKey(); } else { @@ -425,7 +425,7 @@ public function update($path, $uid, array $accessList) { } else { $this->logger->debug('no file key found, we assume that the file "{file}" is not encrypted', - array('file' => $path, 'app' => 'encryption')); + ['file' => $path, 'app' => 'encryption']); return false; } diff --git a/apps/encryption/lib/Recovery.php b/apps/encryption/lib/Recovery.php index d586d330237ee..335e6c13d7371 100644 --- a/apps/encryption/lib/Recovery.php +++ b/apps/encryption/lib/Recovery.php @@ -213,7 +213,7 @@ private function addRecoveryKeys($path) { $fileKey = $this->keyManager->getFileKey($filePath, $this->user->getUID()); if (!empty($fileKey)) { $accessList = $this->file->getAccessList($filePath); - $publicKeys = array(); + $publicKeys = []; foreach ($accessList['users'] as $uid) { $publicKeys[$uid] = $this->keyManager->getPublicKey($uid); } @@ -299,7 +299,7 @@ private function recoverFile($path, $privateKey, $uid) { if (!empty($fileKey)) { $accessList = $this->file->getAccessList($path); - $publicKeys = array(); + $publicKeys = []; foreach ($accessList['users'] as $user) { $publicKeys[$user] = $this->keyManager->getPublicKey($user); } diff --git a/apps/encryption/templates/altmail.php b/apps/encryption/templates/altmail.php index a5b1512aadacc..dde85e0af14c4 100644 --- a/apps/encryption/templates/altmail.php +++ b/apps/encryption/templates/altmail.php @@ -2,9 +2,9 @@ /** @var OC_Theme $theme */ /** @var array $_ */ -print_unescaped($l->t("Hey there,\n\nthe admin enabled server-side-encryption. Your files were encrypted using the password '%s'.\n\nPlease login to the web interface, go to the section 'basic encryption module' of your personal settings and update your encryption password by entering this password into the 'old log-in password' field and your current login-password.\n\n", array($_['password']))); +print_unescaped($l->t("Hey there,\n\nthe admin enabled server-side-encryption. Your files were encrypted using the password '%s'.\n\nPlease login to the web interface, go to the section 'basic encryption module' of your personal settings and update your encryption password by entering this password into the 'old log-in password' field and your current login-password.\n\n", [$_['password']])); if ( isset($_['expiration']) ) { - print_unescaped($l->t("The share will expire on %s.", array($_['expiration']))); + print_unescaped($l->t("The share will expire on %s.", [$_['expiration']])); print_unescaped("\n\n"); } // TRANSLATORS term at the end of a mail diff --git a/apps/encryption/templates/mail.php b/apps/encryption/templates/mail.php index 6e9f9885d33e3..1241cfd9f6219 100644 --- a/apps/encryption/templates/mail.php +++ b/apps/encryption/templates/mail.php @@ -15,7 +15,7 @@   t('Hey there,

the admin enabled server-side-encryption. Your files were encrypted using the password %s.

Please login to the web interface, go to the section "basic encryption module" of your personal settings and update your encryption password by entering this password into the "old log-in password" field and your current login-password.

', array($_['password']))); + print_unescaped($l->t('Hey there,

the admin enabled server-side-encryption. Your files were encrypted using the password %s.

Please login to the web interface, go to the section "basic encryption module" of your personal settings and update your encryption password by entering this password into the "old log-in password" field and your current login-password.

', [$_['password']])); // TRANSLATORS term at the end of a mail p($l->t('Cheers!')); ?> diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index 7428b3fe1afb7..31b61ee066442 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -80,7 +80,7 @@ public function testGetOpenSSLConfigBasic() { $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('openssl'), $this->equalTo([])) - ->willReturn(array()); + ->willReturn([]); $result = self::invokePrivate($this->crypt, 'getOpenSSLConfig'); $this->assertSame(1, count($result)); @@ -96,7 +96,7 @@ public function testGetOpenSSLConfig() { $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('openssl'), $this->equalTo([])) - ->willReturn(array('foo' => 'bar', 'private_key_bits' => 1028)); + ->willReturn(['foo' => 'bar', 'private_key_bits' => 1028]); $result = self::invokePrivate($this->crypt, 'getOpenSSLConfig'); $this->assertSame(2, count($result)); @@ -185,14 +185,14 @@ public function testGetCipher($configValue, $expected) { * @return array */ public function dataProviderGetCipher() { - return array( - array('AES-128-CFB', 'AES-128-CFB'), - array('AES-256-CFB', 'AES-256-CFB'), - array('AES-128-CTR', 'AES-128-CTR'), - array('AES-256-CTR', 'AES-256-CTR'), + return [ + ['AES-128-CFB', 'AES-128-CFB'], + ['AES-256-CFB', 'AES-256-CFB'], + ['AES-128-CTR', 'AES-128-CTR'], + ['AES-256-CTR', 'AES-256-CTR'], - array('unknown', 'AES-256-CTR') - ); + ['unknown', 'AES-256-CTR'] + ]; } /** @@ -203,7 +203,7 @@ public function testConcatIV() { $result = self::invokePrivate( $this->crypt, 'concatIV', - array('content', 'my_iv')); + ['content', 'my_iv']); $this->assertSame('content00iv00my_iv', $result @@ -214,7 +214,7 @@ public function testConcatIV() { * @dataProvider dataTestSplitMetaData */ public function testSplitMetaData($data, $expected) { - $result = self::invokePrivate($this->crypt, 'splitMetaData', array($data, 'AES-256-CFB')); + $result = self::invokePrivate($this->crypt, 'splitMetaData', [$data, 'AES-256-CFB']); $this->assertTrue(is_array($result)); $this->assertSame(3, count($result)); $this->assertArrayHasKey('encrypted', $result); @@ -239,7 +239,7 @@ public function dataTestSplitMetaData() { */ public function testHasSignature($data, $expected) { $this->assertSame($expected, - $this->invokePrivate($this->crypt, 'hasSignature', array($data, 'AES-256-CFB')) + $this->invokePrivate($this->crypt, 'hasSignature', [$data, 'AES-256-CFB']) ); } @@ -257,7 +257,7 @@ public function testHasSignatureFail($cipher) { $this->expectException(\OCP\Encryption\Exceptions\GenericEncryptionException::class); $data = 'encryptedContent00iv001234567890123456xx'; - $this->invokePrivate($this->crypt, 'hasSignature', array($data, $cipher)); + $this->invokePrivate($this->crypt, 'hasSignature', [$data, $cipher]); } public function dataTestHasSignatureFail() { @@ -273,7 +273,7 @@ public function dataTestHasSignatureFail() { * test addPadding() */ public function testAddPadding() { - $result = self::invokePrivate($this->crypt, 'addPadding', array('data')); + $result = self::invokePrivate($this->crypt, 'addPadding', ['data']); $this->assertSame('dataxxx', $result); } @@ -285,7 +285,7 @@ public function testAddPadding() { * @param $expected */ public function testRemovePadding($data, $expected) { - $result = self::invokePrivate($this->crypt, 'removePadding', array($data)); + $result = self::invokePrivate($this->crypt, 'removePadding', [$data]); $this->assertSame($expected, $result); } @@ -295,10 +295,10 @@ public function testRemovePadding($data, $expected) { * @return array */ public function dataProviderRemovePadding() { - return array( - array('dataxx', 'data'), - array('data', false) - ); + return [ + ['dataxx', 'data'], + ['data', false] + ]; } /** @@ -307,7 +307,7 @@ public function dataProviderRemovePadding() { public function testParseHeader() { $header= 'HBEGIN:foo:bar:cipher:AES-256-CFB:HEND'; - $result = self::invokePrivate($this->crypt, 'parseHeader', array($header)); + $result = self::invokePrivate($this->crypt, 'parseHeader', [$header]); $this->assertTrue(is_array($result)); $this->assertSame(2, count($result)); @@ -331,15 +331,15 @@ public function testEncrypt() { $this->assertTrue(is_string($iv)); $this->assertSame(16, strlen($iv)); - $result = self::invokePrivate($this->crypt, 'encrypt', array($decrypted, $iv, $password)); + $result = self::invokePrivate($this->crypt, 'encrypt', [$decrypted, $iv, $password]); $this->assertTrue(is_string($result)); - return array( + return [ 'password' => $password, 'iv' => $iv, 'encrypted' => $result, - 'decrypted' => $decrypted); + 'decrypted' => $decrypted]; } @@ -353,7 +353,7 @@ public function testDecrypt($data) { $result = self::invokePrivate( $this->crypt, 'decrypt', - array($data['encrypted'], $data['iv'], $data['password'])); + [$data['encrypted'], $data['iv'], $data['password']]); $this->assertSame($data['decrypted'], $result); diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index 9a541880e7909..cebb27580e2e2 100644 --- a/apps/encryption/tests/Crypto/EncryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -124,7 +124,7 @@ protected function setUp(): void { * test if public key from one of the recipients is missing */ public function testEndUser1() { - $this->instance->begin('/foo/bar', 'user1', 'r', array(), array('users' => array('user1', 'user2', 'user3'))); + $this->instance->begin('/foo/bar', 'user1', 'r', [], ['users' => ['user1', 'user2', 'user3']]); $this->endTest(); } @@ -135,7 +135,7 @@ public function testEndUser1() { public function testEndUser2() { $this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class); - $this->instance->begin('/foo/bar', 'user2', 'r', array(), array('users' => array('user1', 'user2', 'user3'))); + $this->instance->begin('/foo/bar', 'user2', 'r', [], ['users' => ['user1', 'user2', 'user3']]); $this->endTest(); } @@ -182,17 +182,17 @@ public function addSystemKeysCallback($accessList, $publicKeys) { */ public function testGetPathToRealFile($path, $expected) { $this->assertSame($expected, - self::invokePrivate($this->instance, 'getPathToRealFile', array($path)) + self::invokePrivate($this->instance, 'getPathToRealFile', [$path]) ); } public function dataProviderForTestGetPathToRealFile() { - return array( - array('/user/files/foo/bar.txt', '/user/files/foo/bar.txt'), - array('/user/files/foo.txt', '/user/files/foo.txt'), - array('/user/files_versions/foo.txt.v543534', '/user/files/foo.txt'), - array('/user/files_versions/foo/bar.txt.v5454', '/user/files/foo/bar.txt'), - ); + return [ + ['/user/files/foo/bar.txt', '/user/files/foo/bar.txt'], + ['/user/files/foo.txt', '/user/files/foo.txt'], + ['/user/files_versions/foo.txt.v543534', '/user/files/foo.txt'], + ['/user/files_versions/foo/bar.txt.v5454', '/user/files/foo/bar.txt'], + ]; } /** @@ -241,12 +241,12 @@ public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKe } public function dataTestBegin() { - return array( - array('w', ['cipher' => 'myCipher'], 'legacyCipher', 'defaultCipher', 'fileKey', 'defaultCipher'), - array('r', ['cipher' => 'myCipher'], 'legacyCipher', 'defaultCipher', 'fileKey', 'myCipher'), - array('w', [], 'legacyCipher', 'defaultCipher', '', 'defaultCipher'), - array('r', [], 'legacyCipher', 'defaultCipher', 'file_key', 'legacyCipher'), - ); + return [ + ['w', ['cipher' => 'myCipher'], 'legacyCipher', 'defaultCipher', 'fileKey', 'defaultCipher'], + ['r', ['cipher' => 'myCipher'], 'legacyCipher', 'defaultCipher', 'fileKey', 'myCipher'], + ['w', [], 'legacyCipher', 'defaultCipher', '', 'defaultCipher'], + ['r', [], 'legacyCipher', 'defaultCipher', 'file_key', 'legacyCipher'], + ]; } @@ -335,10 +335,10 @@ public function testUpdate($fileKey, $expected) { } public function dataTestUpdate() { - return array( - array('', false), - array('fileKey', true) - ); + return [ + ['', false], + ['fileKey', true] + ]; } public function testUpdateNoUsers() { @@ -417,19 +417,19 @@ public function testShouldEncrypt($path, $shouldEncryptHomeStorage, $isHomeStora } public function dataTestShouldEncrypt() { - return array( - array('/user1/files/foo.txt', true, true, true), - array('/user1/files_versions/foo.txt', true, true, true), - array('/user1/files_trashbin/foo.txt', true, true, true), - array('/user1/some_folder/foo.txt', true, true, false), - array('/user1/foo.txt', true, true, false), - array('/user1/files', true, true, false), - array('/user1/files_trashbin', true, true, false), - array('/user1/files_versions', true, true, false), + return [ + ['/user1/files/foo.txt', true, true, true], + ['/user1/files_versions/foo.txt', true, true, true], + ['/user1/files_trashbin/foo.txt', true, true, true], + ['/user1/some_folder/foo.txt', true, true, false], + ['/user1/foo.txt', true, true, false], + ['/user1/files', true, true, false], + ['/user1/files_trashbin', true, true, false], + ['/user1/files_versions', true, true, false], // test if shouldEncryptHomeStorage is set to false - array('/user1/files/foo.txt', false, true, false), - array('/user1/files_versions/foo.txt', false, false, true), - ); + ['/user1/files/foo.txt', false, true, false], + ['/user1/files_versions/foo.txt', false, false, true], + ]; } diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php index a9886a0b9ec40..c7b9d62690e31 100644 --- a/apps/encryption/tests/KeyManagerTest.php +++ b/apps/encryption/tests/KeyManagerTest.php @@ -322,7 +322,7 @@ public function testSetRecoveryKey() { $this->assertTrue( $this->instance->setRecoveryKey('pass', - array('publicKey' => 'publicKey', 'privateKey' => 'privateKey')) + ['publicKey' => 'publicKey', 'privateKey' => 'privateKey']) ); } @@ -505,12 +505,12 @@ public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys) * @return array */ public function dataTestAddSystemKeys() { - return array( - array(['public' => true],[], 'user1', ['publicShareKey', 'recoveryKey']), - array(['public' => false], [], 'user1', ['recoveryKey']), - array(['public' => true],[], 'user2', ['publicShareKey']), - array(['public' => false], [], 'user2', []), - ); + return [ + [['public' => true],[], 'user1', ['publicShareKey', 'recoveryKey']], + [['public' => false], [], 'user1', ['recoveryKey']], + [['public' => true],[], 'user2', ['publicShareKey']], + [['public' => false], [], 'user2', []], + ]; } public function testGetMasterKeyId() { diff --git a/apps/federatedfilesharing/lib/AddressHandler.php b/apps/federatedfilesharing/lib/AddressHandler.php index 7a272781fe684..113978bab82eb 100644 --- a/apps/federatedfilesharing/lib/AddressHandler.php +++ b/apps/federatedfilesharing/lib/AddressHandler.php @@ -106,12 +106,12 @@ public function compareAddresses($user1, $server1, $user2, $server2) { \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/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 575e3cdff5702..5d44643899aef 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -187,7 +187,7 @@ public function create(IShare $share) { $alreadySharedGroup = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_REMOTE_GROUP, $share->getNode(), 1, 0); if (!empty($alreadyShared) || !empty($alreadySharedGroup)) { $message = 'Sharing %1$s failed, because this item is already shared with %2$s'; - $message_t = $this->l->t('Sharing %1$s failed, because this item is already shared with %2$s', array($share->getNode()->getName(), $shareWith)); + $message_t = $this->l->t('Sharing %1$s failed, because this item is already shared with %2$s', [$share->getNode()->getName(), $shareWith]); $this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']); throw new \Exception($message_t); } diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 5df2173263ca9..70cf11c7672df 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -99,7 +99,7 @@ public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ if ($user && $remote) { $local = $this->addressHandler->generateRemoteURL(); - $fields = array( + $fields = [ 'shareWith' => $user, 'token' => $token, 'name' => $name, @@ -110,7 +110,7 @@ public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ 'sharedByFederatedId' => $sharedByFederatedId, 'remote' => $local, 'shareType' => $shareType - ); + ]; $result = $this->tryHttpPostToShareEndpoint($remote, '', $fields); $status = json_decode($result['result'], true); @@ -144,12 +144,12 @@ public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ */ public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission, $filename) { - $fields = array( + $fields = [ 'shareWith' => $shareWith, 'token' => $token, 'permission' => $permission, 'remoteId' => $shareId, - ); + ]; $ocmFields = $fields; $ocmFields['remoteId'] = $id; diff --git a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php index e2e2f26ad3a83..c87d4e273fcf8 100644 --- a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php @@ -215,7 +215,7 @@ public function shareReceived(ICloudFederationShare $share) { Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', - array('uid' => &$shareWith) + ['uid' => &$shareWith] ); $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); @@ -774,7 +774,7 @@ private function getFile($user, $fileSource) { } catch (NotFoundException $e) { $file = null; } - $args = Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file); + $args = Filesystem::is_dir($file) ? ['dir' => $file] : ['dir' => dirname($file), 'scrollto' => $file]; $link = Util::linkToAbsolute('files', 'index.php', $args); return [$file, $link]; diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index d6a7bdaf2920f..f69bc4209d389 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -104,21 +104,21 @@ public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) { } public function dataTestSplitUserRemoteError() { - return array( + return [ // Invalid path - array('user@'), + ['user@'], // Invalid user - array('@server'), - array('us/er@server'), - array('us:er@server'), + ['@server'], + ['us/er@server'], + ['us:er@server'], // Invalid splitting - array('user'), - array(''), - array('us/erserver'), - array('us:erserver'), - ); + ['user'], + [''], + ['us/erserver'], + ['us:erserver'], + ]; } /** diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index 5b29175a83c1b..d5ea0f634f287 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -38,7 +38,7 @@ $files_list = json_decode($files); // in case we get only a single file if (!is_array($files_list)) { - $files_list = array($files); + $files_list = [$files]; } /** @@ -52,7 +52,7 @@ setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); } -$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ); +$server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ]; /** * Http range requests support diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 0b66ed108976c..8cbe5841aafde 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -43,7 +43,7 @@ exit(); } - $data = array(); + $data = []; $baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php') . '?dir='; $permissions = $dirInfo->getPermissions(); @@ -80,7 +80,7 @@ $data['files'] = \OCA\Files\Helper::formatFileInfos($files); $data['permissions'] = $permissions; - \OC_JSON::success(array('data' => $data)); + \OC_JSON::success(['data' => $data]); } catch (\OCP\Files\StorageNotAvailableException $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files']); \OC_JSON::error([ @@ -91,18 +91,18 @@ ]); } catch (\OCP\Files\StorageInvalidException $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files']); - \OC_JSON::error(array( - 'data' => array( + \OC_JSON::error([ + 'data' => [ 'exception' => StorageInvalidException::class, 'message' => $l->t('Storage invalid') - ) - )); + ] + ]); } catch (\Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files']); - \OC_JSON::error(array( - 'data' => array( + \OC_JSON::error([ + 'data' => [ 'exception' => \Exception::class, 'message' => $l->t('Unknown error') - ) - )); + ] + ]); } diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index 35e46c0c151e0..bb98613377cc9 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -36,7 +36,7 @@ // t('Files') $l = \OC::$server->getL10N('files'); -\OC::$server->getSearch()->registerProvider(File::class, array('apps' => array('files'))); +\OC::$server->getSearch()->registerProvider(File::class, ['apps' => ['files']]); $templateManager = \OC_Helper::getFileTemplateManager(); $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 8bda6329d29a7..b043cfeb6acb2 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -50,7 +50,7 @@ class Application extends App { public const APP_ID = 'files'; - public function __construct(array $urlParams=array()) { + public function __construct(array $urlParams=[]) { parent::__construct(self::APP_ID, $urlParams); $container = $this->getContainer(); $server = $container->getServer(); diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 39eebbb2c4329..38d4b1cc979a8 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -174,7 +174,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { if ($inputPath) { $inputPath = '/' . trim($inputPath, '/'); list (, $user,) = explode('/', $inputPath, 3); - $users = array($user); + $users = [$user]; } else if ($input->getOption('all')) { $users = $this->userManager->search(''); } else { diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 70b878f43ad10..7c5d2a08b883e 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -200,7 +200,7 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal $collapseClasses = 'collapsible'; } - $favoritesSublistArray = Array(); + $favoritesSublistArray = []; $navBarPositionPosition = 6; $currentCount = 0; diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index f88689af2667d..c46d302855326 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -51,7 +51,7 @@ public static function buildFileStorageStatistics($dir) { $l = \OC::$server->getL10N('files'); $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']); $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize); - $maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize)); + $maxHumanFileSize = $l->t('Upload (max. %s)', [$maxHumanFileSize]); return [ 'uploadMaxFilesize' => $maxUploadFileSize, @@ -140,7 +140,7 @@ public static function compareSize(FileInfo $a, FileInfo $b) { * @return array formatted file info */ public static function formatFileInfo(FileInfo $i) { - $entry = array(); + $entry = []; $entry['id'] = $i['fileid']; $entry['parentId'] = $i['parent']; @@ -182,7 +182,7 @@ public static function formatFileInfo(FileInfo $i) { * @return array */ public static function formatFileInfos($fileInfos) { - $files = array(); + $files = []; foreach ($fileInfos as $i) { $files[] = self::formatFileInfo($i); } @@ -262,7 +262,7 @@ public static function sortFiles($files, $sortAttribute = 'name', $sortDescendin } else if ($sortAttribute === 'size') { $sortFunc = 'compareSize'; } - usort($files, array(Helper::class, $sortFunc)); + usort($files, [Helper::class, $sortFunc]); if ($sortDescending) { $files = array_reverse($files); } diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php index a477db324ac21..5df00ae5c5fda 100644 --- a/apps/files/lib/Service/TagService.php +++ b/apps/files/lib/Service/TagService.php @@ -83,7 +83,7 @@ public function __construct( public function updateFileTags($path, $tags) { $fileId = $this->homeFolder->get($path)->getId(); - $currentTags = $this->tagger->getTagsForObjects(array($fileId)); + $currentTags = $this->tagger->getTagsForObjects([$fileId]); if (!empty($currentTags)) { $currentTags = current($currentTags); diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index b14617f0ca31a..9d6227c86b38c 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -47,7 +47,7 @@ - t('Use this address to access your Files via WebDAV', array(link_to_docs('user-webdav')))); ?> + t('Use this address to access your Files via WebDAV', [link_to_docs('user-webdav')])); ?> diff --git a/apps/files/tests/HelperTest.php b/apps/files/tests/HelperTest.php index b756386a2bf48..8dda7be5a198e 100644 --- a/apps/files/tests/HelperTest.php +++ b/apps/files/tests/HelperTest.php @@ -37,13 +37,13 @@ private function makeFileInfo($name, $size, $mtime, $isDir = false) { '/' . $name, null, '/', - array( + [ 'name' => $name, 'size' => $size, 'mtime' => $mtime, 'type' => $isDir ? 'dir' : 'file', 'mimetype' => $isDir ? 'httpd/unix-directory' : 'application/octet-stream' - ), + ], null ); } @@ -52,49 +52,49 @@ private function makeFileInfo($name, $size, $mtime, $isDir = false) { * Returns a file list for testing */ private function getTestFileList() { - return array( + return [ self::makeFileInfo('a.txt', 4, 2.3 * pow(10, 9)), self::makeFileInfo('q.txt', 5, 150), self::makeFileInfo('subdir2', 87, 128, true), self::makeFileInfo('b.txt', 2.2 * pow(10, 9), 800), self::makeFileInfo('o.txt', 12, 100), self::makeFileInfo('subdir', 88, 125, true), - ); + ]; } function sortDataProvider() { - return array( - array( + return [ + [ 'name', false, - array('subdir', 'subdir2', 'a.txt', 'b.txt', 'o.txt', 'q.txt'), - ), - array( + ['subdir', 'subdir2', 'a.txt', 'b.txt', 'o.txt', 'q.txt'], + ], + [ 'name', true, - array('q.txt', 'o.txt', 'b.txt', 'a.txt', 'subdir2', 'subdir'), - ), - array( + ['q.txt', 'o.txt', 'b.txt', 'a.txt', 'subdir2', 'subdir'], + ], + [ 'size', false, - array('a.txt', 'q.txt', 'o.txt', 'subdir2', 'subdir', 'b.txt'), - ), - array( + ['a.txt', 'q.txt', 'o.txt', 'subdir2', 'subdir', 'b.txt'], + ], + [ 'size', true, - array('b.txt', 'subdir', 'subdir2', 'o.txt', 'q.txt', 'a.txt'), - ), - array( + ['b.txt', 'subdir', 'subdir2', 'o.txt', 'q.txt', 'a.txt'], + ], + [ 'mtime', false, - array('o.txt', 'subdir', 'subdir2', 'q.txt', 'b.txt', 'a.txt'), - ), - array( + ['o.txt', 'subdir', 'subdir2', 'q.txt', 'b.txt', 'a.txt'], + ], + [ 'mtime', true, - array('a.txt', 'b.txt', 'q.txt', 'subdir2', 'subdir', 'o.txt'), - ), - ); + ['a.txt', 'b.txt', 'q.txt', 'subdir2', 'subdir', 'o.txt'], + ], + ]; } /** @@ -103,7 +103,7 @@ function sortDataProvider() { public function testSortByName($sort, $sortDescending, $expectedOrder) { $files = self::getTestFileList(); $files = \OCA\Files\Helper::sortFiles($files, $sort, $sortDescending); - $fileNames = array(); + $fileNames = []; foreach ($files as $fileInfo) { $fileNames[] = $fileInfo->getName(); } diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index bc7c803953ba3..a2792a38647cb 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -132,25 +132,25 @@ public function testUpdateFileTags() { $fileId = $testFile->getId(); // set tags - $this->tagService->updateFileTags('subdir/test.txt', array($tag1, $tag2)); + $this->tagService->updateFileTags('subdir/test.txt', [$tag1, $tag2]); - $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag1)); - $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2)); + $this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag1)); + $this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag2)); // remove tag - $this->tagService->updateFileTags('subdir/test.txt', array($tag2)); - $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1)); - $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2)); + $this->tagService->updateFileTags('subdir/test.txt', [$tag2]); + $this->assertEquals([], $this->tagger->getIdsForTag($tag1)); + $this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag2)); // clear tags - $this->tagService->updateFileTags('subdir/test.txt', array()); - $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1)); - $this->assertEquals(array(), $this->tagger->getIdsForTag($tag2)); + $this->tagService->updateFileTags('subdir/test.txt', []); + $this->assertEquals([], $this->tagger->getIdsForTag($tag1)); + $this->assertEquals([], $this->tagger->getIdsForTag($tag2)); // non-existing file $caught = false; try { - $this->tagService->updateFileTags('subdir/unexist.txt', array($tag1)); + $this->tagService->updateFileTags('subdir/unexist.txt', [$tag1]); } catch (\OCP\Files\NotFoundException $e) { $caught = true; } diff --git a/apps/files_external/ajax/applicable.php b/apps/files_external/ajax/applicable.php index 0a6b9f5af46ff..bda2c9195964f 100644 --- a/apps/files_external/ajax/applicable.php +++ b/apps/files_external/ajax/applicable.php @@ -51,6 +51,6 @@ $users[$user->getUID()] = $user->getDisplayName(); } -$results = array('groups' => $groups, 'users' => $users); +$results = ['groups' => $groups, 'users' => $users]; \OC_JSON::success($results); diff --git a/apps/files_external/lib/Controller/AjaxController.php b/apps/files_external/lib/Controller/AjaxController.php index 347fa02e1b02c..b9e414a410a25 100644 --- a/apps/files_external/lib/Controller/AjaxController.php +++ b/apps/files_external/lib/Controller/AjaxController.php @@ -88,12 +88,12 @@ private function generateSshKeys($keyLength) { public function getSshKeys($keyLength = 1024) { $key = $this->generateSshKeys($keyLength); return new JSONResponse( - array('data' => array( + ['data' => [ 'private_key' => $key['privatekey'], 'public_key' => $key['publickey'] - ), + ], 'status' => 'success' - )); + ]); } /** diff --git a/apps/files_external/lib/Controller/ApiController.php b/apps/files_external/lib/Controller/ApiController.php index 1882ea3150448..aa0c8ddb6a187 100644 --- a/apps/files_external/lib/Controller/ApiController.php +++ b/apps/files_external/lib/Controller/ApiController.php @@ -74,7 +74,7 @@ private function formatMount(string $mountPoint, array $mountConfig): array { $permissions |= \OCP\Constants::PERMISSION_DELETE; } - $entry = array( + $entry = [ 'name' => basename($mountPoint), 'path' => $path, 'type' => 'dir', @@ -83,7 +83,7 @@ private function formatMount(string $mountPoint, array $mountConfig): array { 'permissions' => $permissions, 'id' => $mountConfig['id'], 'class' => $mountConfig['class'] - ); + ]; return $entry; } diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index c8fc4b00ef8d3..a3c9fbb284c8e 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -171,7 +171,7 @@ public function update( } catch (NotFoundException $e) { return new DataResponse( [ - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id)) + 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) ], Http::STATUS_NOT_FOUND ); diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 8e0dac5a89817..a3a258c599a86 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -124,7 +124,7 @@ public function show($id, $testOnly = true) { } catch (NotFoundException $e) { return new DataResponse( [ - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id)) + 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) ], Http::STATUS_NOT_FOUND ); @@ -164,7 +164,7 @@ public function update( } else { return new DataResponse( [ - 'message' => (string)$this->l10n->t('Storage with ID "%d" is not user editable', array($id)) + 'message' => (string)$this->l10n->t('Storage with ID "%d" is not user editable', [$id]) ], Http::STATUS_FORBIDDEN ); @@ -172,7 +172,7 @@ public function update( } catch (NotFoundException $e) { return new DataResponse( [ - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id)) + 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) ], Http::STATUS_NOT_FOUND ); diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index 46285c4758a75..df42198aeb30d 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -199,7 +199,7 @@ public function update( } catch (NotFoundException $e) { return new DataResponse( [ - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id)) + 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) ], Http::STATUS_NOT_FOUND ); diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 60e39a4d300e2..0d7cbacd8b5eb 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -128,10 +128,10 @@ private function invalidateCache($key) { private function headObject($key) { if (!isset($this->objectCache[$key])) { try { - $this->objectCache[$key] = $this->getConnection()->headObject(array( + $this->objectCache[$key] = $this->getConnection()->headObject([ 'Bucket' => $this->bucket, 'Key' => $key - )); + ]); } catch (S3Exception $e) { if ($e->getStatusCode() >= 500) { throw $e; @@ -191,7 +191,7 @@ public function updateLegacyId(array $params) { $stmt = \OC::$server->getDatabaseConnection()->prepare( 'SELECT `numeric_id`, `id` FROM `*PREFIX*storages` WHERE `id` IN (?, ?)' ); - $stmt->execute(array($oldId, $this->id)); + $stmt->execute([$oldId, $this->id]); while ($row = $stmt->fetch()) { $storages[$row['id']] = $row['numeric_id']; } @@ -204,7 +204,7 @@ public function updateLegacyId(array $params) { $stmt = \OC::$server->getDatabaseConnection()->prepare( 'UPDATE `*PREFIX*storages` SET `id` = ? WHERE `id` = ?' ); - $stmt->execute(array($this->id, $oldId)); + $stmt->execute([$this->id, $oldId]); } // only the bucket based id may exist, do nothing } @@ -235,12 +235,12 @@ public function mkdir($path) { } try { - $this->getConnection()->putObject(array( + $this->getConnection()->putObject([ 'Bucket' => $this->bucket, 'Key' => $path . '/', 'Body' => '', 'ContentType' => 'httpd/unix-directory' - )); + ]); $this->testTimeout(); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); @@ -284,9 +284,9 @@ protected function clearBucket() { } private function batchDelete($path = null) { - $params = array( + $params = [ 'Bucket' => $this->bucket - ); + ]; if ($path !== null) { $params['Prefix'] = $path . '/'; } @@ -326,7 +326,7 @@ public function opendir($path) { } try { - $files = array(); + $files = []; $results = $this->getConnection()->getPaginator('ListObjects', [ 'Bucket' => $this->bucket, 'Delimiter' => '/', @@ -550,7 +550,7 @@ public function fopen($path, $mode) { public function touch($path, $mtime = null) { $path = $this->normalizePath($path); - $metadata = array(); + $metadata = []; if (is_null($mtime)) { $mtime = time(); } @@ -599,11 +599,11 @@ public function copy($path1, $path2) { if ($this->is_file($path1)) { try { - $this->getConnection()->copyObject(array( + $this->getConnection()->copyObject([ 'Bucket' => $this->bucket, 'Key' => $this->cleanKey($path2), 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1) - )); + ]); $this->testTimeout(); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); @@ -613,11 +613,11 @@ public function copy($path1, $path2) { $this->remove($path2); try { - $this->getConnection()->copyObject(array( + $this->getConnection()->copyObject([ 'Bucket' => $this->bucket, 'Key' => $path2 . '/', 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1 . '/') - )); + ]); $this->testTimeout(); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 8f014ce921c5f..adf7f29a3d600 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -109,7 +109,7 @@ public function fopen($path,$mode) { case 'a': case 'ab': //these are supported by the wrapper - $context = stream_context_create(array('ftp' => array('overwrite' => true))); + $context = stream_context_create(['ftp' => ['overwrite' => true]]); $handle = fopen($this->constructUrl($path), $mode, false, $context); return RetryWrapper::wrap($handle); case 'r+': @@ -150,7 +150,7 @@ public static function checkDependencies() { if (function_exists('ftp_login')) { return true; } else { - return array('ftp'); + return ['ftp']; } } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 5d83bf253e494..eaead3eea4510 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -251,8 +251,8 @@ protected function readHostKeys() { try { $keyPath = $this->hostKeysPath(); if (file_exists($keyPath)) { - $hosts = array(); - $keys = array(); + $hosts = []; + $keys = []; $lines = file($keyPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($lines) { foreach ($lines as $line) { @@ -267,7 +267,7 @@ protected function readHostKeys() { } } catch (\Exception $e) { } - return array(); + return []; } /** @@ -307,7 +307,7 @@ public function opendir($path) { } $id = md5('sftp:' . $path); - $dirStream = array(); + $dirStream = []; foreach($list as $file) { if ($file !== '.' && $file !== '..') { $dirStream[] = $file; @@ -391,7 +391,7 @@ public function fopen($path, $mode) { case 'x+': case 'c': case 'c+': - $context = stream_context_create(array('sftp' => array('session' => $this->getConnection()))); + $context = stream_context_create(['sftp' => ['session' => $this->getConnection()]]); $handle = fopen($this->constructUrl($path), $mode, false, $context); return RetryWrapper::wrap($handle); } @@ -464,7 +464,7 @@ public function stat($path) { $mtime = $stat ? $stat['mtime'] : -1; $size = $stat ? $stat['size'] : 0; - return array('mtime' => $mtime, 'size' => $size, 'ctime' => -1); + return ['mtime' => $mtime, 'size' => $size, 'ctime' => -1]; } catch (\Exception $e) { return false; } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 6cf7bb7db8511..8f7d594cd6771 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -472,7 +472,7 @@ public function rmdir($path) { } try { - $this->statCache = array(); + $this->statCache = []; $content = $this->share->dir($this->buildPath($path)); foreach ($content as $file) { if ($file->isDirectory()) { diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 0072f91d4ed1a..daa222def0473 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -351,7 +351,7 @@ public function stat($path) { $mtime = floor($mtime); } - $stat = array(); + $stat = []; $stat['size'] = (int)$object->contentLength; $stat['mtime'] = $mtime; $stat['atime'] = time(); @@ -602,7 +602,7 @@ public function hasUpdated($path, $time) { } $path = $this->normalizePath($path); $dh = $this->opendir($path); - $content = array(); + $content = []; while (($file = readdir($dh)) !== false) { $content[] = $file; } diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index f799fd25f570c..a65b3b3a9c26d 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -96,7 +96,7 @@ public static function registerBackend($class, $definition) { * @deprecated 8.2.0 use UserGlobalStoragesService::getStorages() and UserStoragesService::getStorages() */ public static function getAbsoluteMountPoints($uid) { - $mountPoints = array(); + $mountPoints = []; $userGlobalStoragesService = self::$app->getContainer()->query(UserGlobalStoragesService::class); $userStoragesService = self::$app->getContainer()->query(UserStoragesService::class); @@ -296,7 +296,7 @@ public static function readData($user = null) { return $mountPoints; } } - return array(); + return []; } /** @@ -430,14 +430,14 @@ private static function getCipher() { */ public static function makeConfigHash($config) { $data = json_encode( - array( + [ 'c' => $config['backend'], 'a' => $config['authMechanism'], 'm' => $config['mountpoint'], 'o' => $config['options'], 'p' => isset($config['priority']) ? $config['priority'] : -1, 'mo' => isset($config['mountOptions']) ? $config['mountOptions'] : [], - ) + ] ); return hash('md5', $data); } diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php index 3ecf47419b591..56311a7be4cec 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTest.php +++ b/apps/files_external/tests/Controller/StoragesControllerTest.php @@ -117,7 +117,7 @@ public function testAddStorage() { 'mount', '\OCA\Files_External\Lib\Storage\SMB', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -159,7 +159,7 @@ public function testUpdateStorage() { 'mount', '\OCA\Files_External\Lib\Storage\SMB', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -172,11 +172,11 @@ public function testUpdateStorage() { } function mountPointNamesProvider() { - return array( - array(''), - array('/'), - array('//'), - ); + return [ + [''], + ['/'], + ['//'], + ]; } /** @@ -201,7 +201,7 @@ public function testAddOrUpdateStorageInvalidMountPoint($mountPoint) { $mountPoint, '\OCA\Files_External\Lib\Storage\SMB', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -215,7 +215,7 @@ public function testAddOrUpdateStorageInvalidMountPoint($mountPoint) { $mountPoint, '\OCA\Files_External\Lib\Storage\SMB', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -238,7 +238,7 @@ public function testAddOrUpdateStorageInvalidBackend() { 'mount', '\OC\Files\Storage\InvalidStorage', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -252,7 +252,7 @@ public function testAddOrUpdateStorageInvalidBackend() { 'mount', '\OC\Files\Storage\InvalidStorage', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -292,7 +292,7 @@ public function testUpdateStorageNonExisting() { 'mount', '\OCA\Files_External\Lib\Storage\SMB', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], @@ -388,7 +388,7 @@ public function testValidateStorage($backendValidate, $authMechValidate, $expect 'mount', '\OCA\Files_External\Lib\Storage\SMB', '\OCA\Files_External\Lib\Auth\NullMechanism', - array(), + [], [], [], [], diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php index 7d8f60380c653..5f82121cf7ab4 100644 --- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php @@ -86,7 +86,7 @@ public function testAddOrUpdateStorageDisallowedBackend() { 'mount', '\OCA\Files_External\Lib\Storage\SMB', '\Auth\Mechanism', - array(), + [], [], [], [], @@ -100,7 +100,7 @@ public function testAddOrUpdateStorageDisallowedBackend() { 'mount', '\OCA\Files_External\Lib\Storage\SMB', '\Auth\Mechanism', - array(), + [], [], [], [], diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php index d87288edb10ab..060f8c61a4428 100644 --- a/apps/files_external/tests/OwnCloudFunctionsTest.php +++ b/apps/files_external/tests/OwnCloudFunctionsTest.php @@ -36,72 +36,72 @@ class OwnCloudFunctionsTest extends \Test\TestCase { function configUrlProvider() { - return array( - array( - array( + return [ + [ + [ 'host' => 'testhost', 'root' => 'testroot', 'secure' => false - ), + ], 'http://testhost/remote.php/webdav/testroot/', - ), - array( - array( + ], + [ + [ 'host' => 'testhost', 'root' => 'testroot', 'secure' => true - ), + ], 'https://testhost/remote.php/webdav/testroot/', - ), - array( - array( + ], + [ + [ 'host' => 'http://testhost', 'root' => 'testroot', 'secure' => false - ), + ], 'http://testhost/remote.php/webdav/testroot/', - ), - array( - array( + ], + [ + [ 'host' => 'https://testhost', 'root' => 'testroot', 'secure' => false - ), + ], 'https://testhost/remote.php/webdav/testroot/', - ), - array( - array( + ], + [ + [ 'host' => 'https://testhost/testroot', 'root' => '', 'secure' => false - ), + ], 'https://testhost/testroot/remote.php/webdav/', - ), - array( - array( + ], + [ + [ 'host' => 'https://testhost/testroot', 'root' => 'subdir', 'secure' => false - ), + ], 'https://testhost/testroot/remote.php/webdav/subdir/', - ), - array( - array( + ], + [ + [ 'host' => 'http://testhost/testroot', 'root' => 'subdir', 'secure' => true - ), + ], 'http://testhost/testroot/remote.php/webdav/subdir/', - ), - array( - array( + ], + [ + [ 'host' => 'http://testhost/testroot/', 'root' => '/subdir', 'secure' => false - ), + ], 'http://testhost/testroot/remote.php/webdav/subdir/', - ), - ); + ], + ]; } /** diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index 9d3a44042e0b9..dd35ee8f92c46 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -95,7 +95,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); $this->dbConfig = new CleaningDBConfig(\OC::$server->getDatabaseConnection(), \OC::$server->getCrypto()); - self::$hookCalls = array(); + self::$hookCalls = []; $config = \OC::$server->getConfig(); $this->dataDir = $config->getSystemValue( 'datadirectory', @@ -177,7 +177,7 @@ protected function setUp(): void { protected function tearDown(): void { \OC_Mount_Config::$skipTest = false; - self::$hookCalls = array(); + self::$hookCalls = []; if ($this->dbConfig) { $this->dbConfig->clean(); } @@ -448,17 +448,17 @@ public function testGetStoragesAuthMechanismNotVisible() { } public static function createHookCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_create_mount, 'params' => $params - ); + ]; } public static function deleteHookCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_delete_mount, 'params' => $params - ); + ]; } /** diff --git a/apps/files_external/tests/Storage/FtpTest.php b/apps/files_external/tests/Storage/FtpTest.php index 65a1566ec1eb7..6b9ce2d5b3163 100644 --- a/apps/files_external/tests/Storage/FtpTest.php +++ b/apps/files_external/tests/Storage/FtpTest.php @@ -63,11 +63,11 @@ protected function tearDown(): void { } public function testConstructUrl(){ - $config = array ( 'host' => 'localhost', + $config = [ 'host' => 'localhost', 'user' => 'ftp', 'password' => 'ftp', 'root' => '/', - 'secure' => false ); + 'secure' => false ]; $instance = new FTP($config); $this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl('')); diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index 2af9d00ebe918..87a5668be49da 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -73,7 +73,7 @@ protected function tearDown(): void { public function directoryProvider() { // doesn't support leading/trailing spaces - return array(array('folder')); + return [['folder']]; } public function testRenameWithSpaces() { diff --git a/apps/files_external/tests/config.php b/apps/files_external/tests/config.php index a080b33e7fe1f..d6d3731c5a565 100644 --- a/apps/files_external/tests/config.php +++ b/apps/files_external/tests/config.php @@ -33,15 +33,15 @@ } // this is now more a template now for your private configurations -return array( - 'ftp'=>array( +return [ + 'ftp'=>[ 'run'=>false, 'host'=>'localhost', 'user'=>'test', 'password'=>'test', 'root'=>'/test', - ), - 'webdav'=>array( + ], + 'webdav'=>[ 'run'=>false, 'host'=>'localhost', 'user'=>'test', @@ -51,15 +51,15 @@ // (only in tests) // set to higher value for lighttpd webdav 'wait'=> 0 - ), - 'owncloud'=>array( + ], + 'owncloud'=>[ 'run'=>false, 'host'=>'localhost/owncloud', 'user'=>'test', 'password'=>'test', 'root'=>'', - ), - 'swift' => array( + ], + 'swift' => [ 'run' => false, 'user' => 'test', 'bucket' => 'test', @@ -70,16 +70,16 @@ //'service_name' => 'swift', //should be 'swift' for OpenStack Object Storage and 'cloudFiles' for Rackspace Cloud Files (default value) //'url' => 'https://identity.api.rackspacecloud.com/v2.0/', //to be used with Rackspace Cloud Files and OpenStack Object Storage //'timeout' => 5 // timeout of HTTP requests in seconds - ), - 'smb'=>array( + ], + 'smb'=>[ 'run'=>false, 'user'=>'test', 'password'=>'test', 'host'=>'localhost', 'share'=>'/test', 'root'=>'/test/', - ), - 'amazons3'=>array( + ], + 'amazons3'=>[ 'run'=>false, 'key'=>'test', 'secret'=>'test', @@ -90,20 +90,20 @@ //'region' => 'eu-west-1', //'test'=>'true', //'timeout'=>20 - ), - 'sftp' => array ( + ], + 'sftp' => [ 'run'=>false, 'host'=>'localhost', 'user'=>'test', 'password'=>'test', 'root'=>'/test' - ), - 'sftp_key' => array ( + ], + 'sftp_key' => [ 'run'=>false, 'host'=>'localhost', 'user'=>'test', 'public_key'=>'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key', 'private_key'=>'test', 'root'=>'/test' - ), -); + ], +]; diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index 620aaf42c6917..1022788ed2fa1 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -615,7 +615,7 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS $this->emitAccessShareHook($share); - $server_params = array( 'head' => $this->request->getMethod() === 'HEAD' ); + $server_params = [ 'head' => $this->request->getMethod() === 'HEAD' ]; /** * Http range requests support diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index c58e6e7b98a78..c89bb2c2f4f83 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -193,13 +193,13 @@ public function addShare($remote, $token, $password, $name, $owner, $shareType, $this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType); - $options = array( + $options = [ 'remote' => $remote, 'token' => $token, 'password' => $password, 'mountpoint' => $mountPoint, 'owner' => $owner - ); + ]; return $this->mountShare($options); } @@ -226,7 +226,7 @@ private function writeShareToDb($remote, $token, $password, $name, $owner, $user (`remote`, `share_token`, `password`, `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`, `accepted`, `remote_id`, `parent`, `share_type`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) '); - return $query->execute(array($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType)); + return $query->execute([$remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType]); } /** @@ -240,7 +240,7 @@ public function getShare($id) { SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`, `parent`, `share_type`, `password`, `mountpoint_hash` FROM `*PREFIX*share_external` WHERE `id` = ?'); - $result = $getShare->execute(array($id)); + $result = $getShare->execute([$id]); $share = $result ? $getShare->fetch() : []; @@ -286,7 +286,7 @@ public function acceptShare($id) { `mountpoint` = ?, `mountpoint_hash` = ? WHERE `id` = ? AND `user` = ?'); - $userShareAccepted = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid)); + $userShareAccepted = $acceptShare->execute([1, $mountPoint, $hash, $id, $this->uid]); } else { $result = $this->writeShareToDb( $share['remote'], @@ -327,7 +327,7 @@ public function declineShare($id) { if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_USER) { $removeShare = $this->connection->prepare(' DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?'); - $removeShare->execute(array($id, $this->uid)); + $removeShare->execute([$id, $this->uid]); $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); $this->processNotification($id); @@ -384,7 +384,7 @@ private function sendFeedbackToRemote($remote, $token, $remoteId, $feedback) { $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT; - $fields = array('token' => $token); + $fields = ['token' => $token]; $client = $this->clientService->newClient(); @@ -502,7 +502,7 @@ public function setMountPoint($source, $target) { WHERE `mountpoint_hash` = ? AND `user` = ? '); - $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $this->uid)); + $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]); return $result; } @@ -519,7 +519,7 @@ public function removeShare($mountPoint) { SELECT `remote`, `share_token`, `remote_id`, `share_type`, `id` FROM `*PREFIX*share_external` WHERE `mountpoint_hash` = ? AND `user` = ?'); - $result = $getShare->execute(array($hash, $this->uid)); + $result = $getShare->execute([$hash, $this->uid]); $share = $getShare->fetch(); $getShare->closeCursor(); @@ -535,13 +535,13 @@ public function removeShare($mountPoint) { DELETE FROM `*PREFIX*share_external` WHERE `id` = ? '); - $result = (bool)$query->execute(array((int)$share['id'])); + $result = (bool)$query->execute([(int)$share['id']]); } else if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $query = $this->connection->prepare(' UPDATE `*PREFIX*share_external` SET `accepted` = ? WHERE `id` = ?'); - $result = (bool)$query->execute(array(0, (int)$share['id'])); + $result = (bool)$query->execute([0, (int)$share['id']]); } if($result) { @@ -585,7 +585,7 @@ public function removeUserShares($uid) { SELECT `remote`, `share_token`, `remote_id` FROM `*PREFIX*share_external` WHERE `user` = ?'); - $result = $getShare->execute(array($uid)); + $result = $getShare->execute([$uid]); if ($result) { $shares = $getShare->fetchAll(); @@ -598,7 +598,7 @@ public function removeUserShares($uid) { DELETE FROM `*PREFIX*share_external` WHERE `user` = ? '); - return (bool)$query->execute(array($uid)); + return (bool)$query->execute([$uid]); } /** diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 97870f733433b..e405d8c447247 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -85,13 +85,13 @@ public function __construct($options) { $this->mountPoint = $options['mountpoint']; $this->token = $options['token']; - parent::__construct(array( + parent::__construct([ 'secure' => $secure, 'host' => $host, 'root' => $root, 'user' => $options['token'], 'password' => (string)$options['password'] - )); + ]); } public function getWatcher($path = '', $storage = null) { diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index a3a041142eb9f..7bde5979ce113 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -117,7 +117,7 @@ public function generateTarget($filePath, $shareWith, $exclude = null) { } } - $excludeList = is_array($exclude) ? $exclude : array(); + $excludeList = is_array($exclude) ? $exclude : []; return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view); } @@ -126,17 +126,17 @@ public function formatItems($items, $format, $parameters = null) { if ($format === self::FORMAT_SHARED_STORAGE) { // Only 1 item should come through for this format call $item = array_shift($items); - return array( + return [ 'parent' => $item['parent'], 'path' => $item['path'], 'storage' => $item['storage'], 'permissions' => $item['permissions'], 'uid_owner' => $item['uid_owner'], - ); + ]; } else if ($format === self::FORMAT_GET_FOLDER_CONTENTS) { - $files = array(); + $files = []; foreach ($items as $item) { - $file = array(); + $file = []; $file['fileid'] = $item['file_source']; $file['storage'] = $item['storage']; $file['path'] = $item['file_target']; @@ -157,31 +157,31 @@ public function formatItems($items, $format, $parameters = null) { } return $files; } else if ($format === self::FORMAT_OPENDIR) { - $files = array(); + $files = []; foreach ($items as $item) { $files[] = basename($item['file_target']); } return $files; } else if ($format === self::FORMAT_GET_ALL) { - $ids = array(); + $ids = []; foreach ($items as $item) { $ids[] = $item['file_source']; } return $ids; } else if ($format === self::FORMAT_PERMISSIONS) { - $filePermissions = array(); + $filePermissions = []; foreach ($items as $item) { $filePermissions[$item['file_source']] = $item['permissions']; } return $filePermissions; } else if ($format === self::FORMAT_TARGET_NAMES) { - $targets = array(); + $targets = []; foreach ($items as $item) { $targets[] = $item['file_target']; } return $targets; } - return array(); + return []; } /** diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index fd4bb2491fa8c..0c1ea18667ce3 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -39,7 +39,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection { * @return array with shares */ public function getParents($itemSource, $shareWith = null, $owner = null) { - $result = array(); + $result = []; $parent = $this->getParentId($itemSource); $userManager = \OC::$server->getUserManager(); @@ -89,8 +89,8 @@ private function getParentId($child) { } public function getChildren($itemSource) { - $children = array(); - $parents = array($itemSource); + $children = []; + $parents = [$itemSource]; $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $qb->select('id') @@ -123,9 +123,9 @@ public function getChildren($itemSource) { $result = $qb->execute(); - $parents = array(); + $parents = []; while ($file = $result->fetch()) { - $children[] = array('source' => $file['fileid'], 'file_path' => $file['name']); + $children[] = ['source' => $file['fileid'], 'file_path' => $file['name']]; // If a child folder is found look inside it if ((int) $file['mimetype'] === $mimetype) { $parents[] = $file['fileid']; diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 0baa36ac985fb..ea0163e80b21c 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -285,11 +285,11 @@ public function fopen($path, $mode) { } } } - $info = array( + $info = [ 'target' => $this->getMountPoint() . $path, 'source' => $source, 'mode' => $mode, - ); + ]; \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info); return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode); } diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 1fcdf2fe505a8..99cdb882206b7 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -34,7 +34,7 @@ } else { http_response_code(307); } - header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token))); + header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); } else { http_response_code(404); $tmpl = new OCP\Template('', '404', 'guest'); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 792b4d238045b..a9cfaae9df13b 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -75,7 +75,7 @@
- t('Download %s', array($_['filename'])))?> () + t('Download %s', [$_['filename']]))?> ()
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index c510c4dad9822..a356525260fc9 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -648,12 +648,12 @@ function testGetShareFromFolderReshares() { $share3->setStatus(IShare::STATUS_ACCEPTED); $this->shareManager->updateShare($share3); - $testValues=array( - array('query' => $this->folder, - 'expectedResult' => $this->folder . $this->filename), - array('query' => $this->folder . $this->subfolder, - 'expectedResult' => $this->folder . $this->subfolder . $this->filename), - ); + $testValues=[ + ['query' => $this->folder, + 'expectedResult' => $this->folder . $this->filename], + ['query' => $this->folder . $this->subfolder, + 'expectedResult' => $this->folder . $this->subfolder . $this->filename], + ]; foreach ($testValues as $value) { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); @@ -1214,7 +1214,7 @@ public function testShareFolderWithAMountPoint() { */ public static function initTestMountPointsHook($data) { if ($data['user'] === self::TEST_FILES_SHARING_API_USER1) { - \OC\Files\Filesystem::mount(self::$tempStorage, array(), '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME); + \OC\Files\Filesystem::mount(self::$tempStorage, [], '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME); } } @@ -1222,7 +1222,7 @@ public static function initTestMountPointsHook($data) { * Tests mounting a folder that is an external storage mount point. */ public function testShareStorageMountPoint() { - $tempStorage = new \OC\Files\Storage\Temporary(array()); + $tempStorage = new \OC\Files\Storage\Temporary([]); $tempStorage->file_put_contents('test.txt', 'abcdef'); $tempStorage->getScanner()->scan(''); diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 1c05e70f080a6..cba90e8f9e61a 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -148,63 +148,63 @@ protected function tearDown(): void { } function searchDataProvider() { - return array( - array('%another%', - array( - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%Another%', - array( - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%dir%', - array( - array('name' => 'emptydir', 'path' => 'emptydir'), - array('name' => 'subdir', 'path' => 'subdir'), - array('name' => 'shareddir', 'path' => ''), - ) - ), - array('%Dir%', - array( - array('name' => 'emptydir', 'path' => 'emptydir'), - array('name' => 'subdir', 'path' => 'subdir'), - array('name' => 'shareddir', 'path' => ''), - ) - ), - array('%txt%', - array( - array('name' => 'bar.txt', 'path' => 'bar.txt'), - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%Txt%', - array( - array('name' => 'bar.txt', 'path' => 'bar.txt'), - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%', - array( - array('name' => 'bar.txt', 'path' => 'bar.txt'), - array('name' => 'emptydir', 'path' => 'emptydir'), - array('name' => 'subdir', 'path' => 'subdir'), - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - array('name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'), - array('name' => 'shareddir', 'path' => ''), - ) - ), - array('%nonexistent%', - array( - ) - ), - ); + return [ + ['%another%', + [ + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%Another%', + [ + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%dir%', + [ + ['name' => 'emptydir', 'path' => 'emptydir'], + ['name' => 'subdir', 'path' => 'subdir'], + ['name' => 'shareddir', 'path' => ''], + ] + ], + ['%Dir%', + [ + ['name' => 'emptydir', 'path' => 'emptydir'], + ['name' => 'subdir', 'path' => 'subdir'], + ['name' => 'shareddir', 'path' => ''], + ] + ], + ['%txt%', + [ + ['name' => 'bar.txt', 'path' => 'bar.txt'], + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%Txt%', + [ + ['name' => 'bar.txt', 'path' => 'bar.txt'], + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%', + [ + ['name' => 'bar.txt', 'path' => 'bar.txt'], + ['name' => 'emptydir', 'path' => 'emptydir'], + ['name' => 'subdir', 'path' => 'subdir'], + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ['name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'], + ['name' => 'shareddir', 'path' => ''], + ] + ], + ['%nonexistent%', + [ + ] + ], + ]; } /** @@ -226,20 +226,20 @@ function testSearch() { */ function testSearchByMime() { $results = $this->sharedStorage->getCache()->searchByMime('text'); - $check = array( - array( + $check = [ + [ 'name' => 'bar.txt', 'path' => 'bar.txt' - ), - array( + ], + [ 'name' => 'another too.txt', 'path' => 'subdir/another too.txt' - ), - array( + ], + [ 'name' => 'another.txt', 'path' => 'subdir/another.txt' - ), - ); + ], + ]; $this->verifyFiles($check, $results); } @@ -250,27 +250,27 @@ function testGetFolderContentsInRoot() { // additional root will always contain the example file "welcome.txt", // so this will be part of the result $this->verifyFiles( - array( - array( + [ + [ 'name' => 'welcome.txt', 'path' => 'files/welcome.txt', 'mimetype' => 'text/plain', - ), - array( + ], + [ 'name' => 'shareddir', 'path' => 'files/shareddir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'shared single file.txt', 'path' => 'files/shared single file.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - ), + ], + ], $results ); } @@ -279,29 +279,29 @@ function testGetFolderContentsInSubdir() { $results = $this->user2View->getDirectoryContent('/shareddir'); $this->verifyFiles( - array( - array( + [ + [ 'name' => 'bar.txt', 'path' => 'bar.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'emptydir', 'path' => 'emptydir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'subdir', 'path' => 'subdir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - ), + ], + ], $results ); } @@ -327,29 +327,29 @@ function testGetFolderContentsWhenSubSubdirShared() { $results = $thirdView->getDirectoryContent('/subdir'); $this->verifyFiles( - array( - array( + [ + [ 'name' => 'another too.txt', 'path' => 'another too.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'another.txt', 'path' => 'another.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'not a text file.xml', 'path' => 'not a text file.xml', 'mimetype' => 'application/xml', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - ), + ], + ], $results ); @@ -376,7 +376,7 @@ private function verifyFiles($examples, $results) { } } } - $this->assertEquals(array(), $results); + $this->assertEquals([], $results); } /** diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 69b00ff942459..e8fb3454e1e32 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -1525,7 +1525,7 @@ public function testCanAccessRoomShare(bool $expected, \OCP\Share\IShare $share, ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('canAccessShare')) + ->setMethods(['canAccessShare']) ->getMock(); $helper->method('canAccessShare') ->with($share, $this->currentUser) @@ -2170,7 +2170,7 @@ public function testCreateShareRoom() { ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('createShare')) + ->setMethods(['createShare']) ->getMock(); $helper->method('createShare') ->with( @@ -2293,7 +2293,7 @@ public function testCreateShareRoomHelperThrowException() { ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('createShare')) + ->setMethods(['createShare']) ->getMock(); $helper->method('createShare') ->with( @@ -4291,7 +4291,7 @@ public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bo ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('formatShare')) + ->setMethods(['formatShare']) ->getMock(); $helper->method('formatShare') ->with($share) diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 35807dffe821b..c560595a7b4e1 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -287,7 +287,7 @@ public function testShowShare() { }); $response = $this->shareController->showShare(); - $sharedTmplParams = array( + $sharedTmplParams = [ 'displayName' => 'ownerDisplay', 'owner' => 'ownerUID', 'filename' => 'file1.txt', @@ -315,7 +315,7 @@ public function testShowShare() { 'note' => $note, 'hideDownload' => false, 'showgridview' => false - ); + ]; $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); @@ -427,7 +427,7 @@ public function testShowShareHideDownload() { }); $response = $this->shareController->showShare(); - $sharedTmplParams = array( + $sharedTmplParams = [ 'displayName' => 'ownerDisplay', 'owner' => 'ownerUID', 'filename' => 'file1.txt', @@ -455,7 +455,7 @@ public function testShowShareHideDownload() { 'note' => $note, 'hideDownload' => true, 'showgridview' => false - ); + ]; $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); @@ -541,7 +541,7 @@ public function testShareFileDrop() { unset($responseParams['folder']); $response->setParams($responseParams); - $sharedTmplParams = array( + $sharedTmplParams = [ 'displayName' => 'ownerDisplay', 'owner' => 'ownerUID', 'filename' => '/fileDrop', @@ -569,7 +569,7 @@ public function testShareFileDrop() { 'note' => '', 'hideDownload' => false, 'showgridview' => false - ); + ]; $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 766f0232b87ef..42cd05ebdf4eb 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -76,11 +76,11 @@ protected function setUp(): void { ); $this->cache->put( 'test.txt', - array( + [ 'mimetype' => 'text/plain', 'size' => 5, 'mtime' => 123, - ) + ] ); } @@ -107,19 +107,19 @@ public function testGetReturnsFalseIfNotFound() { public function testGetFolderPopulatesOwner() { $dirId = $this->cache->put( 'subdir', - array( + [ 'mimetype' => 'httpd/unix-directory', 'size' => 5, 'mtime' => 123, - ) + ] ); $this->cache->put( 'subdir/contents.txt', - array( + [ 'mimetype' => 'text/plain', 'size' => 5, 'mtime' => 123, - ) + ] ); $results = $this->cache->getFolderContentsById($dirId); diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index b4e84846ed4a3..2a9577bccb97f 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -39,37 +39,37 @@ class ExternalStorageTest extends \Test\TestCase { function optionsProvider() { - return array( - array( + return [ + [ 'http://remoteserver:8080/owncloud', 'http://remoteserver:8080/owncloud/public.php/webdav/', - ), + ], // extra slash - array( + [ 'http://remoteserver:8080/owncloud/', 'http://remoteserver:8080/owncloud/public.php/webdav/', - ), + ], // extra path - array( + [ 'http://remoteserver:8080/myservices/owncloud/', 'http://remoteserver:8080/myservices/owncloud/public.php/webdav/', - ), + ], // root path - array( + [ 'http://remoteserver:8080/', 'http://remoteserver:8080/public.php/webdav/', - ), + ], // without port - array( + [ 'http://remoteserver/oc.test', 'http://remoteserver/oc.test/public.php/webdav/', - ), + ], // https - array( + [ 'https://remoteserver/', 'https://remoteserver/public.php/webdav/', - ), - ); + ], + ]; } private function getTestStorage($uri) { @@ -91,7 +91,7 @@ private function getTestStorage($uri) { ->willReturn($client); return new TestSharingExternalStorage( - array( + [ 'cloudId' => new CloudId('testOwner@' . $uri, 'testOwner', $uri), 'remote' => $uri, 'owner' => 'testOwner', @@ -101,7 +101,7 @@ private function getTestStorage($uri) { 'manager' => null, 'certificateManager' => $certificateManager, 'HttpClientService' => $httpClientService, - ) + ] ); } diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index 5085998413345..dddeb5cf5510a 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -226,13 +226,13 @@ public function dataProviderTestFileSharePermissions() { $permission5 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE; $permission6 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE; - return array( - array($permission1, false), - array($permission3, true), - array($permission4, true), - array($permission5, false), - array($permission6, false), - ); + return [ + [$permission1, false], + [$permission3, true], + [$permission4, true], + [$permission5, false], + [$permission6, false], + ]; } public function testFileOwner() { diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 55abbd20cbaef..e63cb597950d6 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -251,14 +251,14 @@ public function testStripUserFilesPath($path, $expectedResult, $exception) { } public function dataProviderTestStripUserFilesPath() { - return array( - array('/user/files/foo.txt', '/foo.txt', false), - array('/user/files/folder/foo.txt', '/folder/foo.txt', false), - array('/data/user/files/foo.txt', null, true), - array('/data/user/files/', null, true), - array('/files/foo.txt', null, true), - array('/foo.txt', null, true), - ); + return [ + ['/user/files/foo.txt', '/foo.txt', false], + ['/user/files/folder/foo.txt', '/folder/foo.txt', false], + ['/data/user/files/foo.txt', null, true], + ['/data/user/files/', null, true], + ['/files/foo.txt', null, true], + ['/foo.txt', null, true], + ]; } public function dataPermissionMovedGroupShare() { diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 59e411e47f77d..1c222055d4e95 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -406,7 +406,7 @@ public function testMountSharesOtherUser() { $mountConfigManager = \OC::$server->getMountProviderCollection(); $mounts = $mountConfigManager->getMountsForUser(\OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3)); - array_walk($mounts, array(\OC\Files\Filesystem::getMountManager(), 'addMount')); + array_walk($mounts, [\OC\Files\Filesystem::getMountManager(), 'addMount']); $this->assertTrue($rootView->file_exists('/' . self::TEST_FILES_SHARING_API_USER3 . '/files/' . $this->filename)); @@ -443,7 +443,7 @@ public function testCopyFromStorage() { list($sharedStorage,) = $view->resolvePath($this->folder); $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')); - $sourceStorage = new \OC\Files\Storage\Temporary(array()); + $sourceStorage = new \OC\Files\Storage\Temporary([]); $sourceStorage->file_put_contents('foo.txt', 'asd'); $sharedStorage->copyFromStorage($sourceStorage, 'foo.txt', 'bar.txt'); @@ -476,7 +476,7 @@ public function testMoveFromStorage() { list($sharedStorage,) = $view->resolvePath($this->folder); $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')); - $sourceStorage = new \OC\Files\Storage\Temporary(array()); + $sourceStorage = new \OC\Files\Storage\Temporary([]); $sourceStorage->file_put_contents('foo.txt', 'asd'); $sharedStorage->moveFromStorage($sourceStorage, 'foo.txt', 'bar.txt'); diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index 093f6139dd3d6..0386828c4ca04 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -115,9 +115,9 @@ function testFolderSizePropagationToOwnerStorage() { $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $dataLen = strlen($textData); - $this->sharedCache->put('bar.txt', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain')); + $this->sharedCache->put('bar.txt', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']); $this->sharedStorage->file_put_contents('bar.txt', $textData); - $this->sharedCache->put('', array('mtime' => 10, 'storage_mtime' => 10, 'size' => '-1', 'mimetype' => 'httpd/unix-directory')); + $this->sharedCache->put('', ['mtime' => 10, 'storage_mtime' => 10, 'size' => '-1', 'mimetype' => 'httpd/unix-directory']); // run the propagation code $this->sharedStorage->getWatcher()->checkUpdate(''); @@ -145,9 +145,9 @@ function testSubFolderSizePropagationToOwnerStorage() { $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $dataLen = strlen($textData); - $this->sharedCache->put('subdir/bar.txt', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain')); + $this->sharedCache->put('subdir/bar.txt', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']); $this->sharedStorage->file_put_contents('subdir/bar.txt', $textData); - $this->sharedCache->put('subdir', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain')); + $this->sharedCache->put('subdir', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']); // run the propagation code $this->sharedStorage->getWatcher()->checkUpdate('subdir'); @@ -173,7 +173,7 @@ function testSubFolderSizePropagationToOwnerStorage() { * @param string $path */ function getOwnerDirSizes($path) { - $result = array(); + $result = []; while ($path != '' && $path != '' && $path != '.') { $cachedData = $this->ownerCache->get($path); diff --git a/apps/files_trashbin/lib/Helper.php b/apps/files_trashbin/lib/Helper.php index 343734f882a25..3cc096decbb34 100644 --- a/apps/files_trashbin/lib/Helper.php +++ b/apps/files_trashbin/lib/Helper.php @@ -46,7 +46,7 @@ class Helper { * @return \OCP\Files\FileInfo[] */ public static function getTrashFiles($dir, $user, $sortAttribute = '', $sortDescending = false) { - $result = array(); + $result = []; $timestamp = null; $view = new \OC\Files\View('/' . $user . '/files_trashbin/files'); @@ -84,7 +84,7 @@ public static function getTrashFiles($dir, $user, $sortAttribute = '', $sortDesc } } $type = $entry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE ? 'dir' : 'file'; - $i = array( + $i = [ 'name' => $name, 'mtime' => $timestamp, 'mimetype' => $type === 'dir' ? 'httpd/unix-directory' : \OC::$server->getMimeTypeDetector()->detectPath($name), @@ -94,7 +94,7 @@ public static function getTrashFiles($dir, $user, $sortAttribute = '', $sortDesc 'etag' => '', 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE, 'fileid' => $entry->getId(), - ); + ]; if ($originalPath) { if ($originalPath !== '.') { $i['extraData'] = $originalPath . '/' . $originalName; @@ -117,7 +117,7 @@ public static function getTrashFiles($dir, $user, $sortAttribute = '', $sortDesc * @param \OCP\Files\FileInfo[] $fileInfos file infos */ public static function formatFileInfos($fileInfos) { - $files = array(); + $files = []; foreach ($fileInfos as $i) { $entry = \OCA\Files\Helper::formatFileInfo($i); $entry['id'] = $i->getId(); diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 8e94a2154000f..0f1787223a20b 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -122,13 +122,13 @@ public static function getUidAndFilename($filename) { public static function getLocations($user) { $query = \OC_DB::prepare('SELECT `id`, `timestamp`, `location`' . ' FROM `*PREFIX*files_trash` WHERE `user`=?'); - $result = $query->execute(array($user)); - $array = array(); + $result = $query->execute([$user]); + $array = []; while ($row = $result->fetchRow()) { if (isset($array[$row['id']])) { $array[$row['id']][$row['timestamp']] = $row['location']; } else { - $array[$row['id']] = array($row['timestamp'] => $row['location']); + $array[$row['id']] = [$row['timestamp'] => $row['location']]; } } return $array; @@ -145,7 +145,7 @@ public static function getLocations($user) { public static function getLocation($user, $filename, $timestamp) { $query = \OC_DB::prepare('SELECT `location` FROM `*PREFIX*files_trash`' . ' WHERE `user`=? AND `id`=? AND `timestamp`=?'); - $result = $query->execute(array($user, $filename, $timestamp))->fetchAll(); + $result = $query->execute([$user, $filename, $timestamp])->fetchAll(); if (isset($result[0]['location'])) { return $result[0]['location']; } else { @@ -201,7 +201,7 @@ private static function copyFilesToUser($sourcePath, $owner, $targetPath, $user, if ($view->file_exists($target)) { $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)"); - $result = $query->execute(array($targetFilename, $timestamp, $targetLocation, $user)); + $result = $query->execute([$targetFilename, $timestamp, $targetLocation, $user]); if (!$result) { \OC::$server->getLogger()->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']); } @@ -281,12 +281,12 @@ public static function move2trash($file_path, $ownerOnly = false) { if ($moveSuccessful) { $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)"); - $result = $query->execute(array($filename, $timestamp, $location, $owner)); + $result = $query->execute([$filename, $timestamp, $location, $owner]); if (!$result) { \OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']); } - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => Filesystem::normalizePath($file_path), - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp))); + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), + 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]); self::retainVersions($filename, $owner, $ownerPath, $timestamp); @@ -433,14 +433,14 @@ public static function restore($file, $filename, $timestamp) { $view->chroot('/' . $user . '/files'); $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); $view->chroot($fakeRoot); - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), - 'trashPath' => Filesystem::normalizePath($file))); + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), + 'trashPath' => Filesystem::normalizePath($file)]); self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); if ($timestamp) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?'); - $query->execute(array($user, $filename, $timestamp)); + $query->execute([$user, $filename, $timestamp]); } return true; @@ -512,14 +512,14 @@ public static function deleteAll() { } // Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore) - $filePaths = array(); + $filePaths = []; foreach($fileInfos as $fileInfo){ $filePaths[] = $view->getRelativePath($fileInfo->getPath()); } unset($fileInfos); // save memory // Bulk PreDelete-Hook - \OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', array('paths' => $filePaths)); + \OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', ['paths' => $filePaths]); // Single-File Hooks foreach($filePaths as $path){ @@ -529,10 +529,10 @@ public static function deleteAll() { // actual file deletion $trash->delete(); $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?'); - $query->execute(array($user)); + $query->execute([$user]); // Bulk PostDelete-Hook - \OC_Hook::emit('\OCP\Trashbin', 'deleteAll', array('paths' => $filePaths)); + \OC_Hook::emit('\OCP\Trashbin', 'deleteAll', ['paths' => $filePaths]); // Single-File Hooks foreach($filePaths as $path){ @@ -550,7 +550,7 @@ public static function deleteAll() { * @param string $path */ protected static function emitTrashbinPreDelete($path){ - \OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => $path)); + \OC_Hook::emit('\OCP\Trashbin', 'preDelete', ['path' => $path]); } /** @@ -558,7 +558,7 @@ protected static function emitTrashbinPreDelete($path){ * @param string $path */ protected static function emitTrashbinPostDelete($path){ - \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => $path)); + \OC_Hook::emit('\OCP\Trashbin', 'delete', ['path' => $path]); } /** @@ -577,7 +577,7 @@ public static function delete($filename, $user, $timestamp = null) { if ($timestamp) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?'); - $query->execute(array($user, $filename, $timestamp)); + $query->execute([$user, $filename, $timestamp]); $file = $filename . '.d' . $timestamp; } else { $file = $filename; @@ -660,7 +660,7 @@ public static function file_exists($filename, $timestamp = null) { */ public static function deleteUser($uid) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?'); - return $query->execute(array($uid)); + return $query->execute([$uid]); } /** @@ -818,7 +818,7 @@ public static function deleteExpiredFiles($files, $user) { } } - return array($size, $count); + return [$size, $count]; } /** @@ -868,7 +868,7 @@ private static function copy_recursive($source, $destination, View $view) { */ private static function getVersionsFromTrash($filename, $timestamp, $user) { $view = new View('/' . $user . '/files_trashbin/versions'); - $versions = array(); + $versions = []; //force rescan of versions, local storage may not have updated the cache if (!self::$scannedVersions) { @@ -1015,6 +1015,6 @@ public static function isEmpty($user) { * @return string */ public static function preview_icon($path) { - return \OC::$server->getURLGenerator()->linkToRoute('core_ajax_trashbin_preview', array('x' => 32, 'y' => 32, 'file' => $path)); + return \OC::$server->getURLGenerator()->linkToRoute('core_ajax_trashbin_preview', ['x' => 32, 'y' => 32, 'file' => $path]); } } diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php index 3bfbf2b35fd40..a906bf75853fa 100644 --- a/apps/files_trashbin/tests/Command/CleanUpTest.php +++ b/apps/files_trashbin/tests/Command/CleanUpTest.php @@ -81,12 +81,12 @@ public function initTable() { $query->delete($this->trashTable)->execute(); for ($i = 0; $i < 10; $i++) { $query->insert($this->trashTable) - ->values(array( + ->values([ 'id' => $query->expr()->literal('file'.$i), 'timestamp' => $query->expr()->literal($i), 'location' => $query->expr()->literal('.'), 'user' => $query->expr()->literal('user'.$i%2) - ))->execute(); + ])->execute(); } $getAllQuery = $this->dbConnection->getQueryBuilder(); $result = $getAllQuery->select('id') @@ -143,10 +143,10 @@ public function testRemoveDeletedFiles($nodeExists) { } public function dataTestRemoveDeletedFiles() { - return array( - array(true), - array(false) - ); + return [ + [true], + [false] + ]; } /** diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 6b57d111ea9a3..6047e488a7745 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -145,8 +145,8 @@ public function testSingleStorageDeleteFolder() { * isn't. */ public function testCrossStorageDeleteFile() { - $storage2 = new Temporary(array()); - \OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage'); + $storage2 = new Temporary([]); + \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); $this->userView->file_put_contents('substorage/subfile.txt', 'foo'); $storage2->getScanner()->scan(''); @@ -171,8 +171,8 @@ public function testCrossStorageDeleteFile() { * isn't. */ public function testCrossStorageDeleteFolder() { - $storage2 = new Temporary(array()); - \OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage'); + $storage2 = new Temporary([]); + \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); $this->userView->mkdir('substorage/folder'); $this->userView->file_put_contents('substorage/folder/subfile.txt', 'bar'); @@ -388,8 +388,8 @@ public function testDeleteVersionsOfFolderAsRecipient() { public function testKeepFileAndVersionsWhenMovingFileBetweenStorages() { \OCA\Files_Versions\Hooks::connectHooks(); - $storage2 = new Temporary(array()); - \OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage'); + $storage2 = new Temporary([]); + \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); // trigger a version (multiple would not work because of the expire logic) $this->userView->file_put_contents('test.txt', 'v1'); @@ -429,8 +429,8 @@ public function testKeepFileAndVersionsWhenMovingFileBetweenStorages() { public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages() { \OCA\Files_Versions\Hooks::connectHooks(); - $storage2 = new Temporary(array()); - \OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage'); + $storage2 = new Temporary([]); + \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage'); // trigger a version (multiple would not work because of the expire logic) $this->userView->file_put_contents('folder/inside.txt', 'v1'); diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php index 4465bfbab3c05..bdcef91e37cd2 100644 --- a/apps/files_trashbin/tests/TrashbinTest.php +++ b/apps/files_trashbin/tests/TrashbinTest.php @@ -270,14 +270,14 @@ public function testExpireOldFilesShared() { $filesInTrashUser2AfterDelete = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER2); // user2-1.txt should have been expired - $this->verifyArray($filesInTrashUser2AfterDelete, array('user2-2.txt', 'user1-4.txt')); + $this->verifyArray($filesInTrashUser2AfterDelete, ['user2-2.txt', 'user1-4.txt']); self::loginHelper(self::TEST_TRASHBIN_USER1); // user1-1.txt and user1-3.txt should have been expired $filesInTrashUser1AfterDelete = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1); - $this->verifyArray($filesInTrashUser1AfterDelete, array('user1-2.txt', 'user1-4.txt')); + $this->verifyArray($filesInTrashUser1AfterDelete, ['user1-2.txt', 'user1-4.txt']); } /** diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 8df98d087d85b..b1d6c689c61d4 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -67,24 +67,24 @@ class Storage { const DELETE_TRIGGER_QUOTA_EXCEEDED = 2; // files for which we can remove the versions after the delete operation was successful - private static $deletedFiles = array(); + private static $deletedFiles = []; - private static $sourcePathAndUser = array(); + private static $sourcePathAndUser = []; - private static $max_versions_per_interval = array( + private static $max_versions_per_interval = [ //first 10sec, one version every 2sec - 1 => array('intervalEndsAfter' => 10, 'step' => 2), + 1 => ['intervalEndsAfter' => 10, 'step' => 2], //next minute, one version every 10sec - 2 => array('intervalEndsAfter' => 60, 'step' => 10), + 2 => ['intervalEndsAfter' => 60, 'step' => 10], //next hour, one version every minute - 3 => array('intervalEndsAfter' => 3600, 'step' => 60), + 3 => ['intervalEndsAfter' => 3600, 'step' => 60], //next 24h, one version every hour - 4 => array('intervalEndsAfter' => 86400, 'step' => 3600), + 4 => ['intervalEndsAfter' => 86400, 'step' => 3600], //next 30days, one version per day - 5 => array('intervalEndsAfter' => 2592000, 'step' => 86400), + 5 => ['intervalEndsAfter' => 2592000, 'step' => 86400], //until the end one version per week - 6 => array('intervalEndsAfter' => -1, 'step' => 604800), - ); + 6 => ['intervalEndsAfter' => -1, 'step' => 604800], + ]; /** @var \OCA\Files_Versions\AppInfo\Application */ private static $application; @@ -129,7 +129,7 @@ public static function getUidAndFilename($filename) { */ public static function setSourcePathAndUser($source) { list($uid, $path) = self::getUidAndFilename($source); - self::$sourcePathAndUser[$source] = array('uid' => $uid, 'path' => $path); + self::$sourcePathAndUser[$source] = ['uid' => $uid, 'path' => $path]; } /** @@ -147,7 +147,7 @@ public static function getSourcePathAndUser($source) { } else { $uid = $path = false; } - return array($uid, $path); + return [$uid, $path]; } /** @@ -215,9 +215,9 @@ public static function store($filename) { */ public static function markDeletedFile($path) { list($uid, $filename) = self::getUidAndFilename($path); - self::$deletedFiles[$path] = array( + self::$deletedFiles[$path] = [ 'uid' => $uid, - 'filename' => $filename); + 'filename' => $filename]; } /** @@ -253,9 +253,9 @@ public static function delete($path) { $versions = self::getVersions($uid, $filename); if (!empty($versions)) { foreach ($versions as $v) { - \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED)); + \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]); self::deleteVersion($view, $filename . '.v' . $v['version']); - \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED)); + \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]); } } } @@ -378,11 +378,11 @@ public static function rollback(string $file, int $revision, IUser $user) { $node = $userFolder->get($file); // TODO: move away from those legacy hooks! - \OC_Hook::emit('\OCP\Versions', 'rollback', array( + \OC_Hook::emit('\OCP\Versions', 'rollback', [ 'path' => $filename, 'revision' => $revision, 'node' => $node, - )); + ]); return true; } else if ($versionCreated) { self::deleteVersion($users_view, $version); @@ -439,7 +439,7 @@ private static function copyFileContents($view, $path1, $path2) { * @return array versions newest version first */ public static function getVersions($uid, $filename, $userFullPath = '') { - $versions = array(); + $versions = []; if (empty($filename)) { return $versions; } @@ -518,9 +518,9 @@ public static function expireOlderThanMaxForUser($uid){ $view = new View('/' . $uid . '/files_versions'); if (!empty($toDelete)) { foreach ($toDelete as $version) { - \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT)); + \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]); self::deleteVersion($view, $version['path'] . '.v' . $version['version']); - \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT)); + \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]); } } } @@ -559,8 +559,8 @@ private static function getHumanReadableTimestamp($timestamp) { */ private static function getAllVersions($uid) { $view = new View('/' . $uid . '/'); - $dirs = array(self::VERSIONS_ROOT); - $versions = array(); + $dirs = [self::VERSIONS_ROOT]; + $versions = []; while (!empty($dirs)) { $dir = array_pop($dirs); @@ -577,7 +577,7 @@ private static function getAllVersions($uid) { $version = substr($filePath, $versionsBegin + 2); $relpath = substr($filePath, $relPathStart, $versionsBegin - $relPathStart); $key = $version . '#' . $relpath; - $versions[$key] = array('path' => $relpath, 'timestamp' => $version); + $versions[$key] = ['path' => $relpath, 'timestamp' => $version]; } } } @@ -585,7 +585,7 @@ private static function getAllVersions($uid) { // newest version first krsort($versions); - $result = array(); + $result = []; foreach ($versions as $key => $value) { $size = $view->filesize(self::VERSIONS_ROOT.'/'.$value['path'].'.v'.$value['timestamp']); @@ -638,7 +638,7 @@ protected static function getExpireList($time, $versions, $quotaExceeded = false */ protected static function getAutoExpireList($time, $versions) { $size = 0; - $toDelete = array(); // versions we want to delete + $toDelete = []; // versions we want to delete $interval = 1; $step = Storage::$max_versions_per_interval[$interval]['step']; @@ -682,7 +682,7 @@ protected static function getAutoExpireList($time, $versions) { } } - return array($toDelete, $size); + return [$toDelete, $size]; } /** @@ -791,9 +791,9 @@ public static function expire($filename, $uid) { $logger = \OC::$server->getLogger(); foreach($toDelete as $key => $path) { - \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); + \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); self::deleteVersion($versionsFileview, $path); - \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); + \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); unset($allVersions[$key]); // update array with the versions we keep $logger->info('Expire: ' . $path, ['app' => 'files_versions']); } @@ -808,9 +808,9 @@ public static function expire($filename, $uid) { reset($allVersions); while ($availableSpace < 0 && $i < $numOfVersions) { $version = current($allVersions); - \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); + \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']); - \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); + \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); \OC::$server->getLogger()->info('running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'], ['app' => 'files_versions']); $versionsSize -= $version['size']; $availableSpace += $version['size']; diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php index b5ed6c33a07c3..94f54f96d8968 100644 --- a/apps/files_versions/tests/Command/CleanupTest.php +++ b/apps/files_versions/tests/Command/CleanupTest.php @@ -90,10 +90,10 @@ public function testDeleteVersions($nodeExists) { } public function dataTestDeleteVersions() { - return array( - array(true), - array(false) - ); + return [ + [true], + [false] + ]; } diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index 53179bd6b30b1..c7eaec0a6994b 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -159,121 +159,121 @@ public function testGetExpireList($versions, $sizeOfAllDeletedFiles) { } public function versionsProvider() { - return array( + return [ // first set of versions uniformly distributed versions - array( - array( + [ + [ // first slice (10sec) keep one version every 2 seconds - array("version" => 4999999, "path" => "keep", "size" => 1), - array("version" => 4999998, "path" => "delete", "size" => 1), - array("version" => 4999997, "path" => "keep", "size" => 1), - array("version" => 4999995, "path" => "keep", "size" => 1), - array("version" => 4999994, "path" => "delete", "size" => 1), + ["version" => 4999999, "path" => "keep", "size" => 1], + ["version" => 4999998, "path" => "delete", "size" => 1], + ["version" => 4999997, "path" => "keep", "size" => 1], + ["version" => 4999995, "path" => "keep", "size" => 1], + ["version" => 4999994, "path" => "delete", "size" => 1], //next slice (60sec) starts at 4999990 keep one version every 10 secons - array("version" => 4999988, "path" => "keep", "size" => 1), - array("version" => 4999978, "path" => "keep", "size" => 1), - array("version" => 4999975, "path" => "delete", "size" => 1), - array("version" => 4999972, "path" => "delete", "size" => 1), - array("version" => 4999967, "path" => "keep", "size" => 1), - array("version" => 4999958, "path" => "delete", "size" => 1), - array("version" => 4999957, "path" => "keep", "size" => 1), + ["version" => 4999988, "path" => "keep", "size" => 1], + ["version" => 4999978, "path" => "keep", "size" => 1], + ["version" => 4999975, "path" => "delete", "size" => 1], + ["version" => 4999972, "path" => "delete", "size" => 1], + ["version" => 4999967, "path" => "keep", "size" => 1], + ["version" => 4999958, "path" => "delete", "size" => 1], + ["version" => 4999957, "path" => "keep", "size" => 1], //next slice (3600sec) start at 4999940 keep one version every 60 seconds - array("version" => 4999900, "path" => "keep", "size" => 1), - array("version" => 4999841, "path" => "delete", "size" => 1), - array("version" => 4999840, "path" => "keep", "size" => 1), - array("version" => 4999780, "path" => "keep", "size" => 1), - array("version" => 4996401, "path" => "keep", "size" => 1), + ["version" => 4999900, "path" => "keep", "size" => 1], + ["version" => 4999841, "path" => "delete", "size" => 1], + ["version" => 4999840, "path" => "keep", "size" => 1], + ["version" => 4999780, "path" => "keep", "size" => 1], + ["version" => 4996401, "path" => "keep", "size" => 1], // next slice (86400sec) start at 4996400 keep one version every 3600 seconds - array("version" => 4996350, "path" => "delete", "size" => 1), - array("version" => 4992800, "path" => "keep", "size" => 1), - array("version" => 4989800, "path" => "delete", "size" => 1), - array("version" => 4989700, "path" => "delete", "size" => 1), - array("version" => 4989200, "path" => "keep", "size" => 1), + ["version" => 4996350, "path" => "delete", "size" => 1], + ["version" => 4992800, "path" => "keep", "size" => 1], + ["version" => 4989800, "path" => "delete", "size" => 1], + ["version" => 4989700, "path" => "delete", "size" => 1], + ["version" => 4989200, "path" => "keep", "size" => 1], // next slice (2592000sec) start at 4913600 keep one version every 86400 seconds - array("version" => 4913600, "path" => "keep", "size" => 1), - array("version" => 4852800, "path" => "delete", "size" => 1), - array("version" => 4827201, "path" => "delete", "size" => 1), - array("version" => 4827200, "path" => "keep", "size" => 1), - array("version" => 4777201, "path" => "delete", "size" => 1), - array("version" => 4777501, "path" => "delete", "size" => 1), - array("version" => 4740000, "path" => "keep", "size" => 1), + ["version" => 4913600, "path" => "keep", "size" => 1], + ["version" => 4852800, "path" => "delete", "size" => 1], + ["version" => 4827201, "path" => "delete", "size" => 1], + ["version" => 4827200, "path" => "keep", "size" => 1], + ["version" => 4777201, "path" => "delete", "size" => 1], + ["version" => 4777501, "path" => "delete", "size" => 1], + ["version" => 4740000, "path" => "keep", "size" => 1], // final slice starts at 2408000 keep one version every 604800 secons - array("version" => 2408000, "path" => "keep", "size" => 1), - array("version" => 1803201, "path" => "delete", "size" => 1), - array("version" => 1803200, "path" => "keep", "size" => 1), - array("version" => 1800199, "path" => "delete", "size" => 1), - array("version" => 1800100, "path" => "delete", "size" => 1), - array("version" => 1198300, "path" => "keep", "size" => 1), - ), + ["version" => 2408000, "path" => "keep", "size" => 1], + ["version" => 1803201, "path" => "delete", "size" => 1], + ["version" => 1803200, "path" => "keep", "size" => 1], + ["version" => 1800199, "path" => "delete", "size" => 1], + ["version" => 1800100, "path" => "delete", "size" => 1], + ["version" => 1198300, "path" => "keep", "size" => 1], + ], 16 // size of all deleted files (every file has the size 1) - ), + ], // second set of versions, here we have only really old versions - array( - array( + [ + [ // first slice (10sec) keep one version every 2 seconds // next slice (60sec) starts at 4999990 keep one version every 10 secons // next slice (3600sec) start at 4999940 keep one version every 60 seconds // next slice (86400sec) start at 4996400 keep one version every 3600 seconds - array("version" => 4996400, "path" => "keep", "size" => 1), - array("version" => 4996350, "path" => "delete", "size" => 1), - array("version" => 4996350, "path" => "delete", "size" => 1), - array("version" => 4992800, "path" => "keep", "size" => 1), - array("version" => 4989800, "path" => "delete", "size" => 1), - array("version" => 4989700, "path" => "delete", "size" => 1), - array("version" => 4989200, "path" => "keep", "size" => 1), + ["version" => 4996400, "path" => "keep", "size" => 1], + ["version" => 4996350, "path" => "delete", "size" => 1], + ["version" => 4996350, "path" => "delete", "size" => 1], + ["version" => 4992800, "path" => "keep", "size" => 1], + ["version" => 4989800, "path" => "delete", "size" => 1], + ["version" => 4989700, "path" => "delete", "size" => 1], + ["version" => 4989200, "path" => "keep", "size" => 1], // next slice (2592000sec) start at 4913600 keep one version every 86400 seconds - array("version" => 4913600, "path" => "keep", "size" => 1), - array("version" => 4852800, "path" => "delete", "size" => 1), - array("version" => 4827201, "path" => "delete", "size" => 1), - array("version" => 4827200, "path" => "keep", "size" => 1), - array("version" => 4777201, "path" => "delete", "size" => 1), - array("version" => 4777501, "path" => "delete", "size" => 1), - array("version" => 4740000, "path" => "keep", "size" => 1), + ["version" => 4913600, "path" => "keep", "size" => 1], + ["version" => 4852800, "path" => "delete", "size" => 1], + ["version" => 4827201, "path" => "delete", "size" => 1], + ["version" => 4827200, "path" => "keep", "size" => 1], + ["version" => 4777201, "path" => "delete", "size" => 1], + ["version" => 4777501, "path" => "delete", "size" => 1], + ["version" => 4740000, "path" => "keep", "size" => 1], // final slice starts at 2408000 keep one version every 604800 secons - array("version" => 2408000, "path" => "keep", "size" => 1), - array("version" => 1803201, "path" => "delete", "size" => 1), - array("version" => 1803200, "path" => "keep", "size" => 1), - array("version" => 1800199, "path" => "delete", "size" => 1), - array("version" => 1800100, "path" => "delete", "size" => 1), - array("version" => 1198300, "path" => "keep", "size" => 1), - ), + ["version" => 2408000, "path" => "keep", "size" => 1], + ["version" => 1803201, "path" => "delete", "size" => 1], + ["version" => 1803200, "path" => "keep", "size" => 1], + ["version" => 1800199, "path" => "delete", "size" => 1], + ["version" => 1800100, "path" => "delete", "size" => 1], + ["version" => 1198300, "path" => "keep", "size" => 1], + ], 11 // size of all deleted files (every file has the size 1) - ), + ], // third set of versions, with some gaps between - array( - array( + [ + [ // first slice (10sec) keep one version every 2 seconds - array("version" => 4999999, "path" => "keep", "size" => 1), - array("version" => 4999998, "path" => "delete", "size" => 1), - array("version" => 4999997, "path" => "keep", "size" => 1), - array("version" => 4999995, "path" => "keep", "size" => 1), - array("version" => 4999994, "path" => "delete", "size" => 1), + ["version" => 4999999, "path" => "keep", "size" => 1], + ["version" => 4999998, "path" => "delete", "size" => 1], + ["version" => 4999997, "path" => "keep", "size" => 1], + ["version" => 4999995, "path" => "keep", "size" => 1], + ["version" => 4999994, "path" => "delete", "size" => 1], //next slice (60sec) starts at 4999990 keep one version every 10 secons - array("version" => 4999988, "path" => "keep", "size" => 1), - array("version" => 4999978, "path" => "keep", "size" => 1), + ["version" => 4999988, "path" => "keep", "size" => 1], + ["version" => 4999978, "path" => "keep", "size" => 1], //next slice (3600sec) start at 4999940 keep one version every 60 seconds // next slice (86400sec) start at 4996400 keep one version every 3600 seconds - array("version" => 4989200, "path" => "keep", "size" => 1), + ["version" => 4989200, "path" => "keep", "size" => 1], // next slice (2592000sec) start at 4913600 keep one version every 86400 seconds - array("version" => 4913600, "path" => "keep", "size" => 1), - array("version" => 4852800, "path" => "delete", "size" => 1), - array("version" => 4827201, "path" => "delete", "size" => 1), - array("version" => 4827200, "path" => "keep", "size" => 1), - array("version" => 4777201, "path" => "delete", "size" => 1), - array("version" => 4777501, "path" => "delete", "size" => 1), - array("version" => 4740000, "path" => "keep", "size" => 1), + ["version" => 4913600, "path" => "keep", "size" => 1], + ["version" => 4852800, "path" => "delete", "size" => 1], + ["version" => 4827201, "path" => "delete", "size" => 1], + ["version" => 4827200, "path" => "keep", "size" => 1], + ["version" => 4777201, "path" => "delete", "size" => 1], + ["version" => 4777501, "path" => "delete", "size" => 1], + ["version" => 4740000, "path" => "keep", "size" => 1], // final slice starts at 2408000 keep one version every 604800 secons - array("version" => 2408000, "path" => "keep", "size" => 1), - array("version" => 1803201, "path" => "delete", "size" => 1), - array("version" => 1803200, "path" => "keep", "size" => 1), - array("version" => 1800199, "path" => "delete", "size" => 1), - array("version" => 1800100, "path" => "delete", "size" => 1), - array("version" => 1198300, "path" => "keep", "size" => 1), - ), + ["version" => 2408000, "path" => "keep", "size" => 1], + ["version" => 1803201, "path" => "delete", "size" => 1], + ["version" => 1803200, "path" => "keep", "size" => 1], + ["version" => 1800199, "path" => "delete", "size" => 1], + ["version" => 1800100, "path" => "delete", "size" => 1], + ["version" => 1198300, "path" => "keep", "size" => 1], + ], 9 // size of all deleted files (every file has the size 1) - ), + ], - ); + ]; } public function testRename() { @@ -647,8 +647,8 @@ public function testRestoreSameStorage() { } public function testRestoreCrossStorage() { - $storage2 = new Temporary(array()); - \OC\Files\Filesystem::mount($storage2, array(), self::TEST_VERSIONS_USER . '/files/sub'); + $storage2 = new Temporary([]); + \OC\Files\Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub'); $this->doTestRestore(); } @@ -787,13 +787,13 @@ private function doTestRestore() { $this->assertEquals('test file', $this->rootView->file_get_contents($filePath)); $info1 = $this->rootView->getFileInfo($filePath); - $params = array(); + $params = []; $this->connectMockHooks('rollback', $params); $this->assertTrue(\OCA\Files_Versions\Storage::rollback('sub/test.txt', $t2, $this->user1)); - $expectedParams = array( + $expectedParams = [ 'path' => '/sub/test.txt', - ); + ]; $this->assertEquals($expectedParams['path'], $params['path']); $this->assertTrue(array_key_exists('revision', $params)); diff --git a/apps/provisioning_api/lib/AppInfo/Application.php b/apps/provisioning_api/lib/AppInfo/Application.php index 63ea0b5e76ee4..a2dfa5bac41c0 100644 --- a/apps/provisioning_api/lib/AppInfo/Application.php +++ b/apps/provisioning_api/lib/AppInfo/Application.php @@ -36,7 +36,7 @@ use OCP\Util; class Application extends App { - public function __construct(array $urlParams = array()) { + public function __construct(array $urlParams = []) { parent::__construct('provisioning_api', $urlParams); $container = $this->getContainer(); diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php index 7c9de539c7c19..e54025856fed0 100644 --- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php @@ -101,7 +101,7 @@ public function testGetAppsDisabled() { $result = $this->api->getApps('disabled'); $data = $result->getData(); $apps = (new \OC_App)->listAllApps(); - $list = array(); + $list = []; foreach($apps as $app) { $list[] = $app['id']; } diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index 5416e686ee346..bb50786ee868e 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -241,15 +241,15 @@ public function testGetGroupsDetails($search, $limit, $offset) { $result = $this->api->getGroupsDetails($search, $limit, $offset); $this->assertEquals(['groups' => [ - Array( + [ 'id' => 'group1', 'displayname' => 'group1-name', 'usercount' => 123, 'disabled' => 11, 'canAdd' => true, 'canRemove' => true - ), - Array( + ], + [ 'id' => 'group2', 'displayname' => 'group2-name', 'usercount' => 123, @@ -257,7 +257,7 @@ public function testGetGroupsDetails($search, $limit, $offset) { 'canAdd' => true, 'canRemove' => true - ) + ] ]], $result->getData()); } diff --git a/apps/provisioning_api/tests/TestCase.php b/apps/provisioning_api/tests/TestCase.php index 12580abd75742..3d1310ca5d001 100644 --- a/apps/provisioning_api/tests/TestCase.php +++ b/apps/provisioning_api/tests/TestCase.php @@ -32,7 +32,7 @@ abstract class TestCase extends \Test\TestCase { /** @var IUser[] */ - protected $users = array(); + protected $users = []; /** @var IUserManager */ protected $userManager; @@ -54,7 +54,7 @@ protected function setUp(): void { * @return IUser[]|IUser */ protected function generateUsers($num = 1) { - $users = array(); + $users = []; for ($i = 0; $i < $num; $i++) { $user = $this->userManager->createUser($this->getUniqueID(), 'password'); $this->users[] = $user; diff --git a/apps/settings/lib/Controller/AdminSettingsController.php b/apps/settings/lib/Controller/AdminSettingsController.php index acc44501e642c..e7b1a27a63776 100644 --- a/apps/settings/lib/Controller/AdminSettingsController.php +++ b/apps/settings/lib/Controller/AdminSettingsController.php @@ -101,15 +101,15 @@ private function getLegacyForms() { $anchor = strtolower($sectionName); $anchor = str_replace(' ', '-', $anchor); - return array( + return [ 'anchor' => $anchor, 'section-name' => $sectionName, 'form' => $form - ); + ]; } - return array( + return [ 'form' => $form - ); + ]; }, $forms); $out = new Template('settings', 'settings/additional'); diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 47067a9fcf59a..fc92fe8c77523 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -258,7 +258,7 @@ public function listApps(): JSONResponse { } // fix groups to be an array - $groups = array(); + $groups = []; if (is_string($appData['groups'])) { $groups = json_decode($appData['groups']); } diff --git a/apps/settings/lib/Controller/PersonalSettingsController.php b/apps/settings/lib/Controller/PersonalSettingsController.php index 18719a8565236..12d8af3af17a4 100644 --- a/apps/settings/lib/Controller/PersonalSettingsController.php +++ b/apps/settings/lib/Controller/PersonalSettingsController.php @@ -94,15 +94,15 @@ private function getLegacyForms() { $anchor = strtolower($sectionName); $anchor = str_replace(' ', '-', $anchor); - return array( + return [ 'anchor' => $anchor, 'section-name' => $sectionName, 'form' => $form - ); + ]; } - return array( + return [ 'form' => $form - ); + ]; }, $forms); $out = new Template('settings', 'settings/additional'); diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index cfbe35eb201c7..3f6bcd3a46c38 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -226,7 +226,7 @@ public function usersList() { $languages = $this->l10nFactory->getLanguages(); /* FINAL DATA */ - $serverData = array(); + $serverData = []; // groups $serverData['groups'] = array_merge_recursive($adminGroup, [$disabledUsersGroup], $groups); // Various data diff --git a/apps/settings/lib/Middleware/SubadminMiddleware.php b/apps/settings/lib/Middleware/SubadminMiddleware.php index ab1b6b5c745a3..ffc507e50e0a5 100644 --- a/apps/settings/lib/Middleware/SubadminMiddleware.php +++ b/apps/settings/lib/Middleware/SubadminMiddleware.php @@ -82,7 +82,7 @@ public function beforeController($controller, $methodName) { */ public function afterException($controller, $methodName, \Exception $exception) { if($exception instanceof NotAdminException) { - $response = new TemplateResponse('core', '403', array(), 'guest'); + $response = new TemplateResponse('core', '403', [], 'guest'); $response->setStatus(Http::STATUS_FORBIDDEN); return $response; } diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index c8d9b3f812849..69363cdd08f1b 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -220,7 +220,7 @@ private function getLanguages(IUser $user) { } return array_merge( - array('activelanguage' => $userLang), + ['activelanguage' => $userLang], $languages ); } diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 46769434f4229..5e59bfe353aff 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -969,7 +969,7 @@ public function testGetFailedIntegrityCheckFilesWithSomeErrorsFound() { $this->checker ->expects($this->once()) ->method('getResults') - ->willReturn(array ( 'core' => array ( 'EXTRA_FILE' => array('/testfile' => array()), 'INVALID_HASH' => array ( '/.idea/workspace.xml' => array ( 'expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094', ), '/lib/private/integritycheck/checker.php' => array ( 'expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585', ), '/settings/controller/checksetupcontroller.php' => array ( 'expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a', ), ), ), 'bookmarks' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'dav' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'encryption' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'external' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'federation' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_antivirus' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_drop' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_external' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_pdfviewer' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_sharing' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_trashbin' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_versions' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_videoviewer' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'firstrunwizard' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'gitsmart' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'logreader' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.', ), ), 'password_policy' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'provisioning_api' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'sketch' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'threatblock' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'two_factor_auth' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'user_ldap' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'user_shibboleth' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), )); + ->willReturn( [ 'core' => [ 'EXTRA_FILE' => ['/testfile' => []], 'INVALID_HASH' => [ '/.idea/workspace.xml' => [ 'expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094', ], '/lib/private/integritycheck/checker.php' => [ 'expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585', ], '/settings/controller/checksetupcontroller.php' => [ 'expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a', ], ], ], 'bookmarks' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'dav' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'encryption' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'external' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'federation' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_antivirus' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_drop' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_external' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_pdfviewer' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_sharing' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_trashbin' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_versions' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_videoviewer' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'firstrunwizard' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'gitsmart' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'logreader' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.', ], ], 'password_policy' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'provisioning_api' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'sketch' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'threatblock' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'two_factor_auth' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'user_ldap' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'user_shibboleth' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], ]); $expected = new DataDisplayResponse( 'Technical information diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php index 8b40f002c3209..ad68d3b615ea5 100644 --- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php +++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php @@ -105,7 +105,7 @@ public function testBeforeControllerAsSubAdminWithExemption() { } public function testAfterNotAdminException() { - $expectedResponse = new TemplateResponse('core', '403', array(), 'guest'); + $expectedResponse = new TemplateResponse('core', '403', [], 'guest'); $expectedResponse->setStatus(403); $this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new NotAdminException(''))); } @@ -114,7 +114,7 @@ public function testAfterNotAdminException() { public function testAfterRegularException() { $this->expectException(\Exception::class); - $expectedResponse = new TemplateResponse('core', '403', array(), 'guest'); + $expectedResponse = new TemplateResponse('core', '403', [], 'guest'); $expectedResponse->setStatus(403); $this->subadminMiddleware->afterException($this->controller, 'foo', new \Exception()); } diff --git a/apps/sharebymail/lib/AppInfo/Application.php b/apps/sharebymail/lib/AppInfo/Application.php index c654686002842..e24743aa40b55 100644 --- a/apps/sharebymail/lib/AppInfo/Application.php +++ b/apps/sharebymail/lib/AppInfo/Application.php @@ -33,7 +33,7 @@ class Application extends App { - public function __construct(array $urlParams = array()) { + public function __construct(array $urlParams = []) { parent::__construct('sharebymail', $urlParams); $settingsManager = \OC::$server->query(Settings\SettingsManager::class); diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index d2465a5797b45..9f0362f1908e4 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -180,7 +180,7 @@ public function create(IShare $share) { $alreadyShared = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_EMAIL, $share->getNode(), 1, 0); if (!empty($alreadyShared)) { $message = 'Sharing %1$s failed, this item is already shared with %2$s'; - $message_t = $this->l->t('Sharing %1$s failed, this item is already shared with %2$s', array($share->getNode()->getName(), $shareWith)); + $message_t = $this->l->t('Sharing %1$s failed, this item is already shared with %2$s', [$share->getNode()->getName(), $shareWith]); $this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']); throw new \Exception($message_t); } @@ -416,7 +416,7 @@ protected function sendMailNotification($filename, 'shareWith' => $shareWith, ]); - $emailTemplate->setSubject($this->l->t('%1$s shared »%2$s« with you', array($initiatorDisplayName, $filename))); + $emailTemplate->setSubject($this->l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename])); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]), false); $text = $this->l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); diff --git a/apps/testing/lib/AppInfo/Application.php b/apps/testing/lib/AppInfo/Application.php index da34d419d32a9..79ee279170a3d 100644 --- a/apps/testing/lib/AppInfo/Application.php +++ b/apps/testing/lib/AppInfo/Application.php @@ -27,7 +27,7 @@ use OCP\AppFramework\App; class Application extends App { - public function __construct (array $urlParams = array()) { + public function __construct (array $urlParams = []) { $appName = 'testing'; parent::__construct($appName, $urlParams); diff --git a/apps/theming/appinfo/routes.php b/apps/theming/appinfo/routes.php index 30dcf3d5a4fb8..c61f776ac09d7 100644 --- a/apps/theming/appinfo/routes.php +++ b/apps/theming/appinfo/routes.php @@ -62,25 +62,25 @@ 'name' => 'Theming#getManifest', 'url' => '/manifest/{app}', 'verb' => 'GET', - 'defaults' => array('app' => 'core') + 'defaults' => ['app' => 'core'] ], [ 'name' => 'Icon#getFavicon', 'url' => '/favicon/{app}', 'verb' => 'GET', - 'defaults' => array('app' => 'core'), + 'defaults' => ['app' => 'core'], ], [ 'name' => 'Icon#getTouchIcon', 'url' => '/icon/{app}', 'verb' => 'GET', - 'defaults' => array('app' => 'core'), + 'defaults' => ['app' => 'core'], ], [ 'name' => 'Icon#getThemedIcon', 'url' => '/img/{app}/{image}', 'verb' => 'GET', - 'requirements' => array('image' => '.+') + 'requirements' => ['image' => '.+'] ], ]]; diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php index 9e4efb6a4dc91..0a60d9f38f808 100644 --- a/apps/theming/lib/Util.php +++ b/apps/theming/lib/Util.php @@ -142,7 +142,7 @@ public function generateRadioButton($color) { * @return string|ISimpleFile path to app icon / file of logo */ public function getAppIcon($app) { - $app = str_replace(array('\0', '/', '\\', '..'), '', $app); + $app = str_replace(['\0', '/', '\\', '..'], '', $app); try { $appPath = $this->appManager->getAppPath($app); $icon = $appPath . '/img/' . $app . '.svg'; @@ -173,8 +173,8 @@ public function getAppIcon($app) { * @return string|false absolute path to image */ public function getAppImage($app, $image) { - $app = str_replace(array('\0', '/', '\\', '..'), '', $app); - $image = str_replace(array('\0', '\\', '..'), '', $image); + $app = str_replace(['\0', '/', '\\', '..'], '', $app); + $image = str_replace(['\0', '\\', '..'], '', $image); if ($app === "core") { $icon = \OC::$SERVERROOT . '/core/img/' . $image; if (file_exists($icon)) { diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php index 3e98162904c6f..f847b818db070 100644 --- a/apps/user_ldap/ajax/clearMappings.php +++ b/apps/user_ldap/ajax/clearMappings.php @@ -56,5 +56,5 @@ function ($uid) { } \OC_JSON::success(); } catch (\Exception $e) { - \OC_JSON::error(array('message' => $e->getMessage())); + \OC_JSON::error(['message' => $e->getMessage()]); } diff --git a/apps/user_ldap/ajax/deleteConfiguration.php b/apps/user_ldap/ajax/deleteConfiguration.php index d6bce7439f7d5..c2bf4f265d07c 100644 --- a/apps/user_ldap/ajax/deleteConfiguration.php +++ b/apps/user_ldap/ajax/deleteConfiguration.php @@ -36,5 +36,5 @@ \OC_JSON::success(); } else { $l = \OC::$server->getL10N('user_ldap'); - \OC_JSON::error(array('message' => $l->t('Failed to delete the server configuration'))); + \OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]); } diff --git a/apps/user_ldap/ajax/getConfiguration.php b/apps/user_ldap/ajax/getConfiguration.php index b8ed917de6ed7..8c9a3a6c3f64e 100644 --- a/apps/user_ldap/ajax/getConfiguration.php +++ b/apps/user_ldap/ajax/getConfiguration.php @@ -38,4 +38,4 @@ // hide password $configuration['ldap_agent_password'] = '**PASSWORD SET**'; } -\OC_JSON::success(array('configuration' => $configuration)); +\OC_JSON::success(['configuration' => $configuration]); diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index 9c6f63fc3de8e..9d93b2b89712e 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -35,7 +35,7 @@ $ln = (int)str_replace('s', '', $lk); $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT); -$resultData = array('configPrefix' => $nk); +$resultData = ['configPrefix' => $nk]; $newConfig = new \OCA\User_LDAP\Configuration($nk, false); if(isset($_POST['copyConfig'])) { diff --git a/apps/user_ldap/ajax/setConfiguration.php b/apps/user_ldap/ajax/setConfiguration.php index 31aa80d094539..fd8a2b0c1b578 100644 --- a/apps/user_ldap/ajax/setConfiguration.php +++ b/apps/user_ldap/ajax/setConfiguration.php @@ -35,8 +35,8 @@ // Checkboxes are not submitted, when they are unchecked. Set them manually. // only legacy checkboxes (Advanced and Expert tab) need to be handled here, // the Wizard-like tabs handle it on their own -$chkboxes = array('ldap_configuration_active', 'ldap_override_main_server', - 'ldap_turn_off_cert_check'); +$chkboxes = ['ldap_configuration_active', 'ldap_override_main_server', + 'ldap_turn_off_cert_check']; foreach($chkboxes as $boxid) { if(!isset($_POST[$boxid])) { $_POST[$boxid] = 0; diff --git a/apps/user_ldap/ajax/testConfiguration.php b/apps/user_ldap/ajax/testConfiguration.php index 00393ff66e387..a21cb4075584c 100644 --- a/apps/user_ldap/ajax/testConfiguration.php +++ b/apps/user_ldap/ajax/testConfiguration.php @@ -66,23 +66,23 @@ * pass (like e.g. expected syntax error). */ try { - $ldapWrapper->read($connection->getConnectionResource(), '', 'objectClass=*', array('dn')); + $ldapWrapper->read($connection->getConnectionResource(), '', 'objectClass=*', ['dn']); } catch (\Exception $e) { if($e->getCode() === 1) { - \OC_JSON::error(array('message' => $l->t('Invalid configuration: Anonymous binding is not allowed.'))); + \OC_JSON::error(['message' => $l->t('Invalid configuration: Anonymous binding is not allowed.')]); exit; } } - \OC_JSON::success(array('message' - => $l->t('Valid configuration, connection established!'))); + \OC_JSON::success(['message' + => $l->t('Valid configuration, connection established!')]); } else { - \OC_JSON::error(array('message' - => $l->t('Valid configuration, but binding failed. Please check the server settings and credentials.'))); + \OC_JSON::error(['message' + => $l->t('Valid configuration, but binding failed. Please check the server settings and credentials.')]); } } else { - \OC_JSON::error(array('message' - => $l->t('Invalid configuration. Please have a look at the logs for further details.'))); + \OC_JSON::error(['message' + => $l->t('Invalid configuration. Please have a look at the logs for further details.')]); } } catch (\Exception $e) { - \OC_JSON::error(array('message' => $e->getMessage())); + \OC_JSON::error(['message' => $e->getMessage()]); } diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index 3cce732f07056..1756e978de26f 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -36,13 +36,13 @@ $l = \OC::$server->getL10N('user_ldap'); if(!isset($_POST['action'])) { - \OC_JSON::error(array('message' => $l->t('No action specified'))); + \OC_JSON::error(['message' => $l->t('No action specified')]); } $action = (string)$_POST['action']; if(!isset($_POST['ldap_serverconfig_chooser'])) { - \OC_JSON::error(array('message' => $l->t('No configuration specified'))); + \OC_JSON::error(['message' => $l->t('No configuration specified')]); } $prefix = (string)$_POST['ldap_serverconfig_chooser']; @@ -99,7 +99,7 @@ exit; } } catch (\Exception $e) { - \OC_JSON::error(array('message' => $e->getMessage(), 'code' => $e->getCode())); + \OC_JSON::error(['message' => $e->getMessage(), 'code' => $e->getCode()]); exit; } \OC_JSON::error(); @@ -115,7 +115,7 @@ exit; } } catch (\Exception $e) { - \OC_JSON::error(array('message' => $e->getMessage())); + \OC_JSON::error(['message' => $e->getMessage()]); exit; } \OC_JSON::error(); @@ -127,15 +127,15 @@ $key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false; $val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null; if($key === false || is_null($val)) { - \OC_JSON::error(array('message' => $l->t('No data specified'))); + \OC_JSON::error(['message' => $l->t('No data specified')]); exit; } - $cfg = array($key => $val); - $setParameters = array(); + $cfg = [$key => $val]; + $setParameters = []; $configuration->setConfiguration($cfg, $setParameters); if(!in_array($key, $setParameters)) { - \OC_JSON::error(array('message' => $l->t($key. - ' Could not set configuration %s', $setParameters[0]))); + \OC_JSON::error(['message' => $l->t($key. + ' Could not set configuration %s', $setParameters[0])]); exit; } $configuration->saveConfiguration(); @@ -145,6 +145,6 @@ \OC_JSON::success(); break; default: - \OC_JSON::error(array('message' => $l->t('Action does not exist'))); + \OC_JSON::error(['message' => $l->t('Action does not exist')]); break; } diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index a16e8f04cb21e..6f6e3648e30fc 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -75,7 +75,7 @@ class Access extends LDAPUtility { /** * @var string[] $cookies an array of returned Paged Result cookies */ - protected $cookies = array(); + protected $cookies = []; /** * @var string $lastCookie the last cookie returned from a Paged Results @@ -268,9 +268,9 @@ public function readAttribute($dn, $attr, $filter = 'objectClass=*') { * @throws ServerNotAvailableException */ public function executeRead($cr, $dn, $attribute, $filter, $maxResults) { - $this->initPagedSearch($filter, array($dn), array($attribute), $maxResults, 0); + $this->initPagedSearch($filter, [$dn], [$attribute], $maxResults, 0); $dn = $this->helper->DNasBaseParameter($dn); - $rr = @$this->invokeLDAPMethod('read', $cr, $dn, $filter, array($attribute)); + $rr = @$this->invokeLDAPMethod('read', $cr, $dn, $filter, [$attribute]); if (!$this->ldap->isResource($rr)) { if ($attribute !== '') { //do not throw this message on userExists check, irritates @@ -384,13 +384,13 @@ public function setPassword($userDN, $password) { * @return boolean if so true, otherwise false */ private function resemblesDN($attr) { - $resemblingAttributes = array( + $resemblingAttributes = [ 'dn', 'uniquemember', 'member', // memberOf is an "operational" attribute, without a definition in any RFC 'memberof' - ); + ]; return in_array($attr, $resemblingAttributes); } @@ -419,7 +419,7 @@ public function getDomainDNFromDN($dn) { //not a valid DN return ''; } - $domainParts = array(); + $domainParts = []; $dcFound = false; foreach($allParts as $part) { if(!$dcFound && strpos($part, 'dc=') === 0) { @@ -865,13 +865,13 @@ private function _createAltInternalOwnCloudNameForGroups($name) { */ private function createAltInternalOwnCloudName($name, $isUser) { $originalTTL = $this->connection->ldapCacheTTL; - $this->connection->setConfiguration(array('ldapCacheTTL' => 0)); + $this->connection->setConfiguration(['ldapCacheTTL' => 0]); if($isUser) { $altName = $this->_createAltInternalOwnCloudNameForUsers($name); } else { $altName = $this->_createAltInternalOwnCloudNameForGroups($name); } - $this->connection->setConfiguration(array('ldapCacheTTL' => $originalTTL)); + $this->connection->setConfiguration(['ldapCacheTTL' => $originalTTL]); return $altName; } @@ -884,7 +884,7 @@ private function createAltInternalOwnCloudName($name, $isUser) { * @param array $attributes optional, list of attributes to read * @return array */ - public function fetchUsersByLoginName($loginName, $attributes = array('dn')) { + public function fetchUsersByLoginName($loginName, $attributes = ['dn']) { $loginName = $this->escapeFilterPart($loginName); $filter = str_replace('%uid', $loginName, $this->connection->ldapLoginFilter); return $this->fetchListOfUsers($filter, $attributes); @@ -996,13 +996,13 @@ private function fetchList($list, $manyAttributes) { $attribute = array_keys($item)[0]; $carry[] = $item[$attribute][0]; return $carry; - }, array()); + }, []); return array_unique($list, SORT_LOCALE_STRING); } } //error cause actually, maybe throw an exception in future. - return array(); + return []; } /** @@ -1033,7 +1033,7 @@ public function searchUsers($filter, $attr = null, $limit = null, $offset = null * @return false|int * @throws ServerNotAvailableException */ - public function countUsers($filter, $attr = array('dn'), $limit = null, $offset = null) { + public function countUsers($filter, $attr = ['dn'], $limit = null, $offset = null) { $result = false; foreach($this->connection->ldapBaseUsers as $base) { $count = $this->count($filter, [$base], $attr, $limit, $offset); @@ -1072,7 +1072,7 @@ public function searchGroups($filter, $attr = null, $limit = null, $offset = nul * @return int|bool * @throws ServerNotAvailableException */ - public function countGroups($filter, $attr = array('dn'), $limit = null, $offset = null) { + public function countGroups($filter, $attr = ['dn'], $limit = null, $offset = null) { $result = false; foreach($this->connection->ldapBaseGroups as $base) { $count = $this->count($filter, [$base], $attr, $limit, $offset); @@ -1122,7 +1122,7 @@ private function invokeLDAPMethod() { if ($command == 'controlPagedResultResponse') { throw new \InvalidArgumentException('Invoker does not support controlPagedResultResponse, call LDAP Wrapper directly instead.'); } else { - return call_user_func_array(array($this->ldap, $command), $arguments); + return call_user_func_array([$this->ldap, $command], $arguments); } }; try { @@ -1162,7 +1162,7 @@ private function invokeLDAPMethod() { */ private function executeSearch($filter, $base, &$attr = null, $limit = null, $offset = null) { if(!is_null($attr) && !is_array($attr)) { - $attr = array(mb_strtolower($attr, 'UTF-8')); + $attr = [mb_strtolower($attr, 'UTF-8')]; } // See if we have a resource, in case not cancel with message @@ -1177,7 +1177,7 @@ private function executeSearch($filter, $base, &$attr = null, $limit = null, $of //check whether paged search should be attempted $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, (int)$limit, $offset); - $linkResources = array_pad(array(), count($base), $cr); + $linkResources = array_pad([], count($base), $cr); $sr = $this->invokeLDAPMethod('search', $linkResources, $base, $filter, $attr); // cannot use $cr anymore, might have changed in the previous call! $error = $this->ldap->errno($this->connection->getConnectionResource()); @@ -1186,7 +1186,7 @@ private function executeSearch($filter, $base, &$attr = null, $limit = null, $of return false; } - return array($sr, $pagedSearchOK); + return [$sr, $pagedSearchOK]; } /** @@ -1349,7 +1349,7 @@ public function search($filter, $base, $attr = null, $limit = null, $offset = nu $this->processPagedSearchStatus($sr, $filter, $base, 1, $limitPerPage, $offset, $pagedSearchOK, $skipHandling); - return array(); + return []; } $iFoundItems = 0; @@ -1370,7 +1370,7 @@ public function search($filter, $base, $attr = null, $limit = null, $offset = nu // if we're here, probably no connection resource is returned. // to make Nextcloud behave nicely, we simply give back an empty array. if(is_null($findings)) { - return array(); + return []; } if(!is_null($attr)) { @@ -1463,8 +1463,8 @@ public function escapeFilterPart($input, $allowAsterisk = false) { $asterisk = '*'; $input = mb_substr($input, 1, null, 'UTF-8'); } - $search = array('*', '\\', '(', ')'); - $replace = array('\\*', '\\\\', '\\(', '\\)'); + $search = ['*', '\\', '(', ')']; + $replace = ['\\*', '\\\\', '\\(', '\\)']; return $asterisk . str_replace($search, $replace, $input); } @@ -1541,11 +1541,11 @@ private function getAdvancedFilterPartForSearch($search, $searchAttributes) { throw new \Exception('searchAttributes must be an array with at least two string'); } $searchWords = explode(' ', trim($search)); - $wordFilters = array(); + $wordFilters = []; foreach($searchWords as $word) { $word = $this->prepareSearchTerm($word); //every word needs to appear at least once - $wordMatchOneAttrFilters = array(); + $wordMatchOneAttrFilters = []; foreach($searchAttributes as $attr) { $wordMatchOneAttrFilters[] = $attr . '=' . $word; } @@ -1563,7 +1563,7 @@ private function getAdvancedFilterPartForSearch($search, $searchAttributes) { * @return string the final filter part to use in LDAP searches */ private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) { - $filter = array(); + $filter = []; $haveMultiSearchAttributes = (is_array($searchAttributes) && count($searchAttributes) > 0); if($haveMultiSearchAttributes && strpos(trim($search), ' ') !== false) { try { @@ -1619,10 +1619,10 @@ private function prepareSearchTerm($term) { * @return string */ public function getFilterForUserCount() { - $filter = $this->combineFilterWithAnd(array( + $filter = $this->combineFilterWithAnd([ $this->connection->ldapUserFilter, $this->connection->ldapUserDisplayName . '=*' - )); + ]); return $filter; } @@ -1635,10 +1635,10 @@ public function getFilterForUserCount() { public function areCredentialsValid($name, $password) { $name = $this->helper->DNasBaseParameter($name); $testConnection = clone $this->connection; - $credentials = array( + $credentials = [ 'ldapAgentName' => $name, 'ldapAgentPassword' => $password - ); + ]; if(!$testConnection->setConfiguration($credentials)) { return false; } @@ -1919,7 +1919,7 @@ public function convertSID2Str($sid) { // precision (see https://gist.github.com/bantu/886ac680b0aef5812f71) $iav = number_format(hexdec(bin2hex(substr($sid, 2, 6))), 0, '', ''); - $subIDs = array(); + $subIDs = []; for ($i = 0; $i < $numberSubID; $i++) { $subID = unpack('V', substr($sid, $subIdStart + $subIdLength * $i, $subIdLength)); $subIDs[] = sprintf('%u', $subID[1]); @@ -2065,7 +2065,7 @@ private function initPagedSearch($filter, $bases, $attr, $limit, $offset) { // to start from 0 to come to the desired page. cookie value // of '0' is valid, because 389ds $reOffset = ($offset - $limit) < 0 ? 0 : $offset - $limit; - $this->search($filter, array($base), $attr, $limit, $reOffset, true); + $this->search($filter, [$base], $attr, $limit, $reOffset, true); $cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset); //still no cookie? obviously, the server does not like us. Let's skip paging efforts. // '0' is valid, because 389ds diff --git a/apps/user_ldap/lib/Command/ShowConfig.php b/apps/user_ldap/lib/Command/ShowConfig.php index fd33a0bc0dfe1..46d0898661703 100644 --- a/apps/user_ldap/lib/Command/ShowConfig.php +++ b/apps/user_ldap/lib/Command/ShowConfig.php @@ -94,8 +94,8 @@ protected function renderConfigs($configIDs, $output, $withPassword) { ksort($configuration); $table = new Table($output); - $table->setHeaders(array('Configuration', $id)); - $rows = array(); + $table->setHeaders(['Configuration', $id]); + $rows = []; foreach($configuration as $key => $value) { if($key === 'ldapAgentPassword' && !$withPassword) { $value = '***'; @@ -103,7 +103,7 @@ protected function renderConfigs($configIDs, $output, $withPassword) { if(is_array($value)) { $value = implode(';', $value); } - $rows[] = array($key, $value); + $rows[] = [$key, $value]; } $table->setRows($rows); $table->render($output); diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php index 67ff73d4e91af..b38d2e972a293 100644 --- a/apps/user_ldap/lib/Command/TestConfig.php +++ b/apps/user_ldap/lib/Command/TestConfig.php @@ -80,9 +80,9 @@ protected function testConfig($configID) { //ensure validation is run before we attempt the bind $connection->getConfiguration(); - if(!$connection->setConfiguration(array( + if(!$connection->setConfiguration([ 'ldap_configuration_active' => 1, - ))) { + ])) { return 1; } if($connection->bind()) { diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index 724f240847a93..9fa386a8215a6 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -53,7 +53,7 @@ class Configuration { protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive']; //settings - protected $config = array( + protected $config = [ 'ldapHost' => null, 'ldapPort' => null, 'ldapBackupHost' => null, @@ -109,7 +109,7 @@ class Configuration { 'ldapDynamicGroupMemberURL' => null, 'ldapDefaultPPolicyDN' => null, 'ldapExtStorageHomeAttribute' => null, - ); + ]; /** * @param string $configPrefix @@ -138,7 +138,7 @@ public function __get($name) { * @param mixed $value */ public function __set($name, $value) { - $this->setConfiguration(array($name => $value)); + $this->setConfiguration([$name => $value]); } /** @@ -426,7 +426,7 @@ protected function saveValue($varName, $value) { * to config-value entries in the database table */ public function getDefaults() { - return array( + return [ 'ldap_host' => '', 'ldap_port' => '', 'ldap_backup_host' => '', @@ -481,7 +481,7 @@ public function getDefaults() { 'ldap_default_ppolicy_dn' => '', 'ldap_user_avatar_rule' => 'default', 'ldap_ext_storage_home_attribute' => '', - ); + ]; } /** @@ -489,7 +489,7 @@ public function getDefaults() { */ public function getConfigTranslationArray() { //TODO: merge them into one representation - static $array = array( + static $array = [ 'ldap_host' => 'ldapHost', 'ldap_port' => 'ldapPort', 'ldap_backup_host' => 'ldapBackupHost', @@ -543,7 +543,7 @@ public function getConfigTranslationArray() { 'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN', 'ldap_ext_storage_home_attribute' => 'ldapExtStorageHomeAttribute', 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig - ); + ]; return $array; } diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 8d499a4ee1cc5..5e2d7fb858358 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -298,7 +298,7 @@ private function readConfiguration($force = false) { */ public function setConfiguration($config, &$setParameters = null) { if(is_null($setParameters)) { - $setParameters = array(); + $setParameters = []; } $this->doNotValidate = false; $this->configuration->setConfiguration($config, $setParameters); @@ -328,7 +328,7 @@ public function getConfiguration() { $this->readConfiguration(); $config = $this->configuration->getConfiguration(); $cta = $this->configuration->getConfigTranslationArray(); - $result = array(); + $result = []; foreach($cta as $dbkey => $configkey) { switch($configkey) { case 'homeFolderNamingRule': @@ -356,15 +356,15 @@ public function getConfiguration() { private function doSoftValidation() { //if User or Group Base are not set, take over Base DN setting - foreach(array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) { + foreach(['ldapBaseUsers', 'ldapBaseGroups'] as $keyBase) { $val = $this->configuration->$keyBase; if(empty($val)) { $this->configuration->$keyBase = $this->configuration->ldapBase; } } - foreach(array('ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', - 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute') + foreach(['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', + 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) { $uuidOverride = $this->configuration->$expertSetting; if(!empty($uuidOverride)) { @@ -392,12 +392,12 @@ private function doSoftValidation() { } //make sure empty search attributes are saved as simple, empty array - $saKeys = array('ldapAttributesForUserSearch', - 'ldapAttributesForGroupSearch'); + $saKeys = ['ldapAttributesForUserSearch', + 'ldapAttributesForGroupSearch']; foreach($saKeys as $key) { $val = $this->configuration->$key; if(is_array($val) && count($val) === 1 && empty($val[0])) { - $this->configuration->$key = array(); + $this->configuration->$key = []; } } @@ -421,8 +421,8 @@ private function doCriticalValidation() { (string)$this->configPrefix .'): '; //options that shall not be empty - $options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName', - 'ldapGroupDisplayName', 'ldapLoginFilter'); + $options = ['ldapHost', 'ldapPort', 'ldapUserDisplayName', + 'ldapGroupDisplayName', 'ldapLoginFilter']; foreach($options as $key) { $val = $this->configuration->$key; if(empty($val)) { diff --git a/apps/user_ldap/lib/GroupPluginManager.php b/apps/user_ldap/lib/GroupPluginManager.php index 115cc8d3fdb2f..f1b36923ada44 100644 --- a/apps/user_ldap/lib/GroupPluginManager.php +++ b/apps/user_ldap/lib/GroupPluginManager.php @@ -29,14 +29,14 @@ class GroupPluginManager { private $respondToActions = 0; - private $which = array( + private $which = [ GroupInterface::CREATE_GROUP => null, GroupInterface::DELETE_GROUP => null, GroupInterface::ADD_TO_GROUP => null, GroupInterface::REMOVE_FROM_GROUP => null, GroupInterface::COUNT_USERS => null, GroupInterface::GROUP_DETAILS => null - ); + ]; /** * @return int All implemented actions diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 40b8bcf16c97a..c19f6ac4ed659 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -138,8 +138,8 @@ public function inGroup($uid, $gid) { //extra work if we don't get back user DNs if(strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') { - $dns = array(); - $filterParts = array(); + $dns = []; + $filterParts = []; $bytes = 0; foreach($members as $mid) { $filter = str_replace('%uid', $mid, $this->access->connection->ldapLoginFilter); @@ -150,7 +150,7 @@ public function inGroup($uid, $gid) { // to take even the chance to exceed it $filter = $this->access->combineFilterWithOr($filterParts); $bytes = 0; - $filterParts = array(); + $filterParts = []; $users = $this->access->fetchListOfUsers($filter, 'dn', count($filterParts)); $dns = array_merge($dns, $users); } @@ -182,10 +182,10 @@ public function getDynamicGroupMembers($dnGroup) { $dynamicGroupMemberURL = strtolower($this->access->connection->ldapDynamicGroupMemberURL); if (empty($dynamicGroupMemberURL)) { - return array(); + return []; } - $dynamicMembers = array(); + $dynamicMembers = []; $memberURLs = $this->access->readAttribute( $dnGroup, $dynamicGroupMemberURL, @@ -199,7 +199,7 @@ public function getDynamicGroupMembers($dnGroup) { if ($pos !== false) { $memberUrlFilter = substr($memberURLs[0], $pos); $foundMembers = $this->access->searchUsers($memberUrlFilter,'dn'); - $dynamicMembers = array(); + $dynamicMembers = []; foreach($foundMembers as $value) { $dynamicMembers[$value['dn'][0]] = 1; } @@ -335,7 +335,7 @@ public function gidNumber2Name($gid, $dn) { 'objectClass=posixGroup', $this->access->connection->ldapGidNumber . '=' . $gid ]); - $result = $this->access->searchGroups($filter, array('dn'), 1); + $result = $this->access->searchGroups($filter, ['dn'], 1); if(empty($result)) { return false; } @@ -493,11 +493,11 @@ public function primaryGroupID2Name($gid, $dn) { } //we need to get the DN from LDAP - $filter = $this->access->combineFilterWithAnd(array( + $filter = $this->access->combineFilterWithAnd([ $this->access->connection->ldapGroupFilter, 'objectsid=' . $domainObjectSid . '-' . $gid - )); - $result = $this->access->searchGroups($filter, array('dn'), 1); + ]); + $result = $this->access->searchGroups($filter, ['dn'], 1); if(empty($result)) { return false; } @@ -590,13 +590,13 @@ public function getUsersInPrimaryGroup($groupDN, $search = '', $limit = -1, $off $filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search); $users = $this->access->fetchListOfUsers( $filter, - array($this->access->connection->ldapUserDisplayName, 'dn'), + [$this->access->connection->ldapUserDisplayName, 'dn'], $limit, $offset ); return $this->access->nextcloudUserNames($users); } catch (\Exception $e) { - return array(); + return []; } } @@ -612,7 +612,7 @@ public function getUsersInPrimaryGroup($groupDN, $search = '', $limit = -1, $off public function countUsersInPrimaryGroup($groupDN, $search = '', $limit = -1, $offset = 0) { try { $filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search); - $users = $this->access->countUsers($filter, array('dn'), $limit, $offset); + $users = $this->access->countUsers($filter, ['dn'], $limit, $offset); return (int)$users; } catch (\Exception $e) { return 0; @@ -648,7 +648,7 @@ public function getUserPrimaryGroup($dn) { */ public function getUserGroups($uid) { if(!$this->enabled) { - return array(); + return []; } $cacheKey = 'getUserGroups'.$uid; $userGroups = $this->access->connection->getFromCache($cacheKey); @@ -657,8 +657,8 @@ public function getUserGroups($uid) { } $userDN = $this->access->username2dn($uid); if(!$userDN) { - $this->access->connection->writeToCache($cacheKey, array()); - return array(); + $this->access->connection->writeToCache($cacheKey, []); + return []; } $groups = []; @@ -670,7 +670,7 @@ public function getUserGroups($uid) { if (!empty($dynamicGroupMemberURL)) { // look through dynamic groups to add them to the result array if needed $groupsToMatch = $this->access->fetchListOfGroups( - $this->access->connection->ldapGroupFilter,array('dn',$dynamicGroupMemberURL)); + $this->access->connection->ldapGroupFilter,['dn',$dynamicGroupMemberURL]); foreach($groupsToMatch as $dynamicGroup) { if (!array_key_exists($dynamicGroupMemberURL, $dynamicGroup)) { continue; @@ -816,10 +816,10 @@ private function getGroupsByMember($dn, &$seen = null) { */ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { if(!$this->enabled) { - return array(); + return []; } if(!$this->groupExists($gid)) { - return array(); + return []; } $search = $this->access->escapeFilterPart($search, true); $cacheKey = 'usersInGroup-'.$gid.'-'.$search.'-'.$limit.'-'.$offset; @@ -843,8 +843,8 @@ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { $groupDN = $this->access->groupname2dn($gid); if(!$groupDN) { // group couldn't be found, return empty resultset - $this->access->connection->writeToCache($cacheKey, array()); - return array(); + $this->access->connection->writeToCache($cacheKey, []); + return []; } $primaryUsers = $this->getUsersInPrimaryGroup($groupDN, $search, $limit, $offset); @@ -856,19 +856,19 @@ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { return []; } - $groupUsers = array(); + $groupUsers = []; $isMemberUid = (strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid'); $attrs = $this->access->userManager->getAttributes(true); foreach($members as $member) { if($isMemberUid) { //we got uids, need to get their DNs to 'translate' them to user names - $filter = $this->access->combineFilterWithAnd(array( + $filter = $this->access->combineFilterWithAnd([ str_replace('%uid', trim($member), $this->access->connection->ldapLoginFilter), $this->access->combineFilterWithAnd([ $this->access->getFilterPartForUserSearch($search), $this->access->connection->ldapUserFilter ]) - )); + ]); $ldap_users = $this->access->fetchListOfUsers($filter, $attrs, 1); if(count($ldap_users) < 1) { continue; @@ -968,14 +968,14 @@ public function countUsersInGroup($gid, $search = '') { // and let it count. //For now this is not important, because the only use of this method //does not supply a search string - $groupUsers = array(); + $groupUsers = []; foreach($members as $member) { if($isMemberUid) { //we got uids, need to get their DNs to 'translate' them to user names - $filter = $this->access->combineFilterWithAnd(array( + $filter = $this->access->combineFilterWithAnd([ str_replace('%uid', $member, $this->access->connection->ldapLoginFilter), $this->access->getFilterPartForUserSearch($search) - )); + ]); $ldap_users = $this->access->fetchListOfUsers($filter, 'dn', 1); if(count($ldap_users) < 1) { continue; @@ -1013,7 +1013,7 @@ public function countUsersInGroup($gid, $search = '') { */ protected function getGroupsChunk($search = '', $limit = -1, $offset = 0) { if(!$this->enabled) { - return array(); + return []; } $cacheKey = 'getGroups-'.$search.'-'.$limit.'-'.$offset; @@ -1029,13 +1029,13 @@ protected function getGroupsChunk($search = '', $limit = -1, $offset = 0) { if($limit <= 0) { $limit = null; } - $filter = $this->access->combineFilterWithAnd(array( + $filter = $this->access->combineFilterWithAnd([ $this->access->connection->ldapGroupFilter, $this->access->getFilterPartForGroupSearch($search) - )); + ]); \OCP\Util::writeLog('user_ldap', 'getGroups Filter '.$filter, ILogger::DEBUG); $ldap_groups = $this->access->fetchListOfGroups($filter, - array($this->access->connection->ldapGroupDisplayName, 'dn'), + [$this->access->connection->ldapGroupDisplayName, 'dn'], $limit, $offset); $ldap_groups = $this->access->nextcloudGroupNames($ldap_groups); @@ -1059,7 +1059,7 @@ protected function getGroupsChunk($search = '', $limit = -1, $offset = 0) { */ public function getGroups($search = '', $limit = -1, $offset = 0) { if(!$this->enabled) { - return array(); + return []; } $search = $this->access->escapeFilterPart($search, true); $pagingSize = (int)$this->access->connection->ldapPagingSize; @@ -1073,7 +1073,7 @@ public function getGroups($search = '', $limit = -1, $offset = 0) { $overallLimit = $maxGroups; } $chunkOffset = $offset; - $allGroups = array(); + $allGroups = []; while ($chunkOffset < $overallLimit) { $chunkLimit = min($pagingSize, $overallLimit - $chunkOffset); $ldapGroups = $this->getGroupsChunk($search, $chunkLimit, $chunkOffset); diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index 3b39d4398c7b7..441bf141a3875 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -30,7 +30,7 @@ use OCP\Group\Backend\IGetDisplayNameBackend; class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGetDisplayNameBackend { - private $backends = array(); + private $backends = []; private $refBackend = null; /** @@ -58,7 +58,7 @@ public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap, GroupPlug protected function walkBackends($gid, $method, $parameters) { $cacheKey = $this->getGroupCacheKey($gid); foreach($this->backends as $configPrefix => $backend) { - if($result = call_user_func_array(array($backend, $method), $parameters)) { + if($result = call_user_func_array([$backend, $method], $parameters)) { $this->writeToCache($cacheKey, $configPrefix); return $result; } @@ -80,13 +80,13 @@ protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) { //in case the uid has been found in the past, try this stored connection first if(!is_null($prefix)) { if(isset($this->backends[$prefix])) { - $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters); + $result = call_user_func_array([$this->backends[$prefix], $method], $parameters); if($result === $passOnWhen) { //not found here, reset cache to null if group vanished //because sometimes methods return false with a reason $groupExists = call_user_func_array( - array($this->backends[$prefix], 'groupExists'), - array($gid) + [$this->backends[$prefix], 'groupExists'], + [$gid] ); if(!$groupExists) { $this->writeToCache($cacheKey, null); @@ -107,7 +107,7 @@ protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) { * Checks whether the user is member of a group or not. */ public function inGroup($uid, $gid) { - return $this->handleRequest($gid, 'inGroup', array($uid, $gid)); + return $this->handleRequest($gid, 'inGroup', [$uid, $gid]); } /** @@ -119,7 +119,7 @@ public function inGroup($uid, $gid) { * if the user exists at all. */ public function getUserGroups($uid) { - $groups = array(); + $groups = []; foreach($this->backends as $backend) { $backendGroups = $backend->getUserGroups($uid); @@ -136,7 +136,7 @@ public function getUserGroups($uid) { * @return string[] with user ids */ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { - $users = array(); + $users = []; foreach($this->backends as $backend) { $backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset); @@ -154,7 +154,7 @@ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { */ public function createGroup($gid) { return $this->handleRequest( - $gid, 'createGroup', array($gid)); + $gid, 'createGroup', [$gid]); } /** @@ -164,7 +164,7 @@ public function createGroup($gid) { */ public function deleteGroup($gid) { return $this->handleRequest( - $gid, 'deleteGroup', array($gid)); + $gid, 'deleteGroup', [$gid]); } /** @@ -177,7 +177,7 @@ public function deleteGroup($gid) { */ public function addToGroup($uid, $gid) { return $this->handleRequest( - $gid, 'addToGroup', array($uid, $gid)); + $gid, 'addToGroup', [$uid, $gid]); } /** @@ -190,7 +190,7 @@ public function addToGroup($uid, $gid) { */ public function removeFromGroup($uid, $gid) { return $this->handleRequest( - $gid, 'removeFromGroup', array($uid, $gid)); + $gid, 'removeFromGroup', [$uid, $gid]); } /** @@ -201,7 +201,7 @@ public function removeFromGroup($uid, $gid) { */ public function countUsersInGroup($gid, $search = '') { return $this->handleRequest( - $gid, 'countUsersInGroup', array($gid, $search)); + $gid, 'countUsersInGroup', [$gid, $search]); } /** @@ -211,7 +211,7 @@ public function countUsersInGroup($gid, $search = '') { */ public function getGroupDetails($gid) { return $this->handleRequest( - $gid, 'getGroupDetails', array($gid)); + $gid, 'getGroupDetails', [$gid]); } /** @@ -221,7 +221,7 @@ public function getGroupDetails($gid) { * Returns a list with all groups */ public function getGroups($search = '', $limit = -1, $offset = 0) { - $groups = array(); + $groups = []; foreach($this->backends as $backend) { $backendGroups = $backend->getGroups($search, $limit, $offset); @@ -239,7 +239,7 @@ public function getGroups($search = '', $limit = -1, $offset = 0) { * @return bool */ public function groupExists($gid) { - return $this->handleRequest($gid, 'groupExists', array($gid)); + return $this->handleRequest($gid, 'groupExists', [$gid]); } /** @@ -271,7 +271,7 @@ public function getLDAPAccess($gid) { * @return resource of the LDAP connection */ public function getNewLDAPConnection($gid) { - return $this->handleRequest($gid, 'getNewLDAPConnection', array($gid)); + return $this->handleRequest($gid, 'getNewLDAPConnection', [$gid]); } public function getDisplayName(string $gid): string { diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php index 4279ea72c71cc..6962a3cb97883 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -99,7 +99,7 @@ public function getServerConfigurationHosts() { $keys = $this->getServersConfig($referenceConfigkey); - $result = array(); + $result = []; foreach($keys as $key) { $len = strlen($key) - strlen($referenceConfigkey); $prefix = substr($key, 0, $len); @@ -164,7 +164,7 @@ public function deleteServerConfiguration($prefix) { AND `appid` = \'user_ldap\' AND `configkey` NOT IN (\'enabled\', \'installed_version\', \'types\', \'bgjUpdateGroupsLastRun\') '); - $delRows = $query->execute(array($prefix.'%')); + $delRows = $query->execute([$prefix.'%']); if($delRows === null) { return false; @@ -234,7 +234,7 @@ public function setLDAPProvider() { public function sanitizeDN($dn) { //treating multiple base DNs if(is_array($dn)) { - $result = array(); + $result = []; foreach($dn as $singleDN) { $result[] = $this->sanitizeDN($singleDN); } @@ -251,7 +251,7 @@ public function sanitizeDN($dn) { //escape DN values according to RFC 2253 – this is already done by ldap_explode_dn //to use the DN in search filters, \ needs to be escaped to \5c additionally //to use them in bases, we convert them back to simple backslashes in readAttribute() - $replacements = array( + $replacements = [ '\,' => '\5c2C', '\=' => '\5c3D', '\+' => '\5c2B', @@ -263,7 +263,7 @@ public function sanitizeDN($dn) { '(' => '\28', ')' => '\29', '*' => '\2A', - ); + ]; $dn = str_replace(array_keys($replacements), array_values($replacements), $dn); return $dn; diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index 174897d863950..7b95950bda558 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -161,11 +161,11 @@ public function runCycle($cycleData) { $access = $this->accessFactory->get($connection); $access->setUserMapper($this->mapper); - $filter = $access->combineFilterWithAnd(array( + $filter = $access->combineFilterWithAnd([ $access->connection->ldapUserFilter, $access->connection->ldapUserDisplayName . '=*', $access->getFilterPartForUserSearch('') - )); + ]); $results = $access->fetchListOfUsers( $filter, $access->userManager->getAttributes(), diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index ef42f36f54f50..bf5d730c3b8d9 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -104,21 +104,21 @@ static private function handleKnownGroups($groups) { $actualUsers = self::getGroupBE()->usersInGroup($group); $hasChanged = false; foreach(array_diff($knownUsers, $actualUsers) as $removedUser) { - \OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group)); + \OCP\Util::emitHook('OC_User', 'post_removeFromGroup', ['uid' => $removedUser, 'gid' => $group]); \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – "'.$removedUser.'" removed from "'.$group.'".', ILogger::INFO); $hasChanged = true; } foreach(array_diff($actualUsers, $knownUsers) as $addedUser) { - \OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group)); + \OCP\Util::emitHook('OC_User', 'post_addToGroup', ['uid' => $addedUser, 'gid' => $group]); \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – "'.$addedUser.'" added to "'.$group.'".', ILogger::INFO); $hasChanged = true; } if($hasChanged) { - $query->execute(array(serialize($actualUsers), $group)); + $query->execute([serialize($actualUsers), $group]); } } \OCP\Util::writeLog('user_ldap', @@ -141,7 +141,7 @@ static private function handleCreatedGroups($createdGroups) { 'bgJ "updateGroups" – new group "'.$createdGroup.'" found.', ILogger::INFO); $users = serialize(self::getGroupBE()->usersInGroup($createdGroup)); - $query->execute(array($createdGroup, $users)); + $query->execute([$createdGroup, $users]); } \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – FINISHED dealing with created Groups.', @@ -162,7 +162,7 @@ static private function handleRemovedGroups($removedGroups) { \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – group "'.$removedGroup.'" was removed.', ILogger::INFO); - $query->execute(array($removedGroup)); + $query->execute([$removedGroup]); } \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – FINISHED dealing with removed groups.', @@ -217,7 +217,7 @@ static private function getKnownGroups() { FROM `*PREFIX*ldap_group_members` '); $result = $query->execute()->fetchAll(); - self::$groupsFromDB = array(); + self::$groupsFromDB = []; foreach($result as $dataset) { self::$groupsFromDB[$dataset['owncloudname']] = $dataset; } diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index e68c3149696c3..8c8a6bfbf1e2d 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -35,7 +35,7 @@ class LDAP implements ILDAPWrapper { protected $curFunc = ''; - protected $curArgs = array(); + protected $curArgs = []; /** * @param resource $link @@ -71,7 +71,7 @@ public function connect($host, $port) { */ public function controlPagedResultResponse($link, $result, &$cookie) { $this->preFunctionCall('ldap_control_paged_result_response', - array($link, $result, $cookie)); + [$link, $result, $cookie]); $result = ldap_control_paged_result_response($link, $result, $cookie); $this->postFunctionCall(); @@ -217,7 +217,7 @@ public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = * @return bool */ public function modReplace($link, $userDN, $password) { - return $this->invokeLDAPMethod('mod_replace', $link, $userDN, array('userPassword' => $password)); + return $this->invokeLDAPMethod('mod_replace', $link, $userDN, ['userPassword' => $password]); } /** diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 472cd8d277965..fecc25da92e3c 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -84,7 +84,7 @@ protected function getXbyY($fetchCol, $compareCol, $search) { WHERE `' . $compareCol . '` = ? '); - $res = $query->execute(array($search)); + $res = $query->execute([$search]); if($res !== false) { return $query->fetchColumn(); } @@ -126,7 +126,7 @@ public function setDNbyUUID($fdn, $uuid) { WHERE `directory_uuid` = ? '); - return $this->modify($query, array($fdn, $uuid)); + return $this->modify($query, [$fdn, $uuid]); } /** @@ -171,8 +171,8 @@ public function getNamesBySearch($search, $prefixMatch = "", $postfixMatch = "") WHERE `owncloud_name` LIKE ? '); - $res = $query->execute(array($prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch)); - $names = array(); + $res = $query->execute([$prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch]); + $names = []; if($res !== false) { while($row = $query->fetch()) { $names[] = $row['owncloud_name']; @@ -240,11 +240,11 @@ public function map($fdn, $name, $uuid) { return false; } - $row = array( + $row = [ 'ldap_dn' => $fdn, 'owncloud_name' => $name, 'directory_uuid' => $uuid - ); + ]; try { $result = $this->dbc->insertIfNotExist($this->getTableName(), $row); @@ -265,7 +265,7 @@ public function unmap($name) { DELETE FROM `'. $this->getTableName() .'` WHERE `owncloud_name` = ?'); - return $this->modify($query, array($name)); + return $this->modify($query, [$name]); } /** diff --git a/apps/user_ldap/lib/Proxy.php b/apps/user_ldap/lib/Proxy.php index 24313fc7bfb70..4515e53c6c44e 100644 --- a/apps/user_ldap/lib/Proxy.php +++ b/apps/user_ldap/lib/Proxy.php @@ -37,7 +37,7 @@ use OCA\User_LDAP\User\Manager; abstract class Proxy { - static private $accesses = array(); + static private $accesses = []; private $ldap = null; /** @var \OCP\ICache|null */ diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php index 1511f3bcd61b8..c75a144e909e4 100644 --- a/apps/user_ldap/lib/User/OfflineUser.php +++ b/apps/user_ldap/lib/User/OfflineUser.php @@ -105,7 +105,7 @@ public function unmark() { * @return array */ public function export() { - $data = array(); + $data = []; $data['ocName'] = $this->getOCName(); $data['dn'] = $this->getDN(); $data['uid'] = $this->getUID(); @@ -223,7 +223,7 @@ protected function determineShares() { FROM `*PREFIX*share` WHERE `uid_owner` = ? ', 1); - $query->execute(array($this->ocName)); + $query->execute([$this->ocName]); $sResult = $query->fetchColumn(0); if((int)$sResult === 1) { $this->hasActiveShares = true; @@ -235,7 +235,7 @@ protected function determineShares() { FROM `*PREFIX*share_external` WHERE `owner` = ? ', 1); - $query->execute(array($this->ocName)); + $query->execute([$this->ocName]); $sResult = $query->fetchColumn(0); if((int)$sResult === 1) { $this->hasActiveShares = true; diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 467d5ca025ba6..eb126b94bfe89 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -96,7 +96,7 @@ class User { /** * @var string[] */ - protected $refreshedFeatures = array(); + protected $refreshedFeatures = []; /** * @var string */ @@ -711,7 +711,7 @@ public function handlePasswordExpiry($params) { $uid = $params['uid']; if (isset($uid) && $uid === $this->getUsername()) { //retrieve relevant user attributes - $result = $this->access->search('objectclass=*', array($this->dn), ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']); + $result = $this->access->search('objectclass=*', [$this->dn], ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']); if (array_key_exists('pwdpolicysubentry', $result[0])) { $pwdPolicySubentry = $result[0]['pwdpolicysubentry']; @@ -728,7 +728,7 @@ public function handlePasswordExpiry($params) { $cacheKey = 'ppolicyAttributes' . $ppolicyDN; $result = $this->connection->getFromCache($cacheKey); if(is_null($result)) { - $result = $this->access->search('objectclass=*', array($ppolicyDN), ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']); + $result = $this->access->search('objectclass=*', [$ppolicyDN], ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']); $this->connection->writeToCache($cacheKey, $result); } @@ -742,10 +742,10 @@ public function handlePasswordExpiry($params) { && count($pwdGraceUseTime) < (int)$pwdGraceAuthNLimit[0]) { //at least one more grace login available? $this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true'); header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( - 'user_ldap.renewPassword.showRenewPasswordForm', array('user' => $uid))); + 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid])); } else { //no more grace login available header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( - 'user_ldap.renewPassword.showLoginFormInvalidPassword', array('user' => $uid))); + 'user_ldap.renewPassword.showLoginFormInvalidPassword', ['user' => $uid])); } exit(); } @@ -753,7 +753,7 @@ public function handlePasswordExpiry($params) { if (!empty($pwdReset) && $pwdReset[0] === 'TRUE') { //user must change his password $this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true'); header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( - 'user_ldap.renewPassword.showRenewPasswordForm', array('user' => $uid))); + 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid])); exit(); } //handle password expiry warning diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php index 1407bec011d11..6301257b1afaf 100644 --- a/apps/user_ldap/lib/UserPluginManager.php +++ b/apps/user_ldap/lib/UserPluginManager.php @@ -32,7 +32,7 @@ class UserPluginManager { private $respondToActions = 0; - private $which = array( + private $which = [ Backend::CREATE_USER => null, Backend::SET_PASSWORD => null, Backend::GET_HOME => null, @@ -41,7 +41,7 @@ class UserPluginManager { Backend::PROVIDE_AVATAR => null, Backend::COUNT_USERS => null, 'deleteUser' => null - ); + ]; /** * @return int All implemented actions, except for 'deleteUser' diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 323e59860f30a..fec3b25a78e8c 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -260,11 +260,11 @@ public function getUsers($search = '', $limit = 10, $offset = 0) { if($limit <= 0) { $limit = null; } - $filter = $this->access->combineFilterWithAnd(array( + $filter = $this->access->combineFilterWithAnd([ $this->access->connection->ldapUserFilter, $this->access->connection->ldapUserDisplayName . '=*', $this->access->getFilterPartForUserSearch($search) - )); + ]); Util::writeLog('user_ldap', 'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset.' Filter: '.$filter, @@ -511,7 +511,7 @@ public function getDisplayNames($search = '', $limit = null, $offset = null) { return $displayNames; } - $displayNames = array(); + $displayNames = []; $users = $this->getUsers($search, $limit, $offset); foreach ($users as $user) { $displayNames[$user] = $this->getDisplayName($user); diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 96be4a7529f13..2edc0d2d64ae2 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -84,7 +84,7 @@ protected function walkBackends($uid, $method, $parameters) { && method_exists($this->getAccess($configPrefix), $method)) { $instance = $this->getAccess($configPrefix); } - if($result = call_user_func_array(array($instance, $method), $parameters)) { + if($result = call_user_func_array([$instance, $method], $parameters)) { $this->writeToCache($cacheKey, $configPrefix); return $result; } @@ -160,7 +160,7 @@ public function getBackendName() { */ public function getUsers($search = '', $limit = 10, $offset = 0) { //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends - $users = array(); + $users = []; foreach($this->backends as $backend) { $backendUsers = $backend->getUsers($search, $limit, $offset); if (is_array($backendUsers)) { @@ -177,7 +177,7 @@ public function getUsers($search = '', $limit = 10, $offset = 0) { */ public function userExists($uid) { $existsOnLDAP = false; - $existsLocally = $this->handleRequest($uid, 'userExists', array($uid)); + $existsLocally = $this->handleRequest($uid, 'userExists', [$uid]); if($existsLocally) { $existsOnLDAP = $this->userExistsOnLDAP($uid); } @@ -202,7 +202,7 @@ public function userExists($uid) { */ public function userExistsOnLDAP($user) { $id = ($user instanceof User) ? $user->getUsername() : $user; - return $this->handleRequest($id, 'userExistsOnLDAP', array($user)); + return $this->handleRequest($id, 'userExistsOnLDAP', [$user]); } /** @@ -214,7 +214,7 @@ public function userExistsOnLDAP($user) { * Check if the password is correct without logging in the user */ public function checkPassword($uid, $password) { - return $this->handleRequest($uid, 'checkPassword', array($uid, $password)); + return $this->handleRequest($uid, 'checkPassword', [$uid, $password]); } /** @@ -225,7 +225,7 @@ public function checkPassword($uid, $password) { */ public function loginName2UserName($loginName) { $id = 'LOGINNAME,' . $loginName; - return $this->handleRequest($id, 'loginName2UserName', array($loginName)); + return $this->handleRequest($id, 'loginName2UserName', [$loginName]); } /** @@ -236,7 +236,7 @@ public function loginName2UserName($loginName) { */ public function dn2UserName($dn) { $id = 'DN,' . $dn; - return $this->handleRequest($id, 'dn2UserName', array($dn)); + return $this->handleRequest($id, 'dn2UserName', [$dn]); } /** @@ -245,7 +245,7 @@ public function dn2UserName($dn) { * @return boolean */ public function getHome($uid) { - return $this->handleRequest($uid, 'getHome', array($uid)); + return $this->handleRequest($uid, 'getHome', [$uid]); } /** @@ -254,7 +254,7 @@ public function getHome($uid) { * @return string display name */ public function getDisplayName($uid) { - return $this->handleRequest($uid, 'getDisplayName', array($uid)); + return $this->handleRequest($uid, 'getDisplayName', [$uid]); } /** @@ -265,7 +265,7 @@ public function getDisplayName($uid) { * @return string display name */ public function setDisplayName($uid, $displayName) { - return $this->handleRequest($uid, 'setDisplayName', array($uid, $displayName)); + return $this->handleRequest($uid, 'setDisplayName', [$uid, $displayName]); } /** @@ -286,7 +286,7 @@ public function canChangeAvatar($uid) { */ public function getDisplayNames($search = '', $limit = null, $offset = null) { //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends - $users = array(); + $users = []; foreach($this->backends as $backend) { $backendUsers = $backend->getDisplayNames($search, $limit, $offset); if (is_array($backendUsers)) { @@ -304,7 +304,7 @@ public function getDisplayNames($search = '', $limit = null, $offset = null) { * Deletes a user */ public function deleteUser($uid) { - return $this->handleRequest($uid, 'deleteUser', array($uid)); + return $this->handleRequest($uid, 'deleteUser', [$uid]); } /** @@ -315,7 +315,7 @@ public function deleteUser($uid) { * */ public function setPassword($uid, $password) { - return $this->handleRequest($uid, 'setPassword', array($uid, $password)); + return $this->handleRequest($uid, 'setPassword', [$uid, $password]); } /** @@ -346,7 +346,7 @@ public function countUsers() { * @return Access instance of Access for LDAP interaction */ public function getLDAPAccess($uid) { - return $this->handleRequest($uid, 'getLDAPAccess', array($uid)); + return $this->handleRequest($uid, 'getLDAPAccess', [$uid]); } /** @@ -356,7 +356,7 @@ public function getLDAPAccess($uid) { * @return resource of the LDAP connection */ public function getNewLDAPConnection($uid) { - return $this->handleRequest($uid, 'getNewLDAPConnection', array($uid)); + return $this->handleRequest($uid, 'getNewLDAPConnection', [$uid]); } /** @@ -366,6 +366,6 @@ public function getNewLDAPConnection($uid) { * @return bool */ public function createUser($username, $password) { - return $this->handleRequest($username, 'createUser', array($username,$password)); + return $this->handleRequest($username, 'createUser', [$username,$password]); } } diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 82f06010bcfaa..4e3f41d6fc954 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -48,7 +48,7 @@ class Wizard extends LDAPUtility { protected $cr; protected $configuration; protected $result; - protected $resultCache = array(); + protected $resultCache = []; const LRESULT_PROCESSED_OK = 2; const LRESULT_PROCESSED_INVALID = 3; @@ -135,7 +135,7 @@ public function countGroups() { $filter = $this->configuration->ldapGroupFilter; if(empty($filter)) { - $output = self::$l->n('%s group found', '%s groups found', 0, array(0)); + $output = self::$l->n('%s group found', '%s groups found', 0, [0]); $this->result->addChange('ldap_group_count', $output); return $this->result; } @@ -200,22 +200,22 @@ public function countInBaseDN() { * @return int|bool */ public function countUsersWithAttribute($attr, $existsCheck = false) { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapUserFilter', - ))) { + ])) { return false; } - $filter = $this->access->combineFilterWithAnd(array( + $filter = $this->access->combineFilterWithAnd([ $this->configuration->ldapUserFilter, $attr . '=*' - )); + ]); $limit = ($existsCheck === false) ? null : 1; - return $this->access->countUsers($filter, array('dn'), $limit); + return $this->access->countUsers($filter, ['dn'], $limit); } /** @@ -225,11 +225,11 @@ public function countUsersWithAttribute($attr, $existsCheck = false) { * @throws \Exception */ public function detectUserDisplayNameAttribute() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapUserFilter', - ))) { + ])) { return false; } @@ -247,7 +247,7 @@ public function detectUserDisplayNameAttribute() { } // first attribute that has at least one result wins - $displayNameAttrs = array('displayname', 'cn'); + $displayNameAttrs = ['displayname', 'cn']; foreach ($displayNameAttrs as $attr) { $count = (int)$this->countUsersWithAttribute($attr, true); @@ -267,11 +267,11 @@ public function detectUserDisplayNameAttribute() { * @return WizardResult|bool */ public function detectEmailAttribute() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapUserFilter', - ))) { + ])) { return false; } @@ -286,7 +286,7 @@ public function detectEmailAttribute() { $writeLog = false; } - $emailAttributes = array('mail', 'mailPrimaryAddress'); + $emailAttributes = ['mail', 'mailPrimaryAddress']; $winner = ''; $maxUsers = 0; foreach($emailAttributes as $attr) { @@ -314,11 +314,11 @@ public function detectEmailAttribute() { * @throws \Exception */ public function determineAttributes() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapUserFilter', - ))) { + ])) { return false; } @@ -343,11 +343,11 @@ public function determineAttributes() { * @throws \Exception */ private function getUserAttributes() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapUserFilter', - ))) { + ])) { return false; } $cr = $this->getConnection(); @@ -357,13 +357,13 @@ private function getUserAttributes() { $base = $this->configuration->ldapBase[0]; $filter = $this->configuration->ldapUserFilter; - $rr = $this->ldap->search($cr, $base, $filter, array(), 1, 1); + $rr = $this->ldap->search($cr, $base, $filter, [], 1, 1); if(!$this->ldap->isResource($rr)) { return false; } $er = $this->ldap->firstEntry($cr, $rr); $attributes = $this->ldap->getAttributes($cr, $er); - $pureAttributes = array(); + $pureAttributes = []; for($i = 0; $i < $attributes['count']; $i++) { $pureAttributes[] = $attributes[$i]; } @@ -399,10 +399,10 @@ public function determineGroupsForUsers() { * @throws \Exception */ private function determineGroups($dbKey, $confKey, $testMemberOf = true) { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', - ))) { + ])) { return false; } $cr = $this->getConnection(); @@ -432,9 +432,9 @@ private function determineGroups($dbKey, $confKey, $testMemberOf = true) { * @throws \Exception */ public function fetchGroups($dbKey, $confKey) { - $obclasses = array('posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames', 'groupOfUniqueNames'); + $obclasses = ['posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames', 'groupOfUniqueNames']; - $filterParts = array(); + $filterParts = []; foreach($obclasses as $obclass) { $filterParts[] = 'objectclass='.$obclass; } @@ -442,16 +442,16 @@ public function fetchGroups($dbKey, $confKey) { //- that looks like a group and //- has the group display name set $filter = $this->access->combineFilterWithOr($filterParts); - $filter = $this->access->combineFilterWithAnd(array($filter, 'cn=*')); + $filter = $this->access->combineFilterWithAnd([$filter, 'cn=*']); - $groupNames = array(); - $groupEntries = array(); + $groupNames = []; + $groupEntries = []; $limit = 400; $offset = 0; do { // we need to request dn additionally here, otherwise memberOf // detection will fail later - $result = $this->access->searchGroups($filter, array('cn', 'dn'), $limit, $offset); + $result = $this->access->searchGroups($filter, ['cn', 'dn'], $limit, $offset); foreach($result as $item) { if(!isset($item['cn']) && !is_array($item['cn']) && !isset($item['cn'][0])) { // just in case - no issue known @@ -479,17 +479,17 @@ public function fetchGroups($dbKey, $confKey) { } public function determineGroupMemberAssoc() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapGroupFilter', - ))) { + ])) { return false; } $attribute = $this->detectGroupMemberAssoc(); if($attribute === false) { return false; } - $this->configuration->setConfiguration(array('ldapGroupMemberAssocAttr' => $attribute)); + $this->configuration->setConfiguration(['ldapGroupMemberAssocAttr' => $attribute]); $this->result->addChange('ldap_group_member_assoc_attribute', $attribute); return $this->result; @@ -501,10 +501,10 @@ public function determineGroupMemberAssoc() { * @throws \Exception */ public function determineGroupObjectClasses() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', - ))) { + ])) { return false; } $cr = $this->getConnection(); @@ -512,7 +512,7 @@ public function determineGroupObjectClasses() { throw new \Exception('Could not connect to LDAP'); } - $obclasses = array('groupOfNames', 'groupOfUniqueNames', 'group', 'posixGroup', '*'); + $obclasses = ['groupOfNames', 'groupOfUniqueNames', 'group', 'posixGroup', '*']; $this->determineFeature($obclasses, 'objectclass', 'ldap_groupfilter_objectclass', @@ -528,10 +528,10 @@ public function determineGroupObjectClasses() { * @throws \Exception */ public function determineUserObjectClasses() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', - ))) { + ])) { return false; } $cr = $this->getConnection(); @@ -539,8 +539,8 @@ public function determineUserObjectClasses() { throw new \Exception('Could not connect to LDAP'); } - $obclasses = array('inetOrgPerson', 'person', 'organizationalPerson', - 'user', 'posixAccount', '*'); + $obclasses = ['inetOrgPerson', 'person', 'organizationalPerson', + 'user', 'posixAccount', '*']; $filter = $this->configuration->ldapUserFilter; //if filter is empty, it is probably the first time the wizard is called //then, apply suggestions. @@ -558,10 +558,10 @@ public function determineUserObjectClasses() { * @throws \Exception */ public function getGroupFilter() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', - ))) { + ])) { return false; } //make sure the use display name is set @@ -582,10 +582,10 @@ public function getGroupFilter() { * @throws \Exception */ public function getUserListFilter() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', - ))) { + ])) { return false; } //make sure the use display name is set @@ -608,11 +608,11 @@ public function getUserListFilter() { * @throws \Exception */ public function getUserLoginFilter() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapUserFilter', - ))) { + ])) { return false; } @@ -631,11 +631,11 @@ public function getUserLoginFilter() { * @throws \Exception */ public function testLoginName($loginName) { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', 'ldapBase', 'ldapLoginFilter', - ))) { + ])) { return false; } @@ -665,8 +665,8 @@ public function testLoginName($loginName) { * @throws \Exception */ public function guessPortAndTLS() { - if(!$this->checkRequirements(array('ldapHost', - ))) { + if(!$this->checkRequirements(['ldapHost', + ])) { return false; } $this->checkHost(); @@ -698,10 +698,10 @@ public function guessPortAndTLS() { } if ($settingsFound === true) { - $config = array( + $config = [ 'ldapPort' => $p, 'ldapTLS' => (int)$t - ); + ]; $this->configuration->setConfiguration($config); \OCP\Util::writeLog('user_ldap', 'Wiz: detected Port ' . $p, ILogger::DEBUG); $this->result->addChange('ldap_port', $p); @@ -718,9 +718,9 @@ public function guessPortAndTLS() { * @return WizardResult|false WizardResult on success, false otherwise */ public function guessBaseDN() { - if(!$this->checkRequirements(array('ldapHost', + if(!$this->checkRequirements(['ldapHost', 'ldapPort', - ))) { + ])) { return false; } @@ -766,7 +766,7 @@ public function guessBaseDN() { */ private function applyFind($key, $value) { $this->result->addChange($key, $value); - $this->configuration->setConfiguration(array($key => $value)); + $this->configuration->setConfiguration([$key => $value]); } /** @@ -844,7 +844,7 @@ private function testBaseDN($base) { //base is there, let's validate it. If we search for anything, we should //get a result set > 0 on a proper base - $rr = $this->ldap->search($cr, $base, 'objectClass=*', array('dn'), 0, 1); + $rr = $this->ldap->search($cr, $base, 'objectClass=*', ['dn'], 0, 1); if(!$this->ldap->isResource($rr)) { $errorNo = $this->ldap->errno($cr); $errorMsg = $this->ldap->error($cr); @@ -870,7 +870,7 @@ private function testMemberOf() { if(!$cr) { throw new \Exception('Could not connect to LDAP'); } - $result = $this->access->countUsers('memberOf=*', array('memberOf'), 1); + $result = $this->access->countUsers('memberOf=*', ['memberOf'], 1); if(is_int($result) && $result > 0) { return true; } @@ -911,7 +911,7 @@ private function composeLdapFilter($filterType) { } $base = $this->configuration->ldapBase[0]; foreach($cns as $cn) { - $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, array('dn', 'primaryGroupToken')); + $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, ['dn', 'primaryGroupToken']); if(!$this->ldap->isResource($rr)) { continue; } @@ -1132,8 +1132,8 @@ private function checkRequirements($reqs) { * @return array|false an array with the values on success, false otherwise */ public function cumulativeSearchOnAttribute($filters, $attr, $dnReadLimit = 3, &$maxF = null) { - $dnRead = array(); - $foundItems = array(); + $dnRead = []; + $foundItems = []; $maxEntries = 0; if(!is_array($this->configuration->ldapBase) || !isset($this->configuration->ldapBase[0])) { @@ -1154,7 +1154,7 @@ public function cumulativeSearchOnAttribute($filters, $attr, $dnReadLimit = 3, & continue; } // 20k limit for performance and reason - $rr = $this->ldap->search($cr, $base, $filter, array($attr), 0, 20000); + $rr = $this->ldap->search($cr, $base, $filter, [$attr], 0, 20000); if(!$this->ldap->isResource($rr)) { continue; } @@ -1178,7 +1178,7 @@ public function cumulativeSearchOnAttribute($filters, $attr, $dnReadLimit = 3, & if($dn === false || in_array($dn, $dnRead)) { continue; } - $newItems = array(); + $newItems = []; $state = $this->getAttributeValuesFromEntry($attributes, $attr, $newItems); @@ -1317,14 +1317,14 @@ private function getConnection() { * @return array */ private function getDefaultLdapPortSettings() { - static $settings = array( - array('port' => 7636, 'tls' => false), - array('port' => 636, 'tls' => false), - array('port' => 7389, 'tls' => true), - array('port' => 389, 'tls' => true), - array('port' => 7389, 'tls' => false), - array('port' => 389, 'tls' => false), - ); + static $settings = [ + ['port' => 7636, 'tls' => false], + ['port' => 636, 'tls' => false], + ['port' => 7389, 'tls' => true], + ['port' => 389, 'tls' => true], + ['port' => 7389, 'tls' => false], + ['port' => 389, 'tls' => false], + ]; return $settings; } @@ -1337,7 +1337,7 @@ private function getPortSettingsToTry() { //7xxx ← UCS. need to be checked first, because both ports may be open $host = $this->configuration->ldapHost; $port = (int)$this->configuration->ldapPort; - $portSettings = array(); + $portSettings = []; //In case the port is already provided, we will check this first if($port > 0) { @@ -1345,9 +1345,9 @@ private function getPortSettingsToTry() { if(!(is_array($hostInfo) && isset($hostInfo['scheme']) && stripos($hostInfo['scheme'], 'ldaps') !== false)) { - $portSettings[] = array('port' => $port, 'tls' => true); + $portSettings[] = ['port' => $port, 'tls' => true]; } - $portSettings[] =array('port' => $port, 'tls' => false); + $portSettings[] =['port' => $port, 'tls' => false]; } //default ports diff --git a/apps/user_ldap/lib/WizardResult.php b/apps/user_ldap/lib/WizardResult.php index 74bb1171d4885..ae90cfe437a17 100644 --- a/apps/user_ldap/lib/WizardResult.php +++ b/apps/user_ldap/lib/WizardResult.php @@ -29,8 +29,8 @@ namespace OCA\User_LDAP; class WizardResult { - protected $changes = array(); - protected $options = array(); + protected $changes = []; + protected $options = []; protected $markedChange = false; /** @@ -52,7 +52,7 @@ public function markChange() { */ public function addOptions($key, $values) { if(!is_array($values)) { - $values = array($values); + $values = [$values]; } $this->options[$key] = $values; } @@ -68,7 +68,7 @@ public function hasChanges() { * @return array */ public function getResultArray() { - $result = array(); + $result = []; $result['changes'] = $this->changes; if(count($this->options) > 0) { $result['options'] = $this->options; diff --git a/apps/user_ldap/templates/part.wizard-server.php b/apps/user_ldap/templates/part.wizard-server.php index 5b607f7be864a..56194bafecd56 100644 --- a/apps/user_ldap/templates/part.wizard-server.php +++ b/apps/user_ldap/templates/part.wizard-server.php @@ -6,7 +6,7 @@ $sel = ' selected'; foreach($_['serverConfigurationPrefixes'] as $prefix) { ?> - + diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index e8fa47c6ab991..0397a851557fe 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -116,7 +116,7 @@ private function getConnectorAndLdapMock() { ->getMock(); $helper = new Helper(\OC::$server->getConfig()); - return array($lw, $connector, $um, $helper); + return [$lw, $connector, $um, $helper]; } public function testEscapeFilterPartValidChars() { @@ -147,9 +147,9 @@ public function testConvertSID2StrSuccess(array $sidArray, $sidExpected) { } public function convertSID2StrSuccessData() { - return array( - array( - array( + return [ + [ + [ "\x01", "\x04", "\x00\x00\x00\x00\x00\x05", @@ -157,20 +157,20 @@ public function convertSID2StrSuccessData() { "\xa6\x81\xe5\x0e", "\x4d\x6c\x6c\x2b", "\xca\x32\x05\x5f", - ), + ], 'S-1-5-21-249921958-728525901-1594176202', - ), - array( - array( + ], + [ + [ "\x01", "\x02", "\xFF\xFF\xFF\xFF\xFF\xFF", "\xFF\xFF\xFF\xFF", "\xFF\xFF\xFF\xFF", - ), + ], 'S-1-281474976710655-4294967295-4294967295', - ), - ); + ], + ]; } public function testConvertSID2StrInputError() { @@ -208,12 +208,12 @@ public function dnInputDataProvider() { return [[ [ 'input' => 'foo=bar,bar=foo,dc=foobar', - 'interResult' => array( + 'interResult' => [ 'count' => 3, 0 => 'foo=bar', 1 => 'bar=foo', 2 => 'dc=foobar' - ), + ], 'expectedResult' => true ], [ @@ -408,12 +408,12 @@ public function testBatchApplyUserAttributesDontSkip() { public function dNAttributeProvider() { // corresponds to Access::resemblesDN() - return array( - 'dn' => array('dn'), - 'uniqueMember' => array('uniquemember'), - 'member' => array('member'), - 'memberOf' => array('memberof') - ); + return [ + 'dn' => ['dn'], + 'uniqueMember' => ['uniquemember'], + 'member' => ['member'], + 'memberOf' => ['memberof'] + ]; } /** @@ -432,9 +432,9 @@ public function testSanitizeDN($attribute) { ->willReturn(true); $lw->expects($this->any()) ->method('getAttributes') - ->willReturn(array( - $attribute => array('count' => 1, $dnFromServer) - )); + ->willReturn([ + $attribute => ['count' => 1, $dnFromServer] + ]); $access = new Access($con, $lw, $um, $helper, $config, $this->ncUserManager); $values = $access->readAttribute('uid=whoever,dc=example,dc=org', $attribute); diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php index 1c757aa5a47fb..c44f8a0177a59 100644 --- a/apps/user_ldap/tests/ConfigurationTest.php +++ b/apps/user_ldap/tests/ConfigurationTest.php @@ -36,71 +36,71 @@ protected function setUp(): void { } public function configurationDataProvider() { - $inputWithDN = array( + $inputWithDN = [ 'cn=someUsers,dc=example,dc=org', ' ', ' cn=moreUsers,dc=example,dc=org ' - ); - $expectWithDN = array( + ]; + $expectWithDN = [ 'cn=someUsers,dc=example,dc=org', 'cn=moreUsers,dc=example,dc=org' - ); + ]; - $inputNames = array( + $inputNames = [ ' uid ', 'cn ', ' ', '', ' whats my name', ' ' - ); - $expectedNames = array('uid', 'cn', 'whats my name'); + ]; + $expectedNames = ['uid', 'cn', 'whats my name']; $inputString = ' alea iacta est '; $expectedString = 'alea iacta est'; - $inputHomeFolder = array( + $inputHomeFolder = [ ' homeDirectory ', ' attr:homeDirectory ', ' ' - ); + ]; - $expectedHomeFolder = array( + $expectedHomeFolder = [ 'attr:homeDirectory', 'attr:homeDirectory', '' - ); + ]; $password = ' such a passw0rd '; - return array( - 'set general base' => array('ldapBase', $inputWithDN, $expectWithDN), - 'set user base' => array('ldapBaseUsers', $inputWithDN, $expectWithDN), - 'set group base' => array('ldapBaseGroups', $inputWithDN, $expectWithDN), + return [ + 'set general base' => ['ldapBase', $inputWithDN, $expectWithDN], + 'set user base' => ['ldapBaseUsers', $inputWithDN, $expectWithDN], + 'set group base' => ['ldapBaseGroups', $inputWithDN, $expectWithDN], - 'set search attributes users' => array('ldapAttributesForUserSearch', $inputNames, $expectedNames), - 'set search attributes groups' => array('ldapAttributesForGroupSearch', $inputNames, $expectedNames), + 'set search attributes users' => ['ldapAttributesForUserSearch', $inputNames, $expectedNames], + 'set search attributes groups' => ['ldapAttributesForGroupSearch', $inputNames, $expectedNames], - 'set user filter objectclasses' => array('ldapUserFilterObjectclass', $inputNames, $expectedNames), - 'set user filter groups' => array('ldapUserFilterGroups', $inputNames, $expectedNames), - 'set group filter objectclasses' => array('ldapGroupFilterObjectclass', $inputNames, $expectedNames), - 'set group filter groups' => array('ldapGroupFilterGroups', $inputNames, $expectedNames), - 'set login filter attributes' => array('ldapLoginFilterAttributes', $inputNames, $expectedNames), + 'set user filter objectclasses' => ['ldapUserFilterObjectclass', $inputNames, $expectedNames], + 'set user filter groups' => ['ldapUserFilterGroups', $inputNames, $expectedNames], + 'set group filter objectclasses' => ['ldapGroupFilterObjectclass', $inputNames, $expectedNames], + 'set group filter groups' => ['ldapGroupFilterGroups', $inputNames, $expectedNames], + 'set login filter attributes' => ['ldapLoginFilterAttributes', $inputNames, $expectedNames], - 'set agent password' => array('ldapAgentPassword', $password, $password), + 'set agent password' => ['ldapAgentPassword', $password, $password], - 'set home folder, variant 1' => array('homeFolderNamingRule', $inputHomeFolder[0], $expectedHomeFolder[0]), - 'set home folder, variant 2' => array('homeFolderNamingRule', $inputHomeFolder[1], $expectedHomeFolder[1]), - 'set home folder, empty' => array('homeFolderNamingRule', $inputHomeFolder[2], $expectedHomeFolder[2]), + 'set home folder, variant 1' => ['homeFolderNamingRule', $inputHomeFolder[0], $expectedHomeFolder[0]], + 'set home folder, variant 2' => ['homeFolderNamingRule', $inputHomeFolder[1], $expectedHomeFolder[1]], + 'set home folder, empty' => ['homeFolderNamingRule', $inputHomeFolder[2], $expectedHomeFolder[2]], // default behaviour, one case is enough, special needs must be tested // individually - 'set string value' => array('ldapHost', $inputString, $expectedString), + 'set string value' => ['ldapHost', $inputString, $expectedString], 'set avatar rule, default' => ['ldapUserAvatarRule', 'default', 'default'], 'set avatar rule, none' => ['ldapUserAvatarRule', 'none', 'none'], 'set avatar rule, data attribute' => ['ldapUserAvatarRule', 'data:jpegPhoto', 'data:jpegPhoto'], 'set external storage home attribute' => ['ldapExtStorageHomeAttribute', 'homePath', 'homePath'], - ); + ]; } /** diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php index 82e6f85952d09..778a666317b52 100644 --- a/apps/user_ldap/tests/ConnectionTest.php +++ b/apps/user_ldap/tests/ConnectionTest.php @@ -67,17 +67,17 @@ public function testOriginalAgentUnchangedOnClone() { $lw = $this->createMock(ILDAPWrapper::class); $connection = new Connection($lw, '', null); - $agent = array( + $agent = [ 'ldapAgentName' => 'agent', 'ldapAgentPassword' => '123456', - ); + ]; $connection->setConfiguration($agent); $testConnection = clone $connection; - $user = array( + $user = [ 'ldapAgentName' => 'user', 'ldapAgentPassword' => 'password', - ); + ]; $testConnection->setConfiguration($user); $agentName = $connection->ldapAgentName; diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index 5fdc3c5862c6c..d5a6f3b712cbc 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -229,7 +229,7 @@ public function testGidNumberID2NameNoGroup() { $access->expects($this->once()) ->method('searchGroups') - ->willReturn(array()); + ->willReturn([]); $access->expects($this->never()) ->method('dn2groupname'); @@ -276,7 +276,7 @@ public function testGetEntryGidNumberValue() { $access->expects($this->once()) ->method('readAttribute') ->with($dn, $attr) - ->willReturn(array('3117')); + ->willReturn(['3117']); $groupBackend = new GroupLDAP($access, $pluginManager); @@ -376,7 +376,7 @@ public function testPrimaryGroupID2NameNoGroup() { $access->expects($this->once()) ->method('searchGroups') - ->willReturn(array()); + ->willReturn([]); $access->expects($this->never()) ->method('dn2groupname'); @@ -430,7 +430,7 @@ public function testGetEntryGroupIDValue() { $access->expects($this->once()) ->method('readAttribute') ->with($dn, $attr) - ->willReturn(array('3117')); + ->willReturn(['3117']); $groupBackend = new GroupLDAP($access, $pluginManager); @@ -496,7 +496,7 @@ public function testGetGroupsWithOffset() { $access->expects($this->once()) ->method('nextcloudGroupNames') - ->willReturn(array('group1', 'group2')); + ->willReturn(['group1', 'group2']); $groupBackend = new GroupLDAP($access, $pluginManager); $groups = $groupBackend->getGroups('', 2, 2); @@ -521,11 +521,11 @@ public function testUsersInGroupPrimaryMembersOnly() { ->method('readAttribute') ->willReturnCallback(function($dn, $attr) { if($attr === 'primaryGroupToken') { - return array(1337); + return [1337]; } else if($attr === 'gidNumber') { return [4211]; } - return array(); + return []; }); $access->expects($this->any()) ->method('groupname2dn') @@ -558,16 +558,16 @@ public function testUsersInGroupPrimaryAndUnixMembers() { ->method('readAttribute') ->willReturnCallback(function($dn, $attr) { if($attr === 'primaryGroupToken') { - return array(1337); + return [1337]; } - return array(); + return []; }); $access->expects($this->any()) ->method('groupname2dn') ->willReturn('cn=foobar,dc=foo,dc=bar'); $access->expects($this->once()) ->method('nextcloudUserNames') - ->willReturn(array('lisa', 'bart', 'kira', 'brad')); + ->willReturn(['lisa', 'bart', 'kira', 'brad']); $access->userManager = $this->createMock(Manager::class); $groupBackend = new GroupLDAP($access, $pluginManager); @@ -594,9 +594,9 @@ public function testCountUsersInGroupPrimaryMembersOnly() { ->method('readAttribute') ->willReturnCallback(function($dn, $attr) { if($attr === 'primaryGroupToken') { - return array(1337); + return [1337]; } - return array(); + return []; }); $access->expects($this->any()) diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php index e652b7a644c3d..6912fc2d9a70c 100644 --- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php +++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php @@ -129,12 +129,12 @@ public function run() { //host contains port, 2nd parameter will be ignored $cr = $this->ldap->connect($this->ldapHost, 0); $this->ldap->bind($cr, $this->ldapBindDN, $this->ldapBindPwd); - $this->ldap->search($cr, $this->ldapBase, 'objectClass=*', array('dn'), true, 5); + $this->ldap->search($cr, $this->ldapBase, 'objectClass=*', ['dn'], true, 5); // disable LDAP, will cause lost connection $this->setProxyState(false); try { - $this->ldap->search($cr, $this->ldapBase, 'objectClass=*', array('dn'), true, 5); + $this->ldap->search($cr, $this->ldapBase, 'objectClass=*', ['dn'], true, 5); } catch (ServerNotAvailableException $e) { print("Test PASSED" . PHP_EOL); exit(0); @@ -173,9 +173,9 @@ private function setProxyState($isEnabled) { $ch = $this->getCurl(); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( + curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', - 'Content-Length: ' . strlen($postData)) + 'Content-Length: ' . strlen($postData)] ); $recvd = curl_exec($ch); $this->checkCurlResult($ch, $recvd); diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php index 22065d14b2ce3..f08a5440c4fef 100644 --- a/apps/user_ldap/tests/Jobs/CleanUpTest.php +++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php @@ -31,7 +31,7 @@ class CleanUpTest extends \Test\TestCase { public function getMocks() { - $mocks = array(); + $mocks = []; $mocks['userBackend'] = $this->getMockBuilder('\OCA\User_LDAP\User_Proxy') ->disableOriginalConstructor() diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index b6e63f4a7ae56..71e0865489369 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -601,7 +601,7 @@ public function testGetLDAPDisplayNameField() { ->willReturn(true); $userBackend->expects($this->at(3)) ->method('getConfiguration') - ->willReturn(array('ldap_display_name'=>'displayName')); + ->willReturn(['ldap_display_name'=>'displayName']); $userBackend->expects($this->any()) ->method($this->anything()) ->willReturnSelf(); @@ -639,7 +639,7 @@ public function testGetLDAPEmailField() { ->willReturn(true); $userBackend->expects($this->at(3)) ->method('getConfiguration') - ->willReturn(array('ldap_email_attr'=>'mail')); + ->willReturn(['ldap_email_attr'=>'mail']); $userBackend->expects($this->any()) ->method($this->anything()) ->willReturnSelf(); @@ -687,7 +687,7 @@ public function testgetLDAPGroupMemberAssoc() { ->willReturn(true); $groupBackend->expects($this->any()) ->method('getConfiguration') - ->willReturn(array('ldap_group_member_assoc_attribute'=>'assoc_type')); + ->willReturn(['ldap_group_member_assoc_attribute'=>'assoc_type']); $groupBackend->expects($this->any()) ->method($this->anything()) ->willReturnSelf(); diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php index 9821336df75a2..c06017f4be471 100644 --- a/apps/user_ldap/tests/LDAPTest.php +++ b/apps/user_ldap/tests/LDAPTest.php @@ -86,7 +86,7 @@ public function testModReplace() { $this->ldap ->expects($this->once()) ->method('invokeLDAPMethod') - ->with('mod_replace', $link, $userDN, array('userPassword' => $password)) + ->with('mod_replace', $link, $userDN, ['userPassword' => $password]) ->willReturn(true); $this->assertTrue($this->ldap->modReplace($link, $userDN, $password)); diff --git a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php index 57177819c2dbb..e4aadb3ea975a 100644 --- a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php +++ b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php @@ -49,23 +49,23 @@ public function testIsColNameValid() { * @return array */ protected function getTestData() { - $data = array( - array( + $data = [ + [ 'dn' => 'uid=foobar,dc=example,dc=org', 'name' => 'Foobar', 'uuid' => '1111-AAAA-1234-CDEF', - ), - array( + ], + [ 'dn' => 'uid=barfoo,dc=example,dc=org', 'name' => 'Barfoo', 'uuid' => '2222-BBBB-1234-CDEF', - ), - array( + ], + [ 'dn' => 'uid=barabara,dc=example,dc=org', 'name' => 'BaraBara', 'uuid' => '3333-CCCC-1234-CDEF', - ) - ); + ] + ]; return $data; } @@ -97,7 +97,7 @@ private function initTest() { $mapper->clear(); $this->mapEntries($mapper, $data); - return array($mapper, $data); + return [$mapper, $data]; } /** @@ -109,7 +109,7 @@ public function testMap() { // test that mapping will not happen when it shall not $tooLongDN = 'uid=joann,ou=Secret Small Specialized Department,ou=Some Tremendously Important Department,ou=Another Very Important Department,ou=Pretty Meaningful Derpartment,ou=Quite Broad And General Department,ou=The Topmost Department,dc=hugelysuccessfulcompany,dc=com'; - $paramKeys = array('', 'dn', 'name', 'uuid', $tooLongDN); + $paramKeys = ['', 'dn', 'name', 'uuid', $tooLongDN]; foreach($paramKeys as $key) { $failEntry = $data[0]; if(!empty($key)) { diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index cb9df7037b986..54a35f032b458 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -1032,9 +1032,9 @@ public function testProcessAttributes() { ->setMethods($requiredMethods) ->getMock(); - $this->connection->setConfiguration(array( + $this->connection->setConfiguration([ 'homeFolderNamingRule' => 'homeDirectory' - )); + ]); $this->connection->expects($this->any()) ->method('__get') ->willReturnCallback(function($name) { @@ -1070,10 +1070,10 @@ public function testProcessAttributes() { } public function emptyHomeFolderAttributeValueProvider() { - return array( + return [ 'empty' => [''], 'prefixOnly' => ['attr:'], - ); + ]; } /** diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index f3052b1932748..baa307b2e6b02 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -149,17 +149,17 @@ private function prepareAccessForCheckPassword($noDisplayName = false) { ->method('fetchListOfUsers') ->willReturnCallback(function($filter) { if($filter === 'roland') { - return array(array('dn' => ['dnOfRoland,dc=test'])); + return [['dn' => ['dnOfRoland,dc=test']]]; } - return array(); + return []; }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') ->willReturnCallback(function($uid) { if($uid === 'roland') { - return array(array('dn' => ['dnOfRoland,dc=test'])); + return [['dn' => ['dnOfRoland,dc=test']]]; } - return array(); + return []; }); $retVal = 'gunslinger'; @@ -378,11 +378,11 @@ private function prepareAccessForGetUsers() { $this->access->expects($this->any()) ->method('fetchListOfUsers') ->willReturnCallback(function($search, $a, $l, $o) { - $users = array('gunslinger', 'newyorker', 'ladyofshadows'); + $users = ['gunslinger', 'newyorker', 'ladyofshadows']; if(empty($search)) { $result = $users; } else { - $result = array(); + $result = []; foreach($users as $user) { if(stripos($user, $search) !== false) { $result[] = $user; @@ -545,7 +545,7 @@ public function testUserExistsForNeverExisting() { ->method('readAttribute') ->willReturnCallback(function($dn) { if($dn === 'dnOfRoland,dc=test') { - return array(); + return []; } return false; }); @@ -570,7 +570,7 @@ public function testUserExistsPublicAPI() { ->method('readAttribute') ->willReturnCallback(function($dn) { if($dn === 'dnOfRoland,dc=test') { - return array(); + return []; } return false; }); @@ -613,9 +613,9 @@ public function testGetHomeAbsolutePath() { switch ($dn) { case 'dnOfRoland,dc=test': if($attr === 'testAttribute') { - return array('/tmp/rolandshome/'); + return ['/tmp/rolandshome/']; } - return array(); + return []; break; default: return false; @@ -665,9 +665,9 @@ public function testGetHomeRelative() { switch ($dn) { case 'dnOfLadyOfShadows,dc=test': if($attr === 'testAttribute') { - return array('susannah/'); + return ['susannah/']; } - return array(); + return []; break; default: return false; @@ -821,9 +821,9 @@ private function prepareAccessForGetDisplayName() { switch ($dn) { case 'dnOfRoland,dc=test': if($attr === 'displayname') { - return array('Roland Deschain'); + return ['Roland Deschain']; } - return array(); + return []; break; default: @@ -1156,17 +1156,17 @@ private function prepareAccessForSetPassword($enablePasswordChange = true) { ->method('fetchListOfUsers') ->willReturnCallback(function($filter) { if($filter === 'roland') { - return array(array('dn' => ['dnOfRoland,dc=test'])); + return [['dn' => ['dnOfRoland,dc=test']]]; } - return array(); + return []; }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') ->willReturnCallback(function($uid) { if($uid === 'roland') { - return array(array('dn' => ['dnOfRoland,dc=test'])); + return [['dn' => ['dnOfRoland,dc=test']]]; } - return array(); + return []; }); $this->access->expects($this->any()) ->method('dn2username') diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index db23fc1ed4091..50931c75ff6dc 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -47,8 +47,8 @@ protected function setUp(): void { parent::setUp(); //we need to make sure the consts are defined, otherwise tests will fail //on systems without php5_ldap - $ldapConsts = array('LDAP_OPT_PROTOCOL_VERSION', - 'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT'); + $ldapConsts = ['LDAP_OPT_PROTOCOL_VERSION', + 'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT']; foreach($ldapConsts as $const) { if(!defined($const)) { define($const, 42); @@ -78,7 +78,7 @@ private function getWizardAndMocks() { /** @var Access|\PHPUnit_Framework_MockObject_MockObject $access */ $access = $this->createMock(Access::class); - return array(new Wizard($conf, $lw, $access), $conf, $lw, $access); + return [new Wizard($conf, $lw, $access), $conf, $lw, $access]; } private function prepareLdapWrapperForConnections(MockObject &$ldap) { @@ -104,7 +104,7 @@ public function testCumulativeSearchOnAttributeLimited() { ->method('__get') ->willReturnCallback(function($name) { if($name === 'ldapBase') { - return array('base'); + return ['base']; } return null; }); @@ -139,7 +139,7 @@ public function testCumulativeSearchOnAttributeLimited() { $ldap->expects($this->exactly(10)) ->method('getAttributes') //dummy value, usually invalid - ->willReturn(array('cn' => array('foo'), 'count' => 1)); + ->willReturn(['cn' => ['foo'], 'count' => 1]); global $uidnumber; $uidnumber = 1; @@ -152,7 +152,7 @@ public function testCumulativeSearchOnAttributeLimited() { }); // The following expectations are the real test - $filters = array('f1', 'f2', '*'); + $filters = ['f1', 'f2', '*']; $wizard->cumulativeSearchOnAttribute($filters, 'cn', 5); unset($uidnumber); } @@ -164,7 +164,7 @@ public function testCumulativeSearchOnAttributeUnlimited() { ->method('__get') ->willReturnCallback(function($name) { if($name === 'ldapBase') { - return array('base'); + return ['base']; } return null; }); @@ -215,7 +215,7 @@ public function testCumulativeSearchOnAttributeUnlimited() { $ldap->expects($this->exactly(46)) ->method('getAttributes') //dummy value, usually invalid - ->willReturn(array('cn' => array('foo'), 'count' => 1)); + ->willReturn(['cn' => ['foo'], 'count' => 1]); global $uidnumber; $uidnumber = 1; @@ -228,7 +228,7 @@ public function testCumulativeSearchOnAttributeUnlimited() { }); // The following expectations are the real test - $filters = array('f1', 'f2', '*'); + $filters = ['f1', 'f2', '*']; $wizard->cumulativeSearchOnAttribute($filters, 'cn', 0); unset($uidnumber); } @@ -380,7 +380,7 @@ public function testCumulativeSearchOnAttributeSkipReadDN() { ->method('__get') ->willReturnCallback(function($name) { if($name === 'ldapBase') { - return array('base'); + return ['base']; } return null; }); @@ -432,7 +432,7 @@ public function testCumulativeSearchOnAttributeSkipReadDN() { ->method('getAttributes') //dummy value, usually invalid ->willReturnCallback(function($a, $entry) { - return array('cn' => array($entry), 'count' => 1); + return ['cn' => [$entry], 'count' => 1]; }); $ldap->expects($this->any()) @@ -443,7 +443,7 @@ public function testCumulativeSearchOnAttributeSkipReadDN() { }); // The following expectations are the real test - $filters = array('f1', 'f2', '*'); + $filters = ['f1', 'f2', '*']; $resultArray = $wizard->cumulativeSearchOnAttribute($filters, 'cn', 0); $this->assertSame(6, count($resultArray)); unset($mark); diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php index 0e3a1c7873d1d..cbf09fcda8412 100644 --- a/build/integration/features/bootstrap/CommentsContext.php +++ b/build/integration/features/bootstrap/CommentsContext.php @@ -76,8 +76,8 @@ public function teardownScenario() { */ private function getFileIdForPath($path) { $url = $this->baseUrl . '/remote.php/webdav/' . $path; - $context = stream_context_create(array( - 'http' => array( + $context = stream_context_create([ + 'http' => [ 'method' => 'PROPFIND', 'header' => "Authorization: Basic dXNlcjA6MTIzNDU2\r\nContent-Type: application/x-www-form-urlencoded", 'content' => ' @@ -86,8 +86,8 @@ private function getFileIdForPath($path) { ' - ) - )); + ] + ]); $response = file_get_contents($url, false, $context); preg_match_all('/\(.*)\<\/oc:fileid\>/', $response, $matches); diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 4339c9a01af7b..73354d3b769c1 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -274,7 +274,7 @@ public function userDoesNotBelongToGroup($user, $group) { ]; $this->response = $client->get($fullUrl, $options); - $groups = array($group); + $groups = [$group]; $respondedArray = $this->getArrayOfGroupsResponded($this->response); Assert::assertNotEquals($groups, $respondedArray, "", 0.0, 10, true); Assert::assertEquals(200, $this->response->getStatusCode()); diff --git a/build/integration/features/bootstrap/TagsContext.php b/build/integration/features/bootstrap/TagsContext.php index 8f423244018d1..6f3d8008a20b1 100644 --- a/build/integration/features/bootstrap/TagsContext.php +++ b/build/integration/features/bootstrap/TagsContext.php @@ -500,8 +500,8 @@ public function deletesTheTagWithName($user, $name) { private function getFileIdForPath($path, $user) { $url = $this->baseUrl . '/remote.php/webdav/' . $path; $credentials = base64_encode($user . ':' . $this->getPasswordForUser($user)); - $context = stream_context_create(array( - 'http' => array( + $context = stream_context_create([ + 'http' => [ 'method' => 'PROPFIND', 'header' => "Authorization: Basic $credentials\r\nContent-Type: application/x-www-form-urlencoded", 'content' => ' @@ -510,8 +510,8 @@ private function getFileIdForPath($path, $user) { ' - ) - )); + ] + ]); $response = file_get_contents($url, false, $context); preg_match_all('/\(.*?)\<\/oc:fileid\>/', $response, $matches); return (int)$matches[1][0]; diff --git a/config/config.sample.php b/config/config.sample.php index 3dc168706758d..0e19f69826149 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -20,7 +20,7 @@ * * use RST syntax */ -$CONFIG = array( +$CONFIG = [ /** @@ -69,12 +69,12 @@ * Using TLS certificates where commonName= is deprecated */ 'trusted_domains' => - array ( + [ 'demo.example.org', 'otherdomain.example.org', '10.111.112.113', '[2001:db8::1]' - ), + ], /** @@ -418,7 +418,7 @@ * will be passed to underlying Swift mailer implementation. * Defaults to an empty array. */ -'mail_smtpstreamoptions' => array(), +'mail_smtpstreamoptions' => [], /** * Which mode is used for sendmail/qmail: ``smtp`` or ``pipe``. @@ -696,12 +696,12 @@ * - www.eff.org * - www.edri.org */ -'connectivity_check_domains' => array( +'connectivity_check_domains' => [ 'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org' -), +], /** * Allows Nextcloud to verify a working .well-known URL redirects. This is done @@ -900,13 +900,13 @@ * to that folder, starting from the Nextcloud webroot. The key ``writable`` * indicates if a Web server can write files to that folder. */ -'apps_paths' => array( - array( +'apps_paths' => [ + [ 'path'=> '/var/www/nextcloud/apps', 'url' => '/apps', 'writable' => true, - ), -), + ], +], /** * @see appcodechecker @@ -1014,7 +1014,7 @@ * - OC\Preview\TXT * - OC\Preview\XBitmap */ -'enabledPreviewProviders' => array( +'enabledPreviewProviders' => [ 'OC\Preview\PNG', 'OC\Preview\JPEG', 'OC\Preview\GIF', @@ -1024,7 +1024,7 @@ 'OC\Preview\MP3', 'OC\Preview\TXT', 'OC\Preview\MarkDown' -), +], /** * LDAP @@ -1102,9 +1102,9 @@ * * Defaults to an empty array. */ -'openssl' => array( +'openssl' => [ 'config' => '/absolute/location/of/openssl.cnf', -), +], /** * Memory caching backend configuration @@ -1198,18 +1198,18 @@ /** * Server details for one or more memcached servers to use for memory caching. */ -'memcached_servers' => array( +'memcached_servers' => [ // hostname, port and optional weight. Also see: // http://www.php.net/manual/en/memcached.addservers.php // http://www.php.net/manual/en/memcached.addserver.php - array('localhost', 11211), + ['localhost', 11211], //array('other.host.local', 11211), -), +], /** * Connection options for memcached */ -'memcached_options' => array( +'memcached_options' => [ // Set timeouts to 50ms \Memcached::OPT_CONNECT_TIMEOUT => 50, \Memcached::OPT_RETRY_TIMEOUT => 50, @@ -1228,7 +1228,7 @@ // Binary serializer vill be enabled if the igbinary PECL module is available //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, -), +], /** @@ -1378,10 +1378,10 @@ * Additional driver options for the database connection, eg. to enable SSL * encryption in MySQL or specify a custom wait timeout on a cheap hoster. */ -'dbdriveroptions' => array( +'dbdriveroptions' => [ PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' -), +], /** * sqlite3 journal mode can be specified using this configuration parameter - @@ -1436,12 +1436,12 @@ * - mysql (MySQL) * - pgsql (PostgreSQL) */ -'supportedDatabases' => array( +'supportedDatabases' => [ 'sqlite', 'mysql', 'pgsql', 'oci', -), +], /** * Override where Nextcloud stores temporary files. Useful in situations where @@ -1507,7 +1507,7 @@ * * Defaults to ``array('.htaccess')`` */ -'blacklisted_files' => array('.htaccess'), +'blacklisted_files' => ['.htaccess'], /** * Define a default folder for shared files and folders other than root. @@ -1634,7 +1634,7 @@ * * Defaults to an empty array. */ -'trusted_proxies' => array('203.0.113.45', '198.51.100.128', '192.168.2.0/24'), +'trusted_proxies' => ['203.0.113.45', '198.51.100.128', '192.168.2.0/24'], /** * Headers that should be trusted as client IP address in combination with @@ -1646,7 +1646,7 @@ * * Defaults to ``'HTTP_X_FORWARDED_FOR'`` */ -'forwarded_for_headers' => array('HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR'), +'forwarded_for_headers' => ['HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR'], /** * max file size for animating gifs on public-sharing-site. @@ -1767,10 +1767,10 @@ * * WARNING: only use this if you know what you are doing */ -'csrf.optout' => array( +'csrf.optout' => [ '/^WebDAVFS/', // OS X Finder '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive -), +], /** * By default there is on public pages a link shown that allows users to @@ -1789,4 +1789,4 @@ */ 'login_form_autocomplete' => true, -); +]; diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index f02da1c66ba88..19d0251d82481 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $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 c38571d7c6290..dd9290eea81d2 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $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 f2b833fe9144e..3e67e1329f03c 100644 --- a/core/Command/L10n/CreateJs.php +++ b/core/Command/L10n/CreateJs.php @@ -72,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { } private function getAllLanguages($path) { - $result = array(); + $result = []; foreach (new DirectoryIterator("$path/l10n") as $fileInfo) { if($fileInfo->isDot()) { continue; @@ -102,7 +102,7 @@ private function writeJsFile($app, $path, $lang, OutputInterface $output, $trans 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 @@ private function writeJsonFile($path, $lang, OutputInterface $output, $translati $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 8f615004f3c8a..25632a313f36b 100644 --- a/core/Command/Status.php +++ b/core/Command/Status.php @@ -38,12 +38,12 @@ protected function configure() { } 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 944b1da9f2655..0a66d63fd3215 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -285,7 +285,7 @@ function ($success) use($output, $self) { * @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( 'The setting "trusted_domains" could not be ' . diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index 3f15d40dba7e0..77fbcc124faaa 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -52,25 +52,25 @@ protected function configure() { 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 e8d9b8675b657..cdeec469e046a 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -170,7 +170,7 @@ public function resetform($token, $userId) { } catch (\Exception $e) { return new TemplateResponse( 'core', 'error', [ - "errors" => array(array("error" => $e->getMessage())) + "errors" => [["error" => $e->getMessage()]] ], 'guest' ); @@ -231,8 +231,8 @@ protected function checkPasswordResetToken($token, $userId) { * @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 @@ public function setPassword($token, $userId, $password, $proceed) { $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 @@ public function setPassword($token, $userId, $password, $proceed) { $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 @@ protected function sendEmail($input) { $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 664909b0fb946..60ea12f017c13 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -92,14 +92,14 @@ public function getConfig() { 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 302edccf7a64d..0135e01f1487e 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -74,7 +74,7 @@ public function run($post) { 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 @@ private function displaySetupForbidden() { } public function display($post) { - $defaults = array( + $defaults = [ 'adminlogin' => '', 'adminpass' => '', 'dbuser' => '', @@ -102,7 +102,7 @@ public function display($post) { 'dbtablespace' => '', 'dbhost' => 'localhost', 'dbtype' => '', - ); + ]; $parameters = array_merge($defaults, $post); \OC_Util::addScript('setup'); @@ -133,7 +133,7 @@ private function finishSetup(bool $installRecommended) { 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 23b2eda4e2684..54c5202a59f3f 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -53,7 +53,7 @@ public function __construct($appName, * @return JSONResponse */ public function getDisplayNames($users) { - $result = array(); + $result = []; foreach ($users as $user) { $userObject = $this->userManager->get($user); @@ -64,10 +64,10 @@ public function getDisplayNames($users) { } } - $json = array( + $json = [ 'users' => $result, 'status' => 'success' - ); + ]; return new JSONResponse($json); diff --git a/core/ajax/update.php b/core/ajax/update.php index 1744e2db18cc9..fd0e2c80d645a 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -186,7 +186,7 @@ public function handleRepairFeedback($event) { $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 071d57b1b68a1..925059d47500b 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -20,7 +20,7 @@

t('File not found')); ?>

t('The document could not be found on the server. Maybe the share was deleted or has expired?')); ?>

- t('Back to %s', array($theme->getName()))); ?> + t('Back to %s', [$theme->getName()])); ?>

diff --git a/core/templates/installation.php b/core/templates/installation.php index 5a351e97416c9..25052782e6fcc 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -81,7 +81,7 @@ $label): ?>

- t( 'Only %s is available.', array($label) )); ?> + t( 'Only %s is available.', [$label] )); ?> t( 'Install and activate additional PHP modules to choose other database types.' )); ?>
t( 'For more details check out the documentation.' )); ?> ↗ diff --git a/core/templates/update.admin.php b/core/templates/update.admin.php index f4a1c72ae8d8f..4a010c025be62 100644 --- a/core/templates/update.admin.php +++ b/core/templates/update.admin.php @@ -4,7 +4,7 @@

t('App update required')); ?>

t('%1$s will be updated to version %2$s', - array($_['productName'], $_['version']))); ?>

+ [$_['productName'], $_['version']])); ?>
@@ -28,7 +28,7 @@
- t('The theme %s has been disabled.', array($_['oldTheme']))) ?> + t('The theme %s has been disabled.', [$_['oldTheme']])) ?>
diff --git a/core/templates/update.user.php b/core/templates/update.user.php index 661d7d45a3070..2c6ffd4344468 100644 --- a/core/templates/update.user.php +++ b/core/templates/update.user.php @@ -1,6 +1,6 @@ diff --git a/cron.php b/cron.php index 626e9a777d676..7822c8e8ba369 100644 --- a/cron.php +++ b/cron.php @@ -77,7 +77,7 @@ if (OC::$CLI) { echo 'Background Jobs are disabled!' . PHP_EOL; } else { - OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!'))); + OC_JSON::error(['data' => ['message' => 'Background jobs disabled!']]); } exit(1); } @@ -140,7 +140,7 @@ // We call cron.php from some website if ($appMode === 'cron') { // Cron is cron :-P - OC_JSON::error(array('data' => array('message' => 'Backgroundjobs are using system cron!'))); + OC_JSON::error(['data' => ['message' => 'Backgroundjobs are using system cron!']]); } else { // Work and success :-) $jobList = \OC::$server->getJobList(); diff --git a/index.php b/index.php index 1b3a8c04bdebf..76a414d9c5a37 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ OC::handleRequest(); } catch(\OC\ServiceUnavailableException $ex) { - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 503); @@ -47,8 +47,8 @@ OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503); } catch (Exception $ex2) { try { - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); - \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); + \OC::$server->getLogger()->logException($ex2, ['app' => 'index']); } catch (Throwable $e) { // no way to log it properly - but to avoid a white page of death we try harder and ignore this one here } @@ -59,13 +59,13 @@ } catch (\OC\User\LoginException $ex) { OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403); } catch (Exception $ex) { - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); //show the user a detailed error page OC_Template::printExceptionErrorPage($ex, 500); } catch (Error $ex) { try { - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); } catch (Error $e) { http_response_code(500); header('Content-Type: text/plain; charset=utf-8'); diff --git a/lib/autoloader.php b/lib/autoloader.php index 5a62cd5c7c0d8..07e81f37ae952 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -158,7 +158,7 @@ public function load(string $class): bool { if (!is_array($pathsToRequire)) { // No cache or cache miss - $pathsToRequire = array(); + $pathsToRequire = []; foreach ($this->findClass($class) as $path) { $fullPath = stream_resolve_include_path($path); if ($fullPath && $this->isValidPath($fullPath)) { diff --git a/lib/base.php b/lib/base.php index c0feee3d1e735..d3b0c42f1bbac 100644 --- a/lib/base.php +++ b/lib/base.php @@ -76,7 +76,7 @@ class OC { /** * Associative array for autoloading. classname => filename */ - public static $CLASSPATH = array(); + public static $CLASSPATH = []; /** * The installation path for Nextcloud on the server (e.g. /srv/http/nextcloud) */ @@ -93,7 +93,7 @@ class OC { * The installation path array of the apps folder on the server (e.g. /srv/http/nextcloud) 'path' and * web path in 'url' */ - public static $APPSROOTS = array(); + public static $APPSROOTS = []; /** * @var string @@ -196,7 +196,7 @@ public static function initPaths() { } // search the apps folder - $config_paths = self::$config->getValue('apps_paths', array()); + $config_paths = self::$config->getValue('apps_paths', []); if (!empty($config_paths)) { foreach ($config_paths as $paths) { if (isset($paths['url']) && isset($paths['path'])) { @@ -206,20 +206,20 @@ public static function initPaths() { } } } elseif (file_exists(OC::$SERVERROOT . '/apps')) { - OC::$APPSROOTS[] = array('path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true); + OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true]; } elseif (file_exists(OC::$SERVERROOT . '/../apps')) { - OC::$APPSROOTS[] = array( + OC::$APPSROOTS[] = [ 'path' => rtrim(dirname(OC::$SERVERROOT), '/') . '/apps', 'url' => '/apps', 'writable' => true - ); + ]; } if (empty(OC::$APPSROOTS)) { throw new \RuntimeException('apps directory not found! Please put the Nextcloud apps folder in the Nextcloud folder' . ' or the folder above. You can also configure the location in the config.php file.'); } - $paths = array(); + $paths = []; foreach (OC::$APPSROOTS as $path) { $paths[] = $path['path']; if (!is_dir($path['path'])) { @@ -423,7 +423,7 @@ public static function initSession() { // Allow session apps to create a custom session object $useCustomSession = false; $session = self::$server->getSession(); - OC_Hook::emit('OC', 'initSession', array('session' => &$session, 'sessionName' => &$sessionName, 'useCustomSession' => &$useCustomSession)); + OC_Hook::emit('OC', 'initSession', ['session' => &$session, 'sessionName' => &$sessionName, 'useCustomSession' => &$useCustomSession]); if (!$useCustomSession) { // set the session name to the instance id - which is unique $session = new \OC\Session\Internal($sessionName); @@ -570,7 +570,7 @@ public static function init() { if (defined('PHPUNIT_RUN')) { self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); } - spl_autoload_register(array(self::$loader, 'load')); + spl_autoload_register([self::$loader, 'load']); $loaderEnd = microtime(true); self::$CLI = (php_sapi_name() == 'cli'); @@ -646,7 +646,7 @@ public static function init() { } \OC::$server->getEventLogger()->start('init_session', 'Initialize session'); - OC_App::loadApps(array('session')); + OC_App::loadApps(['session']); if (!self::$CLI) { self::initSession(); } @@ -665,7 +665,7 @@ public static function init() { http_response_code(503); OC_Util::addStyle('guest'); try { - OC_Template::printGuestPage('', 'error', array('errors' => $errors)); + OC_Template::printGuestPage('', 'error', ['errors' => $errors]); exit; } catch (\Exception $e) { // In case any error happens when showing the error page, we simply fall back to posting the text. @@ -742,9 +742,9 @@ public static function init() { //make sure temporary files are cleaned up $tmpManager = \OC::$server->getTempManager(); - register_shutdown_function(array($tmpManager, 'clean')); + register_shutdown_function([$tmpManager, 'clean']); $lockProvider = \OC::$server->getLockingProvider(); - register_shutdown_function(array($lockProvider, 'releaseAll')); + register_shutdown_function([$lockProvider, 'releaseAll']); // Check whether the sample configuration has been copied if($systemConfig->getValue('copied_sample_config', false)) { @@ -997,7 +997,7 @@ public static function handleRequest() { OC_App::loadApps(); } else { // For guests: Load only filesystem and logging - OC_App::loadApps(array('filesystem', 'logging')); + OC_App::loadApps(['filesystem', 'logging']); self::handleLogin($request); } } @@ -1005,7 +1005,7 @@ public static function handleRequest() { if (!self::$CLI) { try { if (!((bool) $systemConfig->getValue('maintenance', false)) && !\OCP\Util::needUpgrade()) { - OC_App::loadApps(array('filesystem', 'logging')); + OC_App::loadApps(['filesystem', 'logging']); OC_App::loadApps(); } OC_Util::setupFS(); @@ -1075,10 +1075,10 @@ protected static function handleAuthHeaders() { } // Extract PHP_AUTH_USER/PHP_AUTH_PW from other headers if necessary. - $vars = array( + $vars = [ 'HTTP_AUTHORIZATION', // apache+php-cgi work around 'REDIRECT_HTTP_AUTHORIZATION', // apache+php-cgi alternative - ); + ]; foreach ($vars as $var) { if (isset($_SERVER[$var]) && preg_match('/Basic\s+(.*)$/i', $_SERVER[$var], $matches)) { $credentials = explode(':', base64_decode($matches[1]), 2); diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php index 8a3c5b8142733..6d9b6b3cd2fe5 100644 --- a/lib/private/Activity/Manager.php +++ b/lib/private/Activity/Manager.php @@ -76,10 +76,10 @@ public function __construct(IRequest $request, } /** @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 2eca9d55b2859..0111fad246f7a 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -297,7 +297,7 @@ public function setUserValue($userId, $appName, $key, $value, $preCondition = nu // 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 @@ public function getUserKeys($userId, $appName) { if (isset($data[$appName])) { return array_keys($data[$appName]); } else { - return array(); + return []; } } @@ -350,7 +350,7 @@ public function deleteUserValue($userId, $appName, $key) { $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 @@ public function deleteAllUserValues($userId) { $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 @@ public function deleteAppFromAllUsers($appName) { $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 @@ private function getUserValues($userId) { 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 @@ public function getUserValueForUsers($appName, $key, $userIds) { $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 @@ public function getUsersForUserValue($appName, $key, $value) { $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 @@ public function getUsersForUserValueCaseInsensitive($appName, $key, $value) { $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 937cc511985c4..1fcf4e8281fc1 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -540,7 +540,7 @@ public function getAppVersion(string $appId, bool $useCache = true): string { */ 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 a59e8c21735e0..81ae6e7a168d1 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -188,7 +188,7 @@ private function analyzeDatabases(array $dependencies) { return $missing; } if (!is_array($supportedDatabases)) { - $supportedDatabases = array($supportedDatabases); + $supportedDatabases = [$supportedDatabases]; } $supportedDatabases = array_map(function ($db) { return $this->getValue($db); @@ -212,7 +212,7 @@ private function analyzeCommands(array $dependencies) { $commands = $dependencies['command']; if (!is_array($commands)) { - $commands = array($commands); + $commands = [$commands]; } if (isset($commands['@value'])) { $commands = [$commands]; @@ -242,7 +242,7 @@ private function analyzeLibraries(array $dependencies) { $libs = $dependencies['lib']; if (!is_array($libs)) { - $libs = array($libs); + $libs = [$libs]; } if (isset($libs['@value'])) { $libs = [$libs]; @@ -294,7 +294,7 @@ private function analyzeOS(array $dependencies) { 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 c285554ae1c12..61def8ff43431 100644 --- a/lib/private/App/PlatformRepository.php +++ b/lib/private/App/PlatformRepository.php @@ -38,11 +38,11 @@ public function __construct() { 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 1dbccf7590b90..6f4a48d890723 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 383dffb63d31d..05eae742641ec 100644 --- a/lib/private/AppFramework/Http.php +++ b/lib/private/AppFramework/Http.php @@ -45,7 +45,7 @@ public function __construct($server, $protocolVersion='HTTP/1.1') { $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 @@ public function __construct($server, $protocolVersion='HTTP/1.1') { 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 20bab49adf890..08c9d23863e27 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 @@ public function addFolder($path) { 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 @@ public function rename($source, $dest) { 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 @@ public function mtime($path) { */ public function getFolder($path) { $files = $this->getFiles(); - $folderContent = array(); + $folderContent = []; $pathLength = strlen($path); foreach ($files as $file) { if ($file[0] == '/') { @@ -232,7 +232,7 @@ public function getFiles() { if (!$this->cachedHeaders) { $this->cachedHeaders = $this->tar->listContent(); } - $files = array(); + $files = []; foreach ($this->cachedHeaders as $header) { $files[] = $header['filename']; } @@ -263,9 +263,9 @@ public function extractFile($path, $dest) { 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 @@ public function remove($path) { $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 @@ private function reopen() { $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 2c3df550f7198..cb04b572c030f 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -113,7 +113,7 @@ public function mtime($path) { */ 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 @@ public function getFolder($path) { */ 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 8f8e5e449cc67..86df8aada730b 100644 --- a/lib/private/Avatar/Avatar.php +++ b/lib/private/Avatar/Avatar.php @@ -232,7 +232,7 @@ protected function imageTTFCenter( $x = intval(($xi - $xr) / 2); $y = intval(($yi + $yr) / 2); - return array($x, $y); + return [$x, $y]; } /** @@ -242,7 +242,7 @@ protected function imageTTFCenter( * @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 @@ private function stepCalc($steps, $ends) { * @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 @@ private function mixPalette($steps, $color1, $color2) { */ 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 ba81041c9de9c..64c9972ae0193 100644 --- a/lib/private/BackgroundJob/Legacy/QueuedJob.php +++ b/lib/private/BackgroundJob/Legacy/QueuedJob.php @@ -28,8 +28,8 @@ public function run($argument) { $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 09ddb78d4f31e..6e4c790a1f34f 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -193,11 +193,11 @@ public function gc() { } } 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 96337627be280..55e0b0c8967ae 100644 --- a/lib/private/CapabilitiesManager.php +++ b/lib/private/CapabilitiesManager.php @@ -36,7 +36,7 @@ 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 a21c27f1b51d5..5366cd295d41b 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 @@ protected function delete($key) { */ 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 ba709baefe576..ca4a7d885cd8a 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -41,12 +41,12 @@ class ContactsManager implements \OCP\Contacts\IManager { * - '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 @@ public function unregisterAddressBook(\OCP\IAddressBook $addressBook) { */ public function getAddressBooks() { $this->loadAddressBooks(); - $result = array(); + $result = []; foreach($this->addressBooks as $addressBook) { $result[$addressBook->getKey()] = $addressBook->getDisplayName(); } @@ -154,19 +154,19 @@ public function getUserAddressBooks(): Array { * 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 @@ protected function loadAddressBooks() 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 8150f08593fd3..03cd7f1af6670 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -190,7 +190,7 @@ public function prepare( $statement, $limit=null, $offset=null ) { * * @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 @@ public function executeQuery($query, array $params = array(), $types = array(), * * @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 @@ public function getError() { 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 @@ public function dropTable($table) { 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 427a292b6b536..3722aa9a05ed9 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -106,9 +106,9 @@ public function getDefaultConnectionParams($type) { // \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 b18929cbd195e..874537298ee90 100644 --- a/lib/private/DB/MDB2SchemaReader.php +++ b/lib/private/DB/MDB2SchemaReader.php @@ -155,7 +155,7 @@ private function loadDeclaration($table, $xml) { * @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 @@ private function loadField($table, $xml) { $table->addColumn($name, $type, $options); if (!empty($options['primary']) && $options['primary']) { - $table->setPrimaryKey(array($name)); + $table->setPrimaryKey([$name]); } } } @@ -274,7 +274,7 @@ private function loadField($table, $xml) { */ 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 8b1621a5f5505..bda0720b3bbcf 100644 --- a/lib/private/DB/Migrator.php +++ b/lib/private/DB/Migrator.php @@ -155,7 +155,7 @@ protected function checkTableMigrate(Table $table) { $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 @@ protected function renameTableSchema(Table $table, $newName) { * @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 @@ protected function renameTableSchema(Table $table, $newName) { } // 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 236d462b02ca6..4c906a0107de0 100644 --- a/lib/private/DB/OracleConnection.php +++ b/lib/private/DB/OracleConnection.php @@ -46,7 +46,7 @@ private function quoteKeys(array $data) { /** * {@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 @@ public function insert($tableName, array $data, array $types = array()) { /** * {@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 @@ public function update($tableName, array $data, array $identifier, array $types /** * {@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 @@ public function dropTable($table) { $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 @@ public function tableExists($table){ $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 d98116292a447..72e1dfe1b276d 100644 --- a/lib/private/DB/PgSqlTools.php +++ b/lib/private/DB/PgSqlTools.php @@ -57,10 +57,10 @@ public function resynchronizeDatabaseSequences(Connection $conn) { $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 ba5ee17335283..1e96910af4a6c 100644 --- a/lib/private/DB/QueryBuilder/CompositeExpression.php +++ b/lib/private/DB/QueryBuilder/CompositeExpression.php @@ -44,7 +44,7 @@ public function __construct(\Doctrine\DBAL\Query\Expression\CompositeExpression * * @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 c9fc3eb5f21eb..9871e9284f83f 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -273,7 +273,7 @@ public function setParameter($key, $value, $type = null) { * * @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 bd9504a3fed04..244bbd6f628d5 100644 --- a/lib/private/DB/SQLiteMigrator.php +++ b/lib/private/DB/SQLiteMigrator.php @@ -43,10 +43,10 @@ public function checkMigrate(\Doctrine\DBAL\Schema\Schema $targetSchema) { $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 a34bd509091a9..ed4d75cb278ec 100644 --- a/lib/private/DB/SQLiteSessionInit.php +++ b/lib/private/DB/SQLiteSessionInit.php @@ -65,6 +65,6 @@ public function postConnect(ConnectionEventArgs $args) { } public function getSubscribedEvents() { - return array(Events::postConnect); + return [Events::postConnect]; } } diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index 4ff3e1e5eaf6a..b2b628090bfd9 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -311,8 +311,8 @@ protected function format($timestamp, $type, $format, \DateTimeZone $timeZone = $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 f7351ec1bedf9..63eb40dd0982f 100644 --- a/lib/private/Encryption/DecryptAll.php +++ b/lib/private/Encryption/DecryptAll.php @@ -208,7 +208,7 @@ protected function decryptAllUsersFiles($user = '') { 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 1c71ec7dd9512..0fc9dcc686697 100644 --- a/lib/private/Encryption/File.php +++ b/lib/private/Encryption/File.php @@ -71,10 +71,10 @@ public function getAccessList($path) { 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 @@ public function getAccessList($path) { // 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 183db55c7ea77..c75210564d633 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 @@ public function setupStorage() { // 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 3bb7680989b09..4f4d9555fd454 100644 --- a/lib/private/Encryption/Update.php +++ b/lib/private/Encryption/Update.php @@ -158,7 +158,7 @@ protected function getOwnerPath($path) { throw new \InvalidArgumentException('No file found for ' . $info->getId()); } - return array($owner, $path); + return [$owner, $path]; } /** @@ -181,7 +181,7 @@ public function update($path) { 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 b173d1eae5ce8..98652e1ecc581 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -164,8 +164,8 @@ public function createHeader(array $headerData, IEncryptionModule $encryptionMod * @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 @@ public function getUidAndFilename($path) { $ownerPath = implode('/', array_slice($parts, 2)); - return array($uid, Filesystem::normalizePath($ownerPath)); + return [$uid, Filesystem::normalizePath($ownerPath)]; } @@ -325,7 +325,7 @@ public function isSystemWideMountPoint($path, $uid) { * @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 ec3c8df519de5..0691c1d1e4436 100644 --- a/lib/private/Files/Cache/HomeCache.php +++ b/lib/private/Files/Cache/HomeCache.php @@ -54,14 +54,14 @@ public function calculateFolderSize($path, $entry = null) { $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 30688a8da3e84..b481a9918b975 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -164,8 +164,8 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = // 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 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = // 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 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = } 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 @@ protected function addToCache($path, $data, $fileId = -1) { 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 @@ protected function addToCache($path, $data, $fileId = -1) { * @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 @@ public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $loc * @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 @@ protected function getExistingChildren($folderId) { * @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 @@ protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse 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 @@ protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse } } 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 @@ public function backgroundScan() { 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 13af41acfea6c..439ed30890cf5 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -127,7 +127,7 @@ public function getNumericId() { 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 @@ public static function remove($storageId) { $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 59cff9b3a4110..b093b591d4e38 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -247,7 +247,7 @@ private function correctParentStorageMtime($internalPath) { 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 beb49ff2d652e..884054c9a028d 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 92601e38d13ee..e2ed62b4444f5 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -209,9 +209,9 @@ public function getStatus($file) { } 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 @@ public function calculateFolderSize($path, $entry = null) { */ 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 40bac888673b9..27aa203655b16 100644 --- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php +++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php @@ -96,7 +96,7 @@ public function getFolderContents($folder) { */ 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 @@ public function getStatus($file) { */ 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 @@ public function search($pattern) { */ 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 4ef3f9f8d942b..4b723cc764bcf 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 @@ public function getMountsForUser(IUser $user) { }); $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 24d21ad604920..d4e584c39f987 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 @@ static public function getMountPoints($path) { 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 @@ static public function resolvePath($path) { } $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 @@ public static function initMountPoints($user = '') { '/' . $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 @@ private static function listenForNewMountProviders(MountProviderCollection $moun $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 @@ static public function getRoot() { */ public static function clearMounts() { if (self::$mounts) { - self::$usersSetup = array(); + self::$usersSetup = []; self::$mounts->clear(); } } @@ -619,7 +619,7 @@ static public function isBlacklisted($data) { 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 2b5fa3f7199cc..93f9941d38320 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 dcfa0b93ed1cd..fd5e996627d2c 100644 --- a/lib/private/Files/Node/File.php +++ b/lib/private/Files/Node/File.php @@ -67,12 +67,12 @@ public function getContent() { */ 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 @@ public function putContent($data) { * @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 @@ public function fopen($mode) { */ 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 727b08e9335f7..f910eb27fdf08 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -205,9 +205,9 @@ public function newFile($path, $content = null) { */ 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 @@ public function search($query) { * @return Node[] */ public function searchByMime($mimetype) { - return $this->searchCommon('searchByMime', array($mimetype)); + return $this->searchCommon('searchByMime', [$mimetype]); } /** @@ -229,7 +229,7 @@ public function searchByMime($mimetype) { * @return Node[] */ public function searchByTag($tag, $userId) { - return $this->searchCommon('searchByTag', array($tag, $userId)); + return $this->searchCommon('searchByTag', [$tag, $userId]); } /** @@ -243,7 +243,7 @@ private function searchCommon($method, $args) { 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 @@ private function searchCommon($method, $args) { $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 @@ public function getFreeSpace() { 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 8076c3b4f6abe..654badbd9d0fe 100644 --- a/lib/private/Files/Node/LazyRoot.php +++ b/lib/private/Files/Node/LazyRoot.php @@ -89,14 +89,14 @@ public function removeListener($scope = null, $method = null, callable $callback /** * @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 896b30503843b..a8b5fea6be8bf 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -139,9 +139,9 @@ public function delete() { */ 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 948715aec04bb..843069ff50d54 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -133,7 +133,7 @@ public function removeListener($scope = null, $method = null, callable $callback * @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 @@ public function emit($scope, $method, $arguments = array()) { * @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 f82eb7b1ddcf7..c25594ccb3f50 100644 --- a/lib/private/Files/ObjectStore/NoopScanner.php +++ b/lib/private/Files/ObjectStore/NoopScanner.php @@ -44,7 +44,7 @@ public function __construct(Storage $storage) { * @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 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = * @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 e0d437839a066..0f2d1f244a80e 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -245,7 +245,7 @@ public function opendir($path) { $path = $this->normalizePath($path); try { - $files = array(); + $files = []; $folderContents = $this->getCache()->getFolderContents($path); foreach ($folderContents as $file) { $files[] = $file['name']; @@ -375,14 +375,14 @@ public function touch($path, $mtime = null) { // 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 f931b6092a6fb..f4ed8c5b5c0b1 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -117,7 +117,7 @@ public function getConnection() { 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 8760fae1185f5..c976174f8cf05 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -296,7 +296,7 @@ private function addLocalFolder($path, $target) { * @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 @@ public function cleanPath($path) { $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 625e5f3f6250e..970f3f8c15622 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -265,7 +265,7 @@ protected function propfind($path) { try { $response = $this->client->propFind( $this->encodePath($path), - array( + [ '{DAV:}getlastmodified', '{DAV:}getcontentlength', '{DAV:}getcontenttype', @@ -273,7 +273,7 @@ protected function propfind($path) { '{http://open-collaboration-services.org/ns}share-permissions', '{DAV:}resourcetype', '{DAV:}getetag', - ) + ] ); $this->statCache->set($path, $response); } catch (ClientHttpException $e) { @@ -591,7 +591,7 @@ public function stat($path) { } 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 13a3ca87097fa..e186d29c34830 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -107,7 +107,7 @@ public function rmdir($path) { * @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 @@ public function getLocalFolder($path) { * @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 bb501cb55659b..2e1d1e33bef2d 100644 --- a/lib/private/Files/Storage/Temporary.php +++ b/lib/private/Files/Storage/Temporary.php @@ -30,7 +30,7 @@ */ 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 68cf6f99ee5d3..cbe9b87450168 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 @@ public function __construct( $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 @@ protected function getHeaderSize($path) { * @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 7cb24f9b5b608..3030fa8c7ef37 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -503,7 +503,7 @@ public function instanceOfStorage($class) { * @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 dc6cd9cea7f60..2ae872de33788 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 @@ public function __construct() { 'encryptionStorage', 'headerSize', 'signed' - ); + ]; } @@ -165,8 +165,8 @@ public static function wrap($source, $internalPath, $fullPath, array $header, $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 @@ public static function wrap($source, $internalPath, $fullPath, array $header, '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 08272ad61cb2d..f07c0c2b678f0 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 1352963fc67f1..0db564032acf0 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -103,7 +103,7 @@ public function __construct(IURLGenerator $urlGenerator, 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 4febf9afbf145..d9afe1381715e 100644 --- a/lib/private/Files/Type/TemplateManager.php +++ b/lib/private/Files/Type/TemplateManager.php @@ -29,7 +29,7 @@ * @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 943078215b5e2..49f8177834a6c 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -131,19 +131,19 @@ protected function getMounts($dir) { 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 8ea94626a2aaa..abfde63be5a64 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -266,7 +266,7 @@ public function getLocalFolder($path) { * 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 @@ protected function removeMount($mount, $path) { $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 @@ protected function removeMount($mount, $path) { 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 @@ public function rmdir($path) { 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 @@ public function rmdir($path) { * @return resource */ public function opendir($path) { - return $this->basicOperation('opendir', $path, array('read')); + return $this->basicOperation('opendir', $path, ['read']); } /** @@ -559,7 +559,7 @@ public function touch($path, $mtime = null) { $mtime = strtotime($mtime); } - $hooks = array('touch'); + $hooks = ['touch']; if (!$this->file_exists($path)) { $hooks[] = 'create'; @@ -581,7 +581,7 @@ public function touch($path, $mtime = null) { $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 @@ public function touch($path, $mtime = null) { * @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 @@ public function file_get_contents($path) { */ 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 @@ protected function emit_file_hooks_pre($exists, $path, &$run) { */ 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 @@ public function file_put_contents($path, $data) { 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 @@ public function rename($path1, $path2) { } 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 @@ public function rename($path1, $path2) { \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 @@ public function copy($path1, $path2, $preserveMtime = false) { \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 @@ public function copy($path1, $path2, $preserveMtime = false) { \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 @@ public function copy($path1, $path2, $preserveMtime = false) { */ 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 @@ public function hash($type, $path, $raw = false) { \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 @@ private function runHooks($hooks, $path, $post = false) { \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 @@ private function runHooks($hooks, $path, $post = false) { * @return bool */ public function hasUpdated($path, $time) { - return $this->basicOperation('hasUpdated', $path, array(), $time); + return $this->basicOperation('hasUpdated', $path, [], $time); } /** @@ -1591,7 +1591,7 @@ public function putFileInfo($path, $data) { * @return FileInfo[] */ public function search($query) { - return $this->searchCommon('search', array('%' . $query . '%')); + return $this->searchCommon('search', ['%' . $query . '%']); } /** @@ -1601,7 +1601,7 @@ public function search($query) { * @return FileInfo[] */ public function searchRaw($query) { - return $this->searchCommon('search', array($query)); + return $this->searchCommon('search', [$query]); } /** @@ -1611,7 +1611,7 @@ public function searchRaw($query) { * @return FileInfo[] */ public function searchByMime($mimetype) { - return $this->searchCommon('searchByMime', array($mimetype)); + return $this->searchCommon('searchByMime', [$mimetype]); } /** @@ -1622,7 +1622,7 @@ public function searchByMime($mimetype) { * @return FileInfo[] */ public function searchByTag($tag, $userId) { - return $this->searchCommon('searchByTag', array($tag, $userId)); + return $this->searchCommon('searchByTag', [$tag, $userId]); } /** @@ -1631,7 +1631,7 @@ public function searchByTag($tag, $userId) { * @return FileInfo[] */ private function searchCommon($method, $args) { - $files = array(); + $files = []; $rootLength = strlen($this->fakeRoot); $mount = $this->getMount(''); @@ -1640,7 +1640,7 @@ private function searchCommon($method, $args) { 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 @@ private function searchCommon($method, $args) { $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 @@ private function getParents($path) { // 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 06cc8ae846f32..dca3a0ed04241 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -94,7 +94,7 @@ public function inGroup($uid, $gid) { * if the user exists at all. */ public function getUserGroups($uid) { - return array(); + return []; } /** @@ -108,7 +108,7 @@ public function getUserGroups($uid) { */ public function getGroups($search = '', $limit = -1, $offset = 0) { - return array(); + return []; } /** @@ -129,6 +129,6 @@ public function groupExists($gid) { * @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 26e23e3b1b1a5..b14489fe0d9ea 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 @@ public function getUsers() { return $this->users; } - $userIds = array(); + $userIds = []; foreach ($this->backends as $backend) { $diff = array_diff( $backend->usersInGroup($this->gid), @@ -177,7 +177,7 @@ public function addUser(IUser $user) { ])); 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 @@ public function addUser(IUser $user) { ])); 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 @@ public function removeUser($user) { '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 @@ public function removeUser($user) { '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 @@ public function removeUser($user) { * @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 @@ public function countDisabled() { * @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 @@ public function delete() { $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 @@ public function delete() { 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 @@ public function delete() { */ 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 0879138619c9f..f789e0d358f15 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -342,7 +342,7 @@ public function getUserGroupIds(IUser $user) { */ 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 2a0198bc451f0..a48baa15cfecf 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 @@ public function get($groupSearch = '', $userSearch = '') { 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 @@ public function get($groupSearch = '', $userSearch = '') { $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 @@ private function addEntry(&$entries, &$sortKeys, &$sortIndex, $data) { * @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 a3c7e2df5da5d..58b8242ec5489 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 @@ public function listen($scope, $method, callable $callback) { * @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 @@ public function removeListener($scope = null, $method = null, callable $callback unset($this->listeners[$name][$index]); } } else { - $this->listeners[$name] = array(); + $this->listeners[$name] = []; } } } @@ -93,7 +93,7 @@ public function removeListener($scope = null, $method = null, callable $callback * @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 d7dc6bfe9b545..431c0333c7296 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 9d4051e5899de..84f8b7b413e1c 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 88c3d7ff32772..dbccc34f2e96c 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 bba5538588265..8cb4bfaccadbf 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -118,7 +118,7 @@ public function get($app, $lang = null, $locale = null) { $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 @@ public function createPluralFunction($string) { $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 @@ public function getLanguages() { // 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 dd75ec9820c16..2706e2ec2c598 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -125,7 +125,7 @@ public function getFileSizeViaCurl($fileName) { $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 7561486a4a92e..5d846da17ce49 100644 --- a/lib/private/Log/ErrorHandler.php +++ b/lib/private/Log/ErrorHandler.php @@ -44,15 +44,15 @@ public static function register($debug=false) { $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 @@ public static function onShutdown() { 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 @@ public static function onError($number, $message, $file, $line) { 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 eb7eedac83ec4..80e0beeba0d99 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -106,7 +106,7 @@ public function write(string $app, $message, int $level) { */ 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 bf1304063a4f2..4bd2263004ce6 100644 --- a/lib/private/Memcache/ArrayCache.php +++ b/lib/private/Memcache/ArrayCache.php @@ -28,7 +28,7 @@ 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 700ed05380eba..83828c95268f0 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -140,7 +140,7 @@ public function clear($prefix = '') { 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 3cc822223530e..32ed9abb06931 100644 --- a/lib/private/NaturalSort.php +++ b/lib/private/NaturalSort.php @@ -32,7 +32,7 @@ class NaturalSort { private static $instance; private $collator; - private $cache = array(); + private $cache = []; /** * Instantiate a new \OC\NaturalSort instance. @@ -58,7 +58,7 @@ private function naturalSortChunkify($t) { 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 47d20073455f1..1de5b1d6a1426 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -115,7 +115,7 @@ public function getAll(string $type = 'link'): array { 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 0be12f3a23438..8f42179f1a003 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 @@ public function getStatusCode() { * @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 e80d6ec78744c..e042ca193cf5e 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -93,7 +93,7 @@ public function __construct(array $repairSteps, EventDispatcherInterface $dispat */ 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 @@ public function emit($scope, $method, array $arguments = []) { 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 d579068e16378..1c50ee2505af9 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -186,7 +186,7 @@ protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTabl ); $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 891fdd9943365..8477d5d0bc92a 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -126,7 +126,7 @@ protected function getAllNonUTF8BinTables(IDBConnection $connection) { " 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 c3ad7be72da10..0ced7848df4ab 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -90,46 +90,46 @@ private static function updateByNameStmt() { 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 af68129e57d6a..6c3bb1fb711ed 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -49,7 +49,7 @@ public function __construct($cache, ILogger $logger) { * @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 645c244990820..38107737a72ca 100644 --- a/lib/private/Route/Route.php +++ b/lib/private/Route/Route.php @@ -133,7 +133,7 @@ public function requirements($requirements) { * 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 db533ff182aaf..e8f012c54698a 100644 --- a/lib/private/Search.php +++ b/lib/private/Search.php @@ -35,8 +35,8 @@ */ 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 @@ public function searchPaged($query, array $inApps = array(), $page = 1, $size = $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 @@ public function searchPaged($query, array $inApps = array(), $page = 1, $size = * Remove all registered search providers */ public function clearProviders() { - $this->providers = array(); - $this->registeredProviders = array(); + $this->providers = []; + $this->registeredProviders = []; } /** @@ -91,7 +91,7 @@ function ($element) use ($provider) { } ); // force regeneration of providers on next search - $this->providers = array(); + $this->providers = []; } /** @@ -99,8 +99,8 @@ function ($element) use ($provider) { * @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 87927b90768ec..4e9a253675acb 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 48ff28a3fb47d..9c47076787c21 100644 --- a/lib/private/Security/CertificateManager.php +++ b/lib/private/Security/CertificateManager.php @@ -88,17 +88,17 @@ public function __construct($uid, 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 971b144e1d0fc..27268981c2bcf 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -391,44 +391,44 @@ public function __construct($webRoot, \OC\Config $config) { $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 @@ public function __construct($webRoot, \OC\Config $config) { $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 @@ public function __construct($webRoot, \OC\Config $config) { }); $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 26299aaa03990..4042d502a7ec3 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -182,7 +182,7 @@ public function getSupportedDatabases($allowAllDatabases = false) { 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 @@ public function getSystemInfo($allowAllDatabases = false) { ]; } - return array( + return [ 'hasSQLite' => isset($databases['sqlite']), 'hasMySQL' => isset($databases['mysql']), 'hasPostgreSQL' => isset($databases['pgsql']), @@ -272,7 +272,7 @@ public function getSystemInfo($allowAllDatabases = false) { 'directory' => $dataDir, 'htaccessWorking' => $htAccessWorking, 'errors' => $errors, - ); + ]; } /** @@ -282,7 +282,7 @@ public function getSystemInfo($allowAllDatabases = false) { public function install($options) { $l = $this->l10n; - $error = array(); + $error = []; $dbType = $options['dbtype']; if (empty($options['adminlogin'])) { @@ -310,7 +310,7 @@ public function install($options) { // 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 d52aaa8882d24..c3c873f2d8b8c 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -67,16 +67,16 @@ public function __construct(IL10N $trans, SystemConfig $config, ILogger $logger, } 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 @@ public function initialize($config) { * @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 75d75254a00a0..f1dcf6c3b5dda 100644 --- a/lib/private/Setup/OCI.php +++ b/lib/private/Setup/OCI.php @@ -52,13 +52,13 @@ public function initialize($config) { } 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 @@ protected function getLastError($connection = null) { } 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 0b97b4c0451f2..9bb482229ef6b 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 4ad9c71b51167..4ec0a306a9a0e 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 2dd91613cbd72..ef37b3b342792 100644 --- a/lib/private/Share/Helper.php +++ b/lib/private/Share/Helper.php @@ -82,15 +82,15 @@ public static function generateTarget($itemType, $itemSource, $shareType, $share * @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 @@ public static function delete($parent, $excludeParent = false, $uidOwner = null, $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 @@ public static function delete($parent, $excludeParent = false, $uidOwner = null, 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 @@ public static function getDefaultExpireSetting() { $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 @@ public static function isSameUserOnSameServer($user1, $server1, $user2, $server2 \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 452b7a4849c1d..e16150b8e6f8e 100644 --- a/lib/private/Share/SearchResultSorter.php +++ b/lib/private/Share/SearchResultSorter.php @@ -56,7 +56,7 @@ public function sort($a, $b) { 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 ed876022bdd8e..d54dcb2e0e2c4 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 @@ public static function getItemsSharedWithUser($itemType, $user, $format = self:: * @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 @@ public static function getItemSharedWithUser($itemType, $itemSource, $user, $own $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 @@ public static function getItemSharedWithUser($itemType, $itemSource, $user, $own 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 @@ public static function unshare($itemType, $itemSource, $shareType, $shareWith, $ $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 @@ protected static function unshareItem(array $item, $newParent = null) { } // 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 @@ protected static function unshareItem(array $item, $newParent = null) { '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 @@ public static function getBackend($itemType) { 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 @@ public static function isResharingAllowed() { * @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 @@ private static function getCollectionItemTypes($itemType) { 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 @@ public static function getSharedItemsOwners($user, $type, $includeCollections = // 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 @@ public static function getSharedItemsOwners($user, $type, $includeCollections = } } - $owners = array(); + $owners = []; if ($includeOwner) { $owners[] = $user; } @@ -599,7 +599,7 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha $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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha } $where .= 'INNER JOIN `*PREFIX*storages` ON `numeric_id` = `*PREFIX*filecache`.`storage` '; $fileDependent = true; - $queryArgs = array(); + $queryArgs = []; } else { $fileDependent = false; $root = ''; @@ -625,7 +625,7 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha 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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha $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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha \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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha 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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha } 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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha 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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha return $childItem; } else { // Unset the items array and break out of both loops - $items = array(); + $items = []; $items[] = $childItem; break 2; } @@ -985,7 +985,7 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha // 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 @@ public static function getItems($itemType, $item = null, $shareType = null, $sha return self::formatResult($collectionItems, $column, $backend, $format, $parameters); } - return array(); + return []; } /** @@ -1011,7 +1011,7 @@ protected static function groupItems($items, $itemType) { $fileSharing = $itemType === 'file' || $itemType === 'folder'; - $result = array(); + $result = []; foreach ($items as $item) { $grouped = false; @@ -1058,7 +1058,7 @@ protected static function groupItems($items, $itemType) { 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 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid } $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 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid 'token' => null, 'run' => &$run, 'error' => &$error - ); + ]; $preHookData['itemTarget'] = $itemTarget; $preHookData['shareWith'] = $shareWith; @@ -1144,7 +1144,7 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid } } - $queriesToExecute[] = array( + $queriesToExecute[] = [ 'itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $itemTarget, @@ -1158,7 +1158,7 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid 'token' => null, 'parent' => $parent, 'expiration' => null, - ); + ]; } @@ -1169,7 +1169,7 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid $id = self::insertShare($shareQuery); } - $postHookData = array( + $postHookData = [ 'itemType' => $itemType, 'itemSource' => $itemSource, 'parent' => $parent, @@ -1180,7 +1180,7 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid 'id' => $parent, 'token' => null, 'expirationDate' => null, - ); + ]; $postHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith; $postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget; @@ -1208,7 +1208,7 @@ private static function put($itemType, $itemSource, $shareType, $shareWith, $uid 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 @@ private static function formatResult($items, $column, $backend, $format = self:: 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 @@ private static function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, ar */ 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 e7f077f4022af..3c39b58245e91 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -839,7 +839,7 @@ private function isAccessibleResult($data) { $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 9023e14fd2c49..4e1f6567e6b47 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -858,7 +858,7 @@ protected function sendMailNotification(IL10N $l, '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 @@ public function updateShare(\OCP\Share\IShare $share) { } 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 @@ public function updateShare(\OCP\Share\IShare $share) { '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 b3b40e78b9fb6..0c9d7bdd84a81 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -135,7 +135,7 @@ public function getSubAdminsGroups(IUser $user): array { */ 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 a12076196c819..900bd13e84940 100644 --- a/lib/private/TagManager.php +++ b/lib/private/TagManager.php @@ -77,7 +77,7 @@ public function __construct(TagMapper $mapper, \OCP\IUserSession $userSession) { * 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 fb58c33dd0792..500a0a353d6b7 100644 --- a/lib/private/Tagging/TagMapper.php +++ b/lib/private/Tagging/TagMapper.php @@ -52,12 +52,12 @@ public function __construct(IDBConnection $db) { */ 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 @@ public function tagExists($tag) { $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 fe24391a1a5a6..13618ff518cf4 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 @@ public function getTag($id) { */ 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 @@ function($tag) use($user) { * or false if an error occurred */ public function getTagsForObjects(array $objIds) { - $entries = array(); + $entries = []; try { $conn = \OC::$server->getDatabaseConnection(); @@ -226,13 +226,13 @@ public function getTagsForObjects(array $objIds) { '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 @@ public function getIdsForTag($tag) { ); } - $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 @@ public function rename($from, $to) { */ 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 @@ protected function save() { 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 @@ protected function save() { } } } - 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 @@ public static function post_deleteUser($arguments) { 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 @@ public static function post_deleteUser($arguments) { . '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 @@ public static function post_deleteUser($arguments) { 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 @@ public function getFavorites() { 'level' => ILogger::ERROR, 'app' => 'core', ]); - return array(); + return []; } } @@ -685,11 +685,11 @@ public function tagAs($objid, $tag) { } 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 @@ public function unTag($objid, $tag) { $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 @@ public function unTag($objid, $tag) { */ public function delete($names) { if(!is_array($names)) { - $names = array($names); + $names = [$names]; } $names = array_map('trim', $names); @@ -774,7 +774,7 @@ public function delete($names) { $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 @@ protected function array_searchi($needle, $haystack, $mem='getName') { } 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 @@ private function getTagById($id) { * @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 dab4e9d9086a7..cbad438cd2c1a 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 @@ public function append( $key, $value ) { $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 94eac48b61fe8..ab063dbbdca27 100644 --- a/lib/private/Template/CSSResourceLocator.php +++ b/lib/private/Template/CSSResourceLocator.php @@ -145,7 +145,7 @@ public function append($root, $file, $webRoot = null, $throw = true, $scss = fal } } - $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 83fc717c9c5e4..e96505b6d4095 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -216,7 +216,7 @@ public function getCachedJS($appName, $fileName) { $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 ec11e8456d195..781cb0d779458 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -298,7 +298,7 @@ public function getConfig() { } // 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 22595df7964c8..7761e115353a2 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 @@ protected function append($root, $file, $webRoot = null, $throw = true) { ]); } } - $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 8cecc17dbc16c..691f90b788e5b 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -172,7 +172,7 @@ public function __construct( $renderAs, $appId = '' ) { // 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 @@ public function __construct( $renderAs, $appId = '' ) { $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 @@ static public function findStylesheetFiles($styles, $compileScss = true) { $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 @@ static public function findJavascriptFiles($scripts) { $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 4f50f779a8332..1a12132cf012c 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -77,7 +77,7 @@ public function __construct(IConfig $config, * * 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 @@ public function linkToRoute(string $route, array $parameters = array()): string * * 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 @@ public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []) * * 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 611da73254e6d..91a0943e048a3 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -124,22 +124,22 @@ public function upgrade() { $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 @@ protected function checkAppUpgrade($version) { $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 @@ private function includePreUpdate($appId) { */ 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 @@ private function checkAppsRequirements() { 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 a4dbcf77484b3..a616183dced49 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 @@ public function deleteUser( $uid ) { * @return string[] an array of all uids */ public function getUsers($search = '', $limit = null, $offset = null) { - return array(); + return []; } /** @@ -147,7 +147,7 @@ public function getDisplayName($uid) { * @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 7fc774630bdac..2dd12cf916dc2 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 @@ public function registerBackend($backend) { * @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 @@ public function removeBackend($backend) { * remove all user backends */ public function clearBackends() { - $this->cachedUsers = array(); - $this->backends = array(); + $this->cachedUsers = []; + $this->backends = []; } /** @@ -241,7 +241,7 @@ public function checkPasswordNoLogging($loginName, $password) { * @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 @@ public function search($pattern, $limit = null, $offset = null) { * @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 602f779c90120..3d97ddce7f9cc 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -440,7 +440,7 @@ public function logClientIn($user, $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 @@ protected function isTwoFactorEnforced($username) { 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 @@ private function loginWithToken($token) { // 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 @@ public function tryTokenLogin(IRequest $request) { */ 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 c68b8b88e31f4..d3ad6dd5799c7 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -202,7 +202,7 @@ public function updateLastLoginTimestamp() { 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 @@ public function delete() { $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 @@ public function setPassword($password, $recoveryPassword = null) { '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 @@ public function setPassword($password, $recoveryPassword = null) { '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 @@ public function triggerChange($feature, $value = null, $oldValue = null) { '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 4402840703418..660ca885dd70d 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 @@ private static function toXML($array, $writer) { * @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 @@ public static function mapStatusCodes($sc) { * @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 961e51fe736d7..996b7a885c63b 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 @@ public static function findAppInDirectories(string $appId) { 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 9371e733d28eb..1cef0d50e04d6 100644 --- a/lib/private/legacy/db.php +++ b/lib/private/legacy/db.php @@ -121,7 +121,7 @@ static public function executeAudited( $stmt, array $parameters = []) { . ' 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 4512784d95571..cdcf3ad951e5b 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 @@ public function __construct($statement, $isManipulation) { * 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 adc793ba9b715..ebce033850075 100644 --- a/lib/private/legacy/files.php +++ b/lib/private/legacy/files.php @@ -123,7 +123,7 @@ public static function get($dir, $files, $params = null) { 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 @@ public static function get($dir, $files, $params = null) { /* 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 @@ public static function get($dir, $files, $params = null) { } 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 @@ private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { $minOffset = 0; $ind = 0; - $rangeArray = array(); + $rangeArray = []; foreach ($rArray as $value) { $ranges = explode('-', $value); @@ -258,7 +258,7 @@ private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { 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 @@ private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { } 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 @@ private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { 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 @@ private static function getSingleFile($view, $dir, $name, $params) { 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 @@ private static function getSingleFile($view, $dir, $name, $params) { 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 3ddb9d07b1462..02002d40f1cc8 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -100,7 +100,7 @@ public static function computerFileSize($str) { return (float)$str; } - $bytes_array = array( + $bytes_array = [ 'b' => 1, 'k' => 1024, 'kb' => 1024, @@ -112,7 +112,7 @@ public static function computerFileSize($str) { 't' => 1024 * 1024 * 1024 * 1024, 'pb' => 1024 * 1024 * 1024 * 1024 * 1024, 'p' => 1024 * 1024 * 1024 * 1024 * 1024, - ); + ]; $bytes = (float)$str; @@ -245,7 +245,7 @@ public static function canExecute($name, $path = false) { */ 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 @@ public static function streamCopy($source, $target) { break; } } - return array($count, $result); + return [$count, $result]; } /** @@ -342,7 +342,7 @@ public static function buildNotExistingFileNameForView($path, $filename, \OC\Fil */ 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 6353d1f15db6d..2918dd4282f8e 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 @@ static public function connect($signalClass, $signalName, $slotClass, $slotName // 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 @@ static public function connect($signalClass, $signalName, $slotClass, $slotName } } // 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 @@ static public function emit($signalClass, $signalName, $params = []) { // 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 @@ static public function emit($signalClass, $signalName, $params = []) { 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 e0f2dad35998a..4e16b0d8ed714 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -132,7 +132,7 @@ public function height() { */ 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 @@ public function widthTopLeft() { */ 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 @@ public function save($filePath = null, $mimeType = null) { } 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 @@ private function _output($filePath = null, $mimeType = null) { } $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 @@ public function data() { 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 @@ public function getOrientation() { } 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 @@ public function getOrientation() { 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 @@ public function readExif($data) { */ 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 @@ public function fixOrientation() { $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 @@ public function loadFromFile($imagePath = false) { 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 @@ public function loadFromFile($imagePath = false) { 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 @@ public function loadFromFile($imagePath = false) { 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 @@ public function loadFromFile($imagePath = false) { // 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 @@ public function loadFromData($str) { } 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 @@ public function loadFromBase64($str) { $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 @@ public function loadFromBase64($str) { */ 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 @@ private function imagecreatefrombmp($fileName) { // 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 @@ private function imagecreatefrombmp($fileName) { $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 @@ private function imagecreatefrombmp($fileName) { // 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 @@ private function imagecreatefrombmp($fileName) { 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 @@ private function imagecreatefrombmp($fileName) { 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 @@ private function imagecreatefrombmp($fileName) { 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 @@ private function imagecreatefrombmp($fileName) { 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 @@ private function imagecreatefrombmp($fileName) { */ 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 @@ public function resize($maxSize) { */ 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 @@ public function preciseResize(int $width, int $height): bool { $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 @@ public function preciseResize(int $width, int $height): bool { */ 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 @@ public function centerCrop($size = 0) { } $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 @@ public function centerCrop($size = 0) { 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 @@ public function centerCrop($size = 0) { */ 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 @@ public function crop(int $x, int $y, int $w, int $h): bool { 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 @@ public function crop(int $x, int $y, int $w, int $h): bool { */ 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 @@ public function fitIn($maxWidth, $maxHeight) { */ 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 @@ public function __destruct() { * @return bool TRUE on success or FALSE 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 29d0029a3a0a5..f83fca0a4337f 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 @@ public static function checkLoggedIn() { || $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 @@ public static function callCheck() { 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 @@ public static function callCheck() { 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 @@ public static function checkAdminUser() { * @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 @@ public static function error($data = array()) { * @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 @@ protected static function to_string(&$value) { */ 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 ed1e56279615f..279ceb8de0f95 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 @@ protected function findTemplate($theme, $app, $name) { $locator = new \OC\Template\TemplateFileLocator( $dirs ); $template = $locator->find($name); $path = $locator->getPath(); - return array($path, $template); + return [$path, $template]; } /** @@ -165,11 +165,11 @@ protected function findTemplate($theme, $app, $name) { * 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 @@ public function inc( $file, $additionalParams = null ) { * @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 @@ public static function printUserPage( $application, $name, $parameters = array() * @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 @@ public static function printAdminPage( $application, $name, $parameters = array( * @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 @@ public static function printErrorPage( $error_msg, $hint = '', $statusCode = 500 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 d931e4d129f04..9184da21bdb57 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 6a88706352530..736fc2d97023a 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -59,9 +59,9 @@ */ 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 @@ public static function useBackend($backend = 'database') { * remove all used backends */ public static function clearBackends() { - self::$_usedBackends = array(); + self::$_usedBackends = []; \OC::$server->getUserManager()->clearBackends(); } @@ -165,7 +165,7 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe $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 @@ public static function getHome($uid) { * @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 63edf34e02998..044c3fee7bc24 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -69,9 +69,9 @@ 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 @@ private static function initLocalStorageRootFS() { //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 @@ private static function initObjectStoreRootFS($config) { \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 @@ private static function initObjectStoreMultibucketRootFS($config) { \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 @@ public static function setupFS($user = '') { } // 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 @@ public static function setupFS($user = '') { $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 @@ public static function setupFS($user = '') { 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 @@ public static function setupFS($user = '') { //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 @@ private static function addExternalResource($application, $prepend, $path, $type * @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 @@ public static function addHeader($tag, $attributes, $text = null, $prepend = fal */ 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 @@ public static function checkServer(\OC\SystemConfig $config) { $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 @@ public static function checkServer(\OC\SystemConfig $config) { || !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 @@ public static function checkServer(\OC\SystemConfig $config) { } 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 @@ public static function checkServer(\OC\SystemConfig $config) { // 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 @@ public static function checkServer(\OC\SystemConfig $config) { '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 @@ public static function checkServer(\OC\SystemConfig $config) { } 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 @@ public static function checkServer(\OC\SystemConfig $config) { */ 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 mbstring.func_overload to 0 in your php.ini') - ); + ]; } if(function_exists('xml_parser_create') && @@ -935,24 +935,24 @@ public static function checkServer(\OC\SystemConfig $config) { $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 @@ public static function checkServer(\OC\SystemConfig $config) { */ 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 @@ public static function checkDatabaseVersion() { 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) { diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index 6642c332d52d3..f9d53bf1129cd 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -77,7 +77,7 @@ public function __construct($appName, $this->request = $request; // default responders - $this->responders = array( + $this->responders = [ 'json' => function ($data) { if ($data instanceof DataResponse) { $response = new JSONResponse( @@ -95,7 +95,7 @@ public function __construct($appName, } return new JSONResponse($data); } - ); + ]; } diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php index 287c991b587c1..7340df55fc40a 100644 --- a/lib/public/AppFramework/Db/Entity.php +++ b/lib/public/AppFramework/Db/Entity.php @@ -38,8 +38,8 @@ abstract class Entity { public $id; - private $_updatedFields = array(); - private $_fieldTypes = array('id' => 'integer'); + private $_updatedFields = []; + private $_fieldTypes = ['id' => 'integer']; /** @@ -95,7 +95,7 @@ public function getFieldTypes() { * @since 7.0.0 */ public function resetUpdatedFields(){ - $this->_updatedFields = array(); + $this->_updatedFields = []; } /** diff --git a/lib/public/AppFramework/Http/DataResponse.php b/lib/public/AppFramework/Http/DataResponse.php index d6068f9c51530..29c042def7cde 100644 --- a/lib/public/AppFramework/Http/DataResponse.php +++ b/lib/public/AppFramework/Http/DataResponse.php @@ -51,8 +51,8 @@ class DataResponse extends Response { * @param array $headers additional key value based headers * @since 8.0.0 */ - public function __construct($data=array(), $statusCode=Http::STATUS_OK, - array $headers=array()) { + public function __construct($data=[], $statusCode=Http::STATUS_OK, + array $headers=[]) { parent::__construct(); $this->data = $data; diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php index abe0190488736..e84042dbe19b3 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -53,7 +53,7 @@ class JSONResponse extends Response { * @param int $statusCode the Http status code, defaults to 200 * @since 6.0.0 */ - public function __construct($data=array(), $statusCode=Http::STATUS_OK) { + public function __construct($data=[], $statusCode=Http::STATUS_OK) { parent::__construct(); $this->data = $data; diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 15318f30bbde3..2fc985aabfbf6 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -49,16 +49,16 @@ class Response { * Headers - defaults to ['Cache-Control' => 'no-cache, no-store, must-revalidate'] * @var array */ - private $headers = array( + private $headers = [ 'Cache-Control' => 'no-cache, no-store, must-revalidate' - ); + ]; /** * Cookies that will be need to be constructed as header * @var array */ - private $cookies = array(); + private $cookies = []; /** @@ -138,7 +138,7 @@ public function cacheFor(int $cacheSeconds) { * @since 8.0.0 */ public function addCookie($name, $value, \DateTime $expireDate = null) { - $this->cookies[$name] = array('value' => $value, 'expireDate' => $expireDate); + $this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate]; return $this; } diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index d6d1fc1d72a4b..801c0a2347c56 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -48,7 +48,7 @@ class PublicTemplateResponse extends TemplateResponse { * @param array $params * @since 14.0.0 */ - public function __construct(string $appName, string $templateName, array $params = array()) { + public function __construct(string $appName, string $templateName, array $params = []) { parent::__construct($appName, $templateName, $params, 'public'); \OC_Util::addScript('core', 'public/publicpage'); } diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index 8ceeed5b8aa67..fb02c9d265cb8 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -75,7 +75,7 @@ class TemplateResponse extends Response { * @param string $renderAs how the page should be rendered, defaults to user * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0 */ - public function __construct($appName, $templateName, array $params=array(), + public function __construct($appName, $templateName, array $params=[], $renderAs='user') { parent::__construct(); diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php index 9dd19c4cbf413..7fcd59f571594 100644 --- a/lib/public/Contacts/IManager.php +++ b/lib/public/Contacts/IManager.php @@ -98,7 +98,7 @@ interface IManager { * @return array an array of contacts which are arrays of key-value-pairs * @since 6.0.0 */ - public function search($pattern, $searchProperties = array(), $options = array()); + public function search($pattern, $searchProperties = [], $options = []); /** * This function can be used to delete the contact identified by the given id diff --git a/lib/public/DB/QueryBuilder/ICompositeExpression.php b/lib/public/DB/QueryBuilder/ICompositeExpression.php index 2b3cb9388ce55..4752616d41d51 100644 --- a/lib/public/DB/QueryBuilder/ICompositeExpression.php +++ b/lib/public/DB/QueryBuilder/ICompositeExpression.php @@ -36,7 +36,7 @@ interface ICompositeExpression { * @return ICompositeExpression * @since 8.2.0 */ - public function addMultiple(array $parts = array()); + public function addMultiple(array $parts = []); /** * Adds an expression to composite expression. diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php index 6cef23bfb9223..3cee49e3aaadc 100644 --- a/lib/public/DB/QueryBuilder/IQueryBuilder.php +++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php @@ -206,7 +206,7 @@ public function setParameter($key, $value, $type = null); * @return $this This QueryBuilder instance. * @since 8.2.0 */ - public function setParameters(array $params, array $types = array()); + public function setParameters(array $params, array $types = []); /** * Gets all defined query parameters for the query being constructed indexed by parameter index or name. diff --git a/lib/public/Files/LockNotAcquiredException.php b/lib/public/Files/LockNotAcquiredException.php index d1e20fd530af7..23a6b554ce632 100644 --- a/lib/public/Files/LockNotAcquiredException.php +++ b/lib/public/Files/LockNotAcquiredException.php @@ -48,7 +48,7 @@ class LockNotAcquiredException extends \Exception { * @since 7.0.0 */ public function __construct($path, $lockType, $code = 0, \Exception $previous = null) { - $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path)); + $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', [$lockType, $path]); parent::__construct($message, $code, $previous); } diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php index 5be4935906d55..30010bb4cefa5 100644 --- a/lib/public/IDBConnection.php +++ b/lib/public/IDBConnection.php @@ -81,7 +81,7 @@ public function prepare($sql, $limit=null, $offset=null); * @return \Doctrine\DBAL\Driver\Statement The executed statement. * @since 8.0.0 */ - public function executeQuery($query, array $params = array(), $types = array()); + public function executeQuery($query, array $params = [], $types = []); /** * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters @@ -95,7 +95,7 @@ public function executeQuery($query, array $params = array(), $types = array()); * @return integer The number of affected rows. * @since 8.0.0 */ - public function executeUpdate($query, array $params = array(), array $types = array()); + public function executeUpdate($query, array $params = [], array $types = []); /** * Used to get the id of the just inserted element diff --git a/lib/public/ISearch.php b/lib/public/ISearch.php index 7d1940983e1c5..d92beab0b4cf6 100644 --- a/lib/public/ISearch.php +++ b/lib/public/ISearch.php @@ -42,7 +42,7 @@ interface ISearch { * @return array An array of OCP\Search\Result's * @since 8.0.0 */ - public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30); + public function searchPaged($query, array $inApps = [], $page = 1, $size = 30); /** * Register a new search provider to search with @@ -50,7 +50,7 @@ public function searchPaged($query, array $inApps = array(), $page = 1, $size = * @param array $options optional * @since 7.0.0 */ - public function registerProvider($class, array $options = array()); + public function registerProvider($class, array $options = []); /** * Remove one existing search provider diff --git a/lib/public/ITagManager.php b/lib/public/ITagManager.php index 98c3f831a7451..f45ac25965257 100644 --- a/lib/public/ITagManager.php +++ b/lib/public/ITagManager.php @@ -60,5 +60,5 @@ interface ITagManager { * @return \OCP\ITags * @since 6.0.0 - parameter $includeShared and $userId were added in 8.0.0 */ - public function load($type, $defaultTags = array(), $includeShared = false, $userId = null); + public function load($type, $defaultTags = [], $includeShared = false, $userId = null); } diff --git a/lib/public/IURLGenerator.php b/lib/public/IURLGenerator.php index ac680654b50ac..52fde15d0371c 100644 --- a/lib/public/IURLGenerator.php +++ b/lib/public/IURLGenerator.php @@ -42,7 +42,7 @@ interface IURLGenerator { * @return string the url * @since 6.0.0 */ - public function linkToRoute(string $routeName, array $arguments = array()): string; + public function linkToRoute(string $routeName, array $arguments = []): string; /** * Returns the absolute URL for a route @@ -51,7 +51,7 @@ public function linkToRoute(string $routeName, array $arguments = array()): stri * @return string the absolute url * @since 8.0.0 */ - public function linkToRouteAbsolute(string $routeName, array $arguments = array()): string; + public function linkToRouteAbsolute(string $routeName, array $arguments = []): string; /** * @param string $routeName @@ -70,7 +70,7 @@ public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []) * @return string the url * @since 6.0.0 */ - public function linkTo(string $appName, string $file, array $args = array()): string; + public function linkTo(string $appName, string $file, array $args = []): string; /** * Returns the link to an image, like linkTo but only with prepending img/ diff --git a/lib/public/Route/IRouter.php b/lib/public/Route/IRouter.php index 4414988c91015..f2c43cf8c7ec0 100644 --- a/lib/public/Route/IRouter.php +++ b/lib/public/Route/IRouter.php @@ -91,7 +91,7 @@ public function getCurrentCollection(); * @since 7.0.0 * @deprecated 9.0.0 */ - public function create($name, $pattern, array $defaults = array(), array $requirements = array()); + public function create($name, $pattern, array $defaults = [], array $requirements = []); /** * Find the route matching $url. @@ -122,6 +122,6 @@ public function getGenerator(); * @since 7.0.0 * @deprecated 9.0.0 */ - public function generate($name, $parameters = array(), $absolute = false); + public function generate($name, $parameters = [], $absolute = false); } diff --git a/lib/public/Search/Provider.php b/lib/public/Search/Provider.php index c756daa449a95..3bf8d59eccbf4 100644 --- a/lib/public/Search/Provider.php +++ b/lib/public/Search/Provider.php @@ -49,7 +49,7 @@ abstract class Provider { * @param array $options as key => value * @since 7.0.0 - default value for $options was added in 8.0.0 */ - public function __construct($options = array()) { + public function __construct($options = []) { $this->options = $options; } @@ -76,7 +76,7 @@ public function getOption($key) { * @return bool * @since 8.0.0 */ - public function providesResultsFor(array $apps = array()) { + public function providesResultsFor(array $apps = []) { $forApps = $this->getOption(self::OPTION_APPS); return empty($apps) || empty($forApps) || array_intersect($forApps, $apps); } diff --git a/lib/public/Template.php b/lib/public/Template.php index 85ab0ac23bccc..a19c9fae9918f 100644 --- a/lib/public/Template.php +++ b/lib/public/Template.php @@ -124,7 +124,7 @@ public static function relative_modified_date($timestamp, $dateOnly = false) { * @since 8.0.0 * @suppress PhanDeprecatedFunction */ - public static function html_select_options($options, $selected, $params=array()) { + public static function html_select_options($options, $selected, $params=[]) { return \html_select_options($options, $selected, $params); } } diff --git a/lib/public/Util.php b/lib/public/Util.php index 74a4b18f5d4c8..d28eda7201405 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -215,7 +215,7 @@ public static function addHeader($tag, $attributes, $text=null) { * @return string the url * @since 4.0.0 - parameter $args was added in 4.5.0 */ - public static function linkToAbsolute( $app, $file, $args = array() ) { + public static function linkToAbsolute( $app, $file, $args = [] ) { $urlGenerator = \OC::$server->getURLGenerator(); return $urlGenerator->getAbsoluteURL( $urlGenerator->linkTo($app, $file, $args) @@ -348,7 +348,7 @@ static public function connectHook($signalClass, $signalName, $slotClass, $slotN * TODO: write example * @since 4.0.0 */ - static public function emitHook($signalclass, $signalname, $params = array()) { + static public function emitHook($signalclass, $signalname, $params = []) { return \OC_Hook::emit($signalclass, $signalname, $params); } diff --git a/public.php b/public.php index a63e1c78f2ab6..41753dc8a1d4a 100644 --- a/public.php +++ b/public.php @@ -66,8 +66,8 @@ // Load all required applications \OC::$REQUESTEDAPP = $app; - OC_App::loadApps(array('authentication')); - OC_App::loadApps(array('filesystem', 'logging')); + OC_App::loadApps(['authentication']); + OC_App::loadApps(['filesystem', 'logging']); if (!\OC::$server->getAppManager()->isInstalled($app)) { http_response_code(404); diff --git a/remote.php b/remote.php index 1a0b2966f1356..7d20b4fbdf45f 100644 --- a/remote.php +++ b/remote.php @@ -146,8 +146,8 @@ function resolveService($service) { // Load all required applications \OC::$REQUESTEDAPP = $app; - OC_App::loadApps(array('authentication')); - OC_App::loadApps(array('filesystem', 'logging')); + OC_App::loadApps(['authentication']); + OC_App::loadApps(['filesystem', 'logging']); switch ($app) { case 'core': diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index cd90918144d0b..211f08b929fb2 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -83,7 +83,7 @@ protected function setUp(): void { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = array()) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->defaults = $this->createMock(Defaults::class); diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index fdbca1ea3b17d..750547473b1ee 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -110,7 +110,7 @@ protected function setUp(): void { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = array()) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->defaults = $this->getMockBuilder('\OCP\Defaults') @@ -256,7 +256,7 @@ public function testResetFormValidToken() { $this->urlGenerator ->expects($this->once()) ->method('linkToRouteAbsolute') - ->with('core.lost.setPassword', array('userId' => 'ValidTokenUser', 'token' => 'TheOnlyAndOnlyOneTokenToResetThePassword')) + ->with('core.lost.setPassword', ['userId' => 'ValidTokenUser', 'token' => 'TheOnlyAndOnlyOneTokenToResetThePassword']) ->willReturn('https://example.tld/index.php/lostpassword/'); $this->initialStateService->expects($this->at(0)) @@ -280,10 +280,10 @@ public function testEmailUnsuccessful() { $this->userManager ->expects($this->any()) ->method('userExists') - ->willReturnMap(array( - array(true, $existingUser), - array(false, $nonExistingUser) - )); + ->willReturnMap([ + [true, $existingUser], + [false, $nonExistingUser] + ]); $this->logger->expects($this->exactly(0)) ->method('logException'); @@ -338,7 +338,7 @@ public function testEmailSuccessful() { $this->urlGenerator ->expects($this->once()) ->method('linkToRouteAbsolute') - ->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!')) + ->with('core.lost.resetform', ['userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!']) ->willReturn('https://example.tld/index.php/lostpassword/'); $message = $this->getMockBuilder('\OC\Mail\Message') ->disableOriginalConstructor()->getMock(); @@ -416,7 +416,7 @@ public function testEmailWithMailSuccessful() { $this->urlGenerator ->expects($this->once()) ->method('linkToRouteAbsolute') - ->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!')) + ->with('core.lost.resetform', ['userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!']) ->willReturn('https://example.tld/index.php/lostpassword/'); $message = $this->getMockBuilder('\OC\Mail\Message') ->disableOriginalConstructor()->getMock(); @@ -489,7 +489,7 @@ public function testEmailCantSendException() { $this->urlGenerator ->expects($this->once()) ->method('linkToRouteAbsolute') - ->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!')) + ->with('core.lost.resetform', ['userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!']) ->willReturn('https://example.tld/index.php/lostpassword/'); $message = $this->createMock(Message::class); $message @@ -568,7 +568,7 @@ public function testSetPasswordUnsuccessful() { )->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword'); $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', true); - $expectedResponse = array('status' => 'error', 'msg' => ''); + $expectedResponse = ['status' => 'error', 'msg' => '']; $this->assertSame($expectedResponse, $response); } @@ -598,7 +598,7 @@ public function testSetPasswordSuccessful() { )->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword'); $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', true); - $expectedResponse = array('user' => 'ValidTokenUser', 'status' => 'success'); + $expectedResponse = ['user' => 'ValidTokenUser', 'status' => 'success']; $this->assertSame($expectedResponse, $response); } @@ -802,7 +802,7 @@ public function testSetPasswordDontProceedMasterKey() { )->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword'); $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', false); - $expectedResponse = array('user' => 'ValidTokenUser', 'status' => 'success'); + $expectedResponse = ['user' => 'ValidTokenUser', 'status' => 'success']; $this->assertSame($expectedResponse, $response); } diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php index f0fbce86b8c49..af776274e5ccc 100644 --- a/tests/Core/Controller/OCSControllerTest.php +++ b/tests/Core/Controller/OCSControllerTest.php @@ -92,14 +92,14 @@ public function testGetCapabilities() { list($major, $minor, $micro) = \OCP\Util::getVersion(); $result = []; - $result['version'] = array( + $result['version'] = [ 'major' => $major, 'minor' => $minor, 'micro' => $micro, 'string' => \OC_Util::getVersionString(), 'edition' => '', 'extendedSupport' => false - ); + ]; $capabilities = [ 'foo' => 'bar', @@ -124,14 +124,14 @@ public function testGetCapabilitiesPublic() { list($major, $minor, $micro) = \OCP\Util::getVersion(); $result = []; - $result['version'] = array( + $result['version'] = [ 'major' => $major, 'minor' => $minor, 'micro' => $micro, 'string' => \OC_Util::getVersionString(), 'edition' => '', 'extendedSupport' => false - ); + ]; $capabilities = [ 'foo' => 'bar', diff --git a/tests/acceptance/features/bootstrap/FileListContext.php b/tests/acceptance/features/bootstrap/FileListContext.php index cdf2e6acc6e0e..745f522d874ba 100644 --- a/tests/acceptance/features/bootstrap/FileListContext.php +++ b/tests/acceptance/features/bootstrap/FileListContext.php @@ -44,7 +44,7 @@ class FileListContext implements Context, ActorAwareInterface { * @BeforeScenario */ public function initializeFileListAncestors() { - $this->fileListAncestorsByActor = array(); + $this->fileListAncestorsByActor = []; $this->fileListAncestor = null; } diff --git a/tests/acceptance/features/core/ActorContext.php b/tests/acceptance/features/core/ActorContext.php index 81587e40682a4..9ef34cae29fcc 100644 --- a/tests/acceptance/features/core/ActorContext.php +++ b/tests/acceptance/features/core/ActorContext.php @@ -132,8 +132,8 @@ public function getSession($name = null) { * are used in an "I act as XXX" step. */ public function initializeActors() { - $this->actors = array(); - $this->sharedNotebook = array(); + $this->actors = []; + $this->sharedNotebook = []; $this->actors["default"] = new Actor("default", $this->getSession(), $this->getMinkParameter("base_url"), $this->sharedNotebook); $this->actors["default"]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier); diff --git a/tests/acceptance/features/core/Locator.php b/tests/acceptance/features/core/Locator.php index e670a5b8065a5..e3577f296f4c6 100644 --- a/tests/acceptance/features/core/Locator.php +++ b/tests/acceptance/features/core/Locator.php @@ -134,7 +134,7 @@ public function xpath($xpathExpression) { * @return LocatorBuilderSecondStep */ public function id($value) { - return $this->customSelector("named_exact", array("id", $value)); + return $this->customSelector("named_exact", ["id", $value]); } /** @@ -142,7 +142,7 @@ public function id($value) { * @return LocatorBuilderSecondStep */ public function idOrName($value) { - return $this->customSelector("named_exact", array("id_or_name", $value)); + return $this->customSelector("named_exact", ["id_or_name", $value]); } /** @@ -150,7 +150,7 @@ public function idOrName($value) { * @return LocatorBuilderSecondStep */ public function link($value) { - return $this->customSelector("named_exact", array("link", $value)); + return $this->customSelector("named_exact", ["link", $value]); } /** @@ -158,7 +158,7 @@ public function link($value) { * @return LocatorBuilderSecondStep */ public function button($value) { - return $this->customSelector("named_exact", array("button", $value)); + return $this->customSelector("named_exact", ["button", $value]); } /** @@ -166,7 +166,7 @@ public function button($value) { * @return LocatorBuilderSecondStep */ public function linkOrButton($value) { - return $this->customSelector("named_exact", array("link_or_button", $value)); + return $this->customSelector("named_exact", ["link_or_button", $value]); } /** @@ -174,7 +174,7 @@ public function linkOrButton($value) { * @return LocatorBuilderSecondStep */ public function field($value) { - return $this->customSelector("named_exact", array("field", $value)); + return $this->customSelector("named_exact", ["field", $value]); } /** @@ -182,7 +182,7 @@ public function field($value) { * @return LocatorBuilderSecondStep */ public function selectField($value) { - return $this->customSelector("named_exact", array("select", $value)); + return $this->customSelector("named_exact", ["select", $value]); } /** @@ -190,7 +190,7 @@ public function selectField($value) { * @return LocatorBuilderSecondStep */ public function checkbox($value) { - return $this->customSelector("named_exact", array("checkbox", $value)); + return $this->customSelector("named_exact", ["checkbox", $value]); } /** @@ -198,7 +198,7 @@ public function checkbox($value) { * @return LocatorBuilderSecondStep */ public function radioButton($value) { - return $this->customSelector("named_exact", array("radio", $value)); + return $this->customSelector("named_exact", ["radio", $value]); } /** @@ -206,7 +206,7 @@ public function radioButton($value) { * @return LocatorBuilderSecondStep */ public function fileInput($value) { - return $this->customSelector("named_exact", array("file", $value)); + return $this->customSelector("named_exact", ["file", $value]); } /** @@ -214,7 +214,7 @@ public function fileInput($value) { * @return LocatorBuilderSecondStep */ public function optionGroup($value) { - return $this->customSelector("named_exact", array("optgroup", $value)); + return $this->customSelector("named_exact", ["optgroup", $value]); } /** @@ -222,7 +222,7 @@ public function optionGroup($value) { * @return LocatorBuilderSecondStep */ public function option($value) { - return $this->customSelector("named_exact", array("option", $value)); + return $this->customSelector("named_exact", ["option", $value]); } /** @@ -230,7 +230,7 @@ public function option($value) { * @return LocatorBuilderSecondStep */ public function fieldSet($value) { - return $this->customSelector("named_exact", array("fieldset", $value)); + return $this->customSelector("named_exact", ["fieldset", $value]); } /** @@ -238,7 +238,7 @@ public function fieldSet($value) { * @return LocatorBuilderSecondStep */ public function table($value) { - return $this->customSelector("named_exact", array("table", $value)); + return $this->customSelector("named_exact", ["table", $value]); } } diff --git a/tests/acceptance/features/core/NextcloudTestServerContext.php b/tests/acceptance/features/core/NextcloudTestServerContext.php index ff1296ba18aab..8540a71a4f44d 100644 --- a/tests/acceptance/features/core/NextcloudTestServerContext.php +++ b/tests/acceptance/features/core/NextcloudTestServerContext.php @@ -78,7 +78,7 @@ public function __construct($nextcloudTestServerHelper = "NextcloudTestServerLoc $nextcloudTestServerHelperClass = new ReflectionClass($nextcloudTestServerHelper); if ($nextcloudTestServerHelperParameters === null) { - $nextcloudTestServerHelperParameters = array(); + $nextcloudTestServerHelperParameters = []; } $this->nextcloudTestServerHelper = $nextcloudTestServerHelperClass->newInstanceArgs($nextcloudTestServerHelperParameters); diff --git a/tests/apps.php b/tests/apps.php index 63895cbd56942..1ed2a6bdde6bd 100644 --- a/tests/apps.php +++ b/tests/apps.php @@ -28,7 +28,7 @@ function loadDirectory($path) { } function getSubclasses($parentClassName) { - $classes = array(); + $classes = []; foreach (get_declared_classes() as $className) { if (is_subclass_of($className, $parentClassName)) $classes[] = $className; diff --git a/tests/docker/mysqlmb4.config.php b/tests/docker/mysqlmb4.config.php index 4e78272fab4f3..528673950a4cc 100644 --- a/tests/docker/mysqlmb4.config.php +++ b/tests/docker/mysqlmb4.config.php @@ -1,5 +1,5 @@ true, -); +]; diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index 97af541085b16..9e30977e29bfb 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -44,14 +44,14 @@ public function testDeleteUserValue() { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', - array('userDelete', 'appDelete', 'keyDelete', 'valueDelete') + ['userDelete', 'appDelete', 'keyDelete', 'valueDelete'] ); $config->deleteUserValue('userDelete', 'appDelete', 'keyDelete'); $result = $this->connection->executeQuery( 'SELECT COUNT(*) AS `count` FROM `*PREFIX*preferences` WHERE `userid` = ?', - array('userDelete') + ['userDelete'] )->fetch(); $actualCount = $result['count']; @@ -64,28 +64,28 @@ public function testSetUserValue() { $config->setUserValue('userSet', 'appSet', 'keySet', 'valueSet'); - $result = $this->connection->executeQuery($selectAllSQL, array('userSet'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userSet', 'appid' => 'appSet', 'configkey' => 'keySet', 'configvalue' => 'valueSet' - ), $result[0]); + ], $result[0]); // test if the method overwrites existing database entries $config->setUserValue('userSet', 'appSet', 'keySet', 'valueSet2'); - $result = $this->connection->executeQuery($selectAllSQL, array('userSet'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userSet', 'appid' => 'appSet', 'configkey' => 'keySet', 'configvalue' => 'valueSet2' - ), $result[0]); + ], $result[0]); // cleanup - it therefore relies on the successful execution of the previous test $config->deleteUserValue('userSet', 'appSet', 'keySet'); @@ -98,28 +98,28 @@ public function testSetUserValueWithPreCondition() { $config->setUserValue('userPreCond', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond' - ), $result[0]); + ], $result[0]); // test if the method overwrites existing database entries with valid precond $config->setUserValue('userPreCond', 'appPreCond', 'keyPreCond', 'valuePreCond2', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond2' - ), $result[0]); + ], $result[0]); // cleanup $config->deleteUserValue('userPreCond', 'appPreCond', 'keyPreCond'); @@ -155,28 +155,28 @@ public function testSetUserValueWithPreConditionFailure() { $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond1'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond1', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond' - ), $result[0]); + ], $result[0]); // test if the method overwrites existing database entries with valid precond $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond2', 'valuePreCond3'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond1'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond1', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond' - ), $result[0]); + ], $result[0]); // cleanup $config->deleteUserValue('userPreCond1', 'appPreCond', 'keyPreCond'); @@ -197,7 +197,7 @@ public function testSetUserValueUnchanged() { ->method('executeQuery') ->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` '. 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'), - $this->equalTo(array('userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged'))) + $this->equalTo(['userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged'])) ->willReturn($resultMock); $connectionMock->expects($this->never()) ->method('executeUpdate'); @@ -218,19 +218,19 @@ public function testGetUserValue() { $result = $this->connection->executeQuery( 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?', - array('userGet') + ['userGet'] )->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userGet', 'appid' => 'appGet', 'configkey' => 'keyGet', 'configvalue' => 'valueGet' - ), $result[0]); + ], $result[0]); // drop data from database - but the config option should be cached in the config object - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?', array('userGet')); + $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userGet']); // testing the caching mechanism $value = $config->getUserValue('userGet', 'appGet', 'keyGet'); @@ -239,7 +239,7 @@ public function testGetUserValue() { $result = $this->connection->executeQuery( 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?', - array('userGet') + ['userGet'] )->fetchAll(); $this->assertEquals(0, count($result)); @@ -249,15 +249,15 @@ public function testGetUserKeys() { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch', 'appFetch1', 'keyFetch1', 'value1'), - array('userFetch', 'appFetch1', 'keyFetch2', 'value2'), - array('userFetch', 'appFetch2', 'keyFetch3', 'value3'), - array('userFetch', 'appFetch1', 'keyFetch4', 'value4'), - array('userFetch', 'appFetch4', 'keyFetch1', 'value5'), - array('userFetch', 'appFetch5', 'keyFetch1', 'value6'), - array('userFetch2', 'appFetch', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch', 'appFetch1', 'keyFetch1', 'value1'], + ['userFetch', 'appFetch1', 'keyFetch2', 'value2'], + ['userFetch', 'appFetch2', 'keyFetch3', 'value3'], + ['userFetch', 'appFetch1', 'keyFetch4', 'value4'], + ['userFetch', 'appFetch4', 'keyFetch1', 'value5'], + ['userFetch', 'appFetch5', 'keyFetch1', 'value6'], + ['userFetch2', 'appFetch', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -267,10 +267,10 @@ public function testGetUserKeys() { } $value = $config->getUserKeys('userFetch', 'appFetch1'); - $this->assertEquals(array('keyFetch1', 'keyFetch2', 'keyFetch4'), $value); + $this->assertEquals(['keyFetch1', 'keyFetch2', 'keyFetch4'], $value); $value = $config->getUserKeys('userFetch2', 'appFetch'); - $this->assertEquals(array('keyFetch1'), $value); + $this->assertEquals(['keyFetch1'], $value); // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); @@ -288,15 +288,15 @@ public function testGetUserValueForUsers() { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch1', 'appFetch2', 'keyFetch1', 'value1'), - array('userFetch2', 'appFetch2', 'keyFetch1', 'value2'), - array('userFetch3', 'appFetch2', 'keyFetch1', 3), - array('userFetch4', 'appFetch2', 'keyFetch1', 'value4'), - array('userFetch5', 'appFetch2', 'keyFetch1', 'value5'), - array('userFetch6', 'appFetch2', 'keyFetch1', 'value6'), - array('userFetch7', 'appFetch2', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch1', 'appFetch2', 'keyFetch1', 'value1'], + ['userFetch2', 'appFetch2', 'keyFetch1', 'value2'], + ['userFetch3', 'appFetch2', 'keyFetch1', 3], + ['userFetch4', 'appFetch2', 'keyFetch1', 'value4'], + ['userFetch5', 'appFetch2', 'keyFetch1', 'value5'], + ['userFetch6', 'appFetch2', 'keyFetch1', 'value6'], + ['userFetch7', 'appFetch2', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -306,20 +306,20 @@ public function testGetUserValueForUsers() { } $value = $config->getUserValueForUsers('appFetch2', 'keyFetch1', - array('userFetch1', 'userFetch2', 'userFetch3', 'userFetch5')); - $this->assertEquals(array( + ['userFetch1', 'userFetch2', 'userFetch3', 'userFetch5']); + $this->assertEquals([ 'userFetch1' => 'value1', 'userFetch2' => 'value2', 'userFetch3' => 3, 'userFetch5' => 'value5' - ), $value); + ], $value); $value = $config->getUserValueForUsers('appFetch2', 'keyFetch1', - array('userFetch1', 'userFetch4', 'userFetch9')); - $this->assertEquals(array( + ['userFetch1', 'userFetch4', 'userFetch9']); + $this->assertEquals([ 'userFetch1' => 'value1', 'userFetch4' => 'value4' - ), $value, 'userFetch9 is an non-existent user and should not be shown.'); + ], $value, 'userFetch9 is an non-existent user and should not be shown.'); // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); @@ -329,15 +329,15 @@ public function testDeleteAllUserValues() { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch3', 'appFetch1', 'keyFetch1', 'value1'), - array('userFetch3', 'appFetch1', 'keyFetch2', 'value2'), - array('userFetch3', 'appFetch2', 'keyFetch3', 'value3'), - array('userFetch3', 'appFetch1', 'keyFetch4', 'value4'), - array('userFetch3', 'appFetch4', 'keyFetch1', 'value5'), - array('userFetch3', 'appFetch5', 'keyFetch1', 'value6'), - array('userFetch4', 'appFetch2', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch3', 'appFetch1', 'keyFetch1', 'value1'], + ['userFetch3', 'appFetch1', 'keyFetch2', 'value2'], + ['userFetch3', 'appFetch2', 'keyFetch3', 'value3'], + ['userFetch3', 'appFetch1', 'keyFetch4', 'value4'], + ['userFetch3', 'appFetch4', 'keyFetch1', 'value5'], + ['userFetch3', 'appFetch5', 'keyFetch1', 'value6'], + ['userFetch4', 'appFetch2', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -363,15 +363,15 @@ public function testDeleteAppFromAllUsers() { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch5', 'appFetch1', 'keyFetch1', 'value1'), - array('userFetch5', 'appFetch1', 'keyFetch2', 'value2'), - array('userFetch5', 'appFetch2', 'keyFetch3', 'value3'), - array('userFetch5', 'appFetch1', 'keyFetch4', 'value4'), - array('userFetch5', 'appFetch4', 'keyFetch1', 'value5'), - array('userFetch5', 'appFetch5', 'keyFetch1', 'value6'), - array('userFetch6', 'appFetch2', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch5', 'appFetch1', 'keyFetch1', 'value1'], + ['userFetch5', 'appFetch1', 'keyFetch2', 'value2'], + ['userFetch5', 'appFetch2', 'keyFetch3', 'value3'], + ['userFetch5', 'appFetch1', 'keyFetch4', 'value4'], + ['userFetch5', 'appFetch4', 'keyFetch1', 'value5'], + ['userFetch5', 'appFetch5', 'keyFetch1', 'value6'], + ['userFetch6', 'appFetch2', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -415,14 +415,14 @@ public function testGetUsersForUserValue() { $config = $this->getConfig($systemConfig); // preparation - add something to the database - $data = array( - array('user1', 'appFetch9', 'keyFetch9', 'value9'), - array('user2', 'appFetch9', 'keyFetch9', 'value9'), - array('user3', 'appFetch9', 'keyFetch9', 'value8'), - array('user4', 'appFetch9', 'keyFetch8', 'value9'), - array('user5', 'appFetch8', 'keyFetch9', 'value9'), - array('user6', 'appFetch9', 'keyFetch9', 'value9'), - ); + $data = [ + ['user1', 'appFetch9', 'keyFetch9', 'value9'], + ['user2', 'appFetch9', 'keyFetch9', 'value9'], + ['user3', 'appFetch9', 'keyFetch9', 'value8'], + ['user4', 'appFetch9', 'keyFetch8', 'value9'], + ['user5', 'appFetch8', 'keyFetch9', 'value9'], + ['user6', 'appFetch9', 'keyFetch9', 'value9'], + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -432,7 +432,7 @@ public function testGetUsersForUserValue() { } $value = $config->getUsersForUserValue('appFetch9', 'keyFetch9', 'value9'); - $this->assertEquals(array('user1', 'user2', 'user6'), $value); + $this->assertEquals(['user1', 'user2', 'user6'], $value); // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 50c1e13b3f938..68e4a5beaf196 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -35,7 +35,7 @@ class AppManagerTest extends TestCase { * @return AppConfig|MockObject */ protected function getAppConfig() { - $appConfig = array(); + $appConfig = []; $config = $this->createMock(AppConfig::class); $config->expects($this->any()) @@ -47,7 +47,7 @@ protected function getAppConfig() { ->method('setValue') ->willReturnCallback(function ($app, $key, $value) use (&$appConfig) { if (!isset($appConfig[$app])) { - $appConfig[$app] = array(); + $appConfig[$app] = []; } $appConfig[$app][$key] = $value; }); @@ -57,7 +57,7 @@ protected function getAppConfig() { if ($app) { return $appConfig[$app]; } else { - $values = array(); + $values = []; foreach ($appConfig as $appid => $appData) { if (isset($appData[$key])) { $values[$appid] = $appData[$key]; @@ -346,7 +346,7 @@ public function testIsEnabledForUserEnabledForGroup() { $this->groupManager->expects($this->once()) ->method('getUserGroupIds') ->with($user) - ->willReturn(array('foo', 'bar')); + ->willReturn(['foo', 'bar']); $this->appConfig->setValue('test', 'enabled', '["foo"]'); $this->assertTrue($this->manager->isEnabledForUser('test', $user)); @@ -357,7 +357,7 @@ public function testIsEnabledForUserDisabledForGroup() { $this->groupManager->expects($this->once()) ->method('getUserGroupIds') ->with($user) - ->willReturn(array('bar')); + ->willReturn(['bar']); $this->appConfig->setValue('test', 'enabled', '["foo"]'); $this->assertFalse($this->manager->isEnabledForUser('test', $user)); @@ -377,7 +377,7 @@ public function testIsEnabledForUserLoggedIn() { $this->groupManager->expects($this->once()) ->method('getUserGroupIds') ->with($user) - ->willReturn(array('foo', 'bar')); + ->willReturn(['foo', 'bar']); $this->appConfig->setValue('test', 'enabled', '["foo"]'); $this->assertTrue($this->manager->isEnabledForUser('test')); @@ -410,7 +410,7 @@ public function testGetAppsForUser() { $this->groupManager->expects($this->any()) ->method('getUserGroupIds') ->with($user) - ->willReturn(array('foo', 'bar')); + ->willReturn(['foo', 'bar']); $this->appConfig->setValue('test1', 'enabled', 'yes'); $this->appConfig->setValue('test2', 'enabled', 'no'); diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 30d1fec6c9e9c..f18c24f2f610a 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -57,16 +57,16 @@ class AppFetcherTest extends TestCase { static $responseJson = <<<'EOD' [{"id":"direct_menu","categories":["customization"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/juliushaertl/direct_menu/issues","website":"","created":"2016-10-01T09:16:06.030994Z","lastModified":"2016-10-06T14:01:05.584192Z","releases":[{"version":"0.9.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/juliushaertl/direct_menu/releases/download/v0.9.2/direct_menu.tar.gz","created":"2016-10-06T14:01:05.578297Z","licenses":["agpl"],"lastModified":"2016-10-06T14:01:05.643813Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"ERBS9G5bZ3vwCizz2Ht5DehsVJmb63bzF3aYcH7xjbDVMPagOFWdUAiLDwTeZR1n\ni4gdZ73J/IjHQQJoOPwtCjgbZgLPFqL5x13CLUO9mb/33dZe/+gqEDc/3AuJ4TlA\nXUdLxHRb1bwIlJOwuSr/E24452VG20WUhLXBoM0Zm7WcMxvJWo2zAWnuqnLX3dy9\ncPB4PX+6JU2lUMINj8OYQmM1QnqvjG8YV0cYHbBbnSicOGwXEnni7mojsC8T0cn7\nYEJ2O2iO9hh3fvFEXUzDcL7tDQ5bZqm63Oa991bsAJxFo/RbzeJRh//DcOrd8Ufn\nu2SqRhwybS8j4YvfjAL9RPdRfPLwf6X2gx/Y6QFrKHH0QMI/9J/ZFyoUQcqKbsHV\n85O+yuWoqVmza71tkp4n9PuMdprCinaVvHbHbNGUf2SIh9BWuEQuVvvnvB+ZW8XY\n+Cl+unzk3WgOgT0iY3uEmsQcrLIo4DSKhcNgD1NS13fR/JTSavvmOqBarUMFZfVC\nbkR1DTBCyDjdpNBidpa3/26675dz5IT5Zedp4BBBREQzX08cIhJx5mgqDdX3CU09\nuWtzoaLi71/1BWTFAN+Y9VyfZ8/Z3Pg3vKedRJ565mztIj0geL3riEsC5YnPS0+C\n+a3B9sDiiOa101EORzX3lrPqL7reEPdCxrIwN+hKFBQ=","translations":{}}],"screenshots":[{"url":"https://bitgrid.net/~jus/direct_menu_nc.png"}],"translations":{"en":{"name":"Direct Menu","summary":"Provide easy access to all apps in the header.","description":"Provide easy access to all apps in the header."}},"isFeatured":false,"authors":[{"name":"Julius Härtl","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEBjCCAu4CAhADMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE0MTI1MDU0WhcNMjYxMjIxMTI1MDU0WjAWMRQwEgYD\r\nVQQDDAtkaXJlY3RfbWVudTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB\r\nAMkzWsAkKP/40ktvJMpnr0IJNVoPOR0hvh24igcDskL1WKiD2eiRUenj5LE0Nvn+\r\nsiGmWsAqRVpdiz+Y8ghQqQMzKi43IrRN0AxlCrHWrSqBZT3wIAUcFz4RzEoFxc1N\r\nUZzWma6ljukGnvt4V1ZyT+H/cjqxUkBhh/y9SS0jUen1a1grND6Rw54X46V2dlCu\r\nFH+pLsfPJJGw+QLeTGHn7dqdv18cYMAlWDCzPixVnNiCXHZcUtKMmstU2xU4R2e6\r\nzimp2rgkE4TNHrafpjH8xGdNi2FG5Dmokob/L5Q2r8jyNaW7UsFfrvLTRj371b3/\r\n2FhhxoGUvDzaG2An02Exwm52LJfdTVMHAMPZub5poHfy5vAEdZGPQ/m02l8ZK/Y2\r\n7yT807GlfPMXfdfjCxR6wNtmv7rvBDdrUZmIRNJfpFSdvlH/+MOTWnabyfQv2K4Q\r\nBIwltX6Elh0lh4ntvt1ZVtvFv+PL1Dc7QLV+w19+/LJA0mnsh7GIFYKFlbA65gA0\r\nc/w+uqDy0+5MxkR9WGPpd79KRA1tKWTis4Ny1lApK5y3zIsVGa3DfBHXcwqkWHbV\r\nwIpyuyyDsFtC1b9LTFONX7iU9cbNk5C5GTM331MdA2kLcD/D5k42GNTBSca7MkPx\r\nFx/ETSn0Ct167el30symf2AxvXjw+mBYPN71rVTMDwe9AgMBAAEwDQYJKoZIhvcN\r\nAQELBQADggEBAC0fJKnbEhXA8M283jA9GxABxLyTBcQyVVNnz2L/bYYNi81Y9iZv\r\n+U0S3qaIfoqNcV9FTKAutbsKvWyolnI7MRRK6feNuFfoP2jKubM1CnawpyT/RF2Q\r\ne/zxnB1EmeI2X5D2xceJDLB7Fy5W0EGrLixRIdFaSUommWFUm9E2hSIaNlziSBdc\r\n1J/mOQeNYO5zg5ouEt1rzQW4Mhh1I2uNQmGe4ip+Jl/2LAv3FZuu4NrSEcoXH3ro\r\nG2dF9Gtu4GiQ5fuaJknaxlgXHovfqeZwZJX9o4M+Ug81AqiY7XjdiaCPdh0Tthcx\r\n2OmWZo7UBREWenjKyFZZ/iKoqH5sdenBtpo=\r\n-----END CERTIFICATE-----"},{"id":"apporder","categories":["customization"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/juliushaertl/apporder/issues","website":"","created":"2016-10-01T09:16:47.111889Z","lastModified":"2016-10-12T19:50:16.038821Z","releases":[{"version":"0.3.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/juliushaertl/apporder/releases/download/0.3.3/apporder.tar.gz","created":"2016-10-12T19:14:10.802359Z","licenses":["agpl"],"lastModified":"2016-10-12T19:50:16.104357Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"nhlT9lhrmBxIsqh/e3RLm2NDw/U8ZvvoMyYQTLMM3H19DQmVcPYPYC9QWVTsowUzXblVaOXVGylbpKma9yOlOAqJtF3qyXecLl4+tA/Awb6BBhKPgHFdcLDAL5yy1K7/uei3SgEojMlJoI9vEK5I1C5YTh43yNH+//Im6MAuNYFUTlMXK426zdOe6ogpCI5GlYdXopqYANxcpT+WXWET6DDSM5Ev+MYwMcSAY4r8+tvARRU4ZAenRgjkBT6R5z6cD76emRax14tbV6vkjjwRcO+dQtM0tFPbd+5fsNInbauv50VzIMgjA6RnKTOI17gRsSdGlsV4vZn2aIxEPWauu6T/UohMvAE9HMn13vtbpPBSFwJAktj6yHASYGzupNQLprA0+OdyALoLZPpQAKNEXA42a4EVISBKu0EmduHJlUPeqhnIGkkGgVNWS8AWqzP2nFoPdXBgUWateiMcBTHxgEKDac5YmNc9lsXpzf1OxBaXHBhGYKuXPwIfyH3jTWb1OdwixJEuRe9dl63T9qOTRre8QWns/bMqKLibGfMtFhVB21ARJayBuX70eVvabG/2N7Y5t1zUlFygIKu51tvo3AVCRDdRrFWDvkAjxzIz5FIdALVZ+DReFYu/r4WF/w3V9rInFuEDSwb/OH4r8sQycs07tSlMyA74Y3FpjKTBxso=","translations":{}},{"version":"0.3.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/juliushaertl/apporder/releases/download/0.3.2/apporder.tar.gz","created":"2016-10-06T14:00:51.532409Z","licenses":["agpl"],"lastModified":"2016-10-06T14:00:51.598455Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"gRVFOtj9414ZNSdRH/qNB2SwVZUQh+gaFnNLFjjXjJ1MdRMCISzvwb+QU1qYuK/y\nuL8K0pn1+fFQf8A3VsC2pb6yaLQ5U9C3Guf886Flf4qtYw1P8UWRA9yOJ+6Md+PH\n6pTEiDIdm4xbmM0KkBhsE5kL8dvLIq4EwwcAh2Qq8fjytzAk1YiP+KrTaYrVwskM\nDmm0lgP4NVnjRBTX9myW6tr6N3w0tq2jJ/+a/vEDJv+5ozKJx8N5gbJNdrtI4k7I\nyaQNWJ7cngtAHmUREeoBggV5uJayDceu83PPQR6N9/WVyNyZjw1Q8/Q6e/NyiXT2\no8mGv5tHl3DBOVuv8v7gBQgDh6ppp12M81aiCZymn2XIgjw50VQ+K15KHnLHuFFw\nwuHZVcoQ7b6oR4K4TURSfPFUeNgGS4R9v6gjg1RUcSm1Pnryc6pYnh10AUY8dk6q\n1CZ6Upt6SScP2ZEGWsFwVjjQhY/ZJmNfnhaGoFOZ5L9CnzyNCkGXFg0rL36i6djb\naqFy/z+Brnklng5ct6XWoP7uDt5BaHznQj1NHSfHn0GUQ0N968zWm9vQvy+dyXyC\nxR7vKeu2ppZ2ydoeQ9CVwfhOEsGs5OvrpapQdh9KbUHcX7b7ql01J7/P6dFuNuHe\n+7/y4ex3sEVg5YBmDtF8iZ6d7zsHd6peL1s1EsLnenQ=","translations":{}}],"screenshots":[{"url":"https://bitgrid.net/~jus/apporder-nc.gif"}],"translations":{"en":{"name":"AppOrder","summary":"Sort apps in the menu with drag and drop","description":"\nEnable sorting for icons inside the app menu. The order will be saved for each\nuser individually. Administrators can define a custom default order.\nAppOrder works with the default owncloud menu as well as with the direct_menu\napp.\n\n## Set a default order for all new users\n\nGo to the Admin settings > Additional settings and drag the icons under App order.\n\n## Use first app as default app\n\nYou can easily let Nextcloud redirect your user to the first app in their\npersonal order by changing the following parameter in your config/config.php:\n\n'defaultapp' => 'apporder',\n\nUsers will now get redirected to the first app of the default order or to the\nfirst app of the user order.\n "}},"isFeatured":false,"authors":[{"name":"Julius Härtl","mail":"jus@bitgrid.net","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhAEMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE0MTI1MjQ4WhcNMjYxMjIxMTI1MjQ4WjATMREwDwYD\r\nVQQDDAhhcHBvcmRlcjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKVK\r\nKn5jivCu+eRfe5BECjDOzNaGHlpiegb49Hf4nh0W7DqcoLHip5c1O2BcEYdH6rkw\r\n20WclvjoQpgavG5aFXzXzur6eKTT5TpgY5oZTLoWjbx4e+fKdhyDPTpqNZzs1pxz\r\nsZLDL/ElpbSErE0s+QK/pzP11WNPylAkI9AKSyDMO3Mbllg8I8Bt+bT7LJKYOO/T\r\nLhv9m0anLZ4HrdfimhVIoMiu3RpyRigk8titXZA94+F8Fbf7ZQ9f14Y/v3+rfJFQ\r\nii9cDoox5uUrjplH2LrMr5BodfCfydLu4uVpPWYkdccgvcZ1sugjvNXyCQgdzQDK\r\npOpiwVkkiQFaQJYbGSDblFWPl/cLtA/P/qS7s8tWyTQuc1rYlEpCHG/fG8ZFkSVK\r\n9eCMGxK908VB4IU2DHZHOHi7JvtOz8X/Ak6pIIFdARoW3rfKlrz6DD4T9jEgYq0n\r\nRe7YwCKEIU3liZJ+qG6LCa+rMlp/7sCzAmqBhaaaJyX4nnZCa2Q2cNZpItEAdwVc\r\nqxLYL1FiNFMSeeYhzJJoq5iMC3vp2LScUJJNoXZj9zv+uqTNGHr+bimchR2rHUBo\r\nPzDLFJmat03KdWcMYxcK5mxJNGHpgyqM7gySlbppY/cgAospE8/ygU2FlFWIC9N0\r\neDaY+T8QA1msnzsfMhYuOI8CRYigan1agGOMDgGxAgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBAGsECd+meXHg1rr8Wb6qrkDz/uxkY1J+pa5WxnkVcB6QrF3+HDtLMvYm\r\nTTS02ffLLyATNTOALZFSy4fh4At4SrNzl8dUaapgqk1T8f+y1FhfpZrEBsarrq+2\r\nCSKtBro2jcnxzI3BvHdQcx4RAGo8sUzaqKBmsy+JmAqpCSk8f1zHR94x4Akp7n44\r\n8Ha7u1GcHMPzSeScRMGJX/x06B45cLVGHH5GF2Bu/8JaCSEAsgETCMkc/XFMYrRd\r\nTu+WGOL2Ee5U4k4XFdzeSLODWby08iU+Gx3bXTR6WIvXCYeIVsCPKK/luvfGkiSR\r\nCpW1GUIA1cyulT4uyHf9g6BMdYVOsFQ=\r\n-----END CERTIFICATE-----"},{"id":"twofactor_totp","categories":["tools"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"","website":"","created":"2016-10-08T14:13:54.356716Z","lastModified":"2016-10-12T14:38:56.186269Z","releases":[{"version":"0.4.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0 <7.1.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/ChristophWurst/twofactor_totp/releases/download/0.4.1/twofactor_totp.tar.gz","created":"2016-10-12T14:38:56.174612Z","licenses":["agpl"],"lastModified":"2016-10-12T14:38:56.248223Z","isNightly":false,"rawPhpVersionSpec":">=5.4 <=7.0","rawPlatformVersionSpec":">=10 <=11","signature":"bnwWxmHEn8xkoWbtwhC1kIrJ0dQfAI3PUtU62k+Tru/BHt1G2aVxqO8bCdghojZ7\nzdFMlIJw4kekYFsVfLk8jzjUTZKVbNVKCdkHrVTQ0bUUryMAMLqGQ3PSRI5NX6D5\nFpkvwO1coYwU0XVWF8KAS0meX0ztSkT3Mv96LLrxr8F8SrB/MGmKIE4WTjt1fAIa\nZLAVEUo/3sNFTGLYBtL3wjctrkZvJltP8abeRfls9FkRHu+rN7R3uLFzk42uZn3X\nWpt5BBmlYm5ORbnJ2ApsxEkMNK+rOy8GIePaz5277ozTNrOnO04id1FXnS9mIsKD\n20nRzjekZH+nneQYoCTfnEFg2QXpW+a+zINbqCD5hivEU8utdpDAHFpNjIJdjXcS\n8MiCA/yvtwRnfqJ5Fy9BxJ6Gt05/GPUqT8DS7P1I1N+qxhsvFEdxhrm2yIOhif8o\nh7ro5ls+d3OQ8i3i4vdZm821Ytxdu/DQBHiVoOBarvFWwWAv2zd2VAvpTmk6J5yv\n3y+csRqpEJYd9fcVMPsTu7WBRRrpBsAqdAHJcZEwak2kz1kdOgSf8FIzP1z6Q71d\nMl2RKcPeutMHHSLiGIN/h7fM5aSs49wGgGZmfz28fHVd7/U0HFSMYmkT/GMq5tMP\nIyc+QZAN4qbX8G0k/QSTkK/L4lOT2hQiQqiSqmWItMk=","translations":{}}],"screenshots":[],"translations":{"en":{"name":"Two Factor TOTP Provider","summary":"A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)","description":"A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)"}},"isFeatured":true,"authors":[{"name":"Christoph Wurst","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIECTCCAvECAhASMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYxMDEyMDkzNDMxWhcNMjcwMTE4MDkzNDMxWjAZMRcwFQYD\r\nVQQDDA50d29mYWN0b3JfdG90cDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC\r\nggIBALC1K94104L/nOtmTygx7QNjUcnHs3yrn71mw4pMxTlonXOnMTpwxsfL1Hhu\r\n/5GMSgupTbQPlevSl6J86UMs455/sPShd6ifmAuhb8VFaAsjpizjs0RMaUg1sjmF\r\nuV18PD9FXLourx51V/c4MG5kpavlV+bLUrVMAjbsJY2+k30tCC/XkP5u8jUWmM/T\r\n5REChn7/obPgaeddhuJoILYhKEW3VNrR8Fm9SYiviB3FLhM7URDZ97IBnXYqbvbT\r\nZnvq+E74Zc7HgYwQwrjU/AqQAInhNpAR4ZM6CkWWWWaL96O1q3lCfKJNaxqC0Kg/\r\nkGn/pxYkl9062jtMUz60s9OPDyuisfyl68UyM68Ozyz4SMRLmDVbewOqQAwmAbtz\r\n8p9AQrX3Pr9tXhARR4pDSsQz1z+8ExEd6EKbhMyiTtHtZQ1Vm9qfoR52snpznb5N\r\ne4TcT2qHAkOWV9+a9ESXmQz2bNjgThxEl5edTVY9m4t248lK5aBTGq5ZKGULNHSQ\r\nGGpr/ftMFpII45tSvadexUvzcR/BHt3QwBAlPmA4rWtjmOMuJGDGk+mKw4pUgtT8\r\nKvUMPQpnrbXSjKctxb3V5Ppg0UGntlSG71aVdxY1raLvKSmYeoMxUTnNeS6UYAF6\r\nI3FiuPnrjVFsZa2gwZfG8NmUPVPdv1O/IvLbToXvyieo8MbZAgMBAAEwDQYJKoZI\r\nhvcNAQELBQADggEBAEb6ajdng0bnNRuqL/GbmDC2hyy3exqPoZB/P5u0nZZzDZ18\r\nLFgiWr8DOYvS+9i6kdwWscMwNJsLEUQ2rdrAi+fGr6dlazn3sCCXrskLURKn5qCU\r\nfIFZbr2bGjSg93JGnvNorfsdJkwpFW2Z9gOwMwa9tAzSkR9CsSdOeYrmdtBdodAR\r\ndIu2MkhxAZk9FZfnFkjTaAXcBHafJce7H/IEjHDEoIkFp5KnAQLHsJb4n8JeXmi9\r\nVMgQ6yUWNuzOQMZpMIV7RMOUZHvxiX/ZWUFzXNYX0GYub6p4O2uh3LJE+xXyDf77\r\nRBO7PLY3m4TXCeKesxZlkoGke+lnq7B8tkADdPI=\r\n-----END CERTIFICATE-----"},{"id":"contacts","categories":["office","organization","social"],"userDocs":"https://docs.nextcloud.com/server/11/user_manual/pim/contacts.html","adminDocs":"https://docs.nextcloud.com/server/11/admin_manual/configuration_server/occ_command.html?highlight=occ%20commands#dav-label","developerDocs":"https://github.com/nextcloud/contacts#building-the-app","issueTracker":"https://github.com/nextcloud/contacts/issues","website":"https://github.com/nextcloud/contacts#readme","created":"2016-10-30T14:00:58.922766Z","lastModified":"2016-11-22T22:08:01.904319Z","releases":[{"version":"1.5.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/contacts/releases/download/v1.5.0/contacts.tar.gz","created":"2016-11-22T22:08:01.861942Z","licenses":["agpl"],"lastModified":"2016-11-22T22:08:02.306939Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"ZqqhqtbHcNB+rzGCQ7FDIjjvHjit+dhAE1UhFgiXApkx3tmPP4nJOBAGNjHe+2Ao\nVcTIX2SrWEfieRrA4Gp+0k7pUPWag1Z0T1OVOwO4cmS1AVFyGIOE1bRvDhMfsWTU\n4CI4oXaKBFAY6mtnf7VJ7EeIdNqhImkohyWDQ88NiPRLM1XNkJJk6AvZBcT0fvCv\no145X4dLpbixSXsN99QFNJ/oXvK+9tBGwTd5i/WnNFY90vcNRLia8aRo7SA0YJRx\nLnxnj2HMqwTTDQEKE+1elYKWsqQ2DeqwScP97UIKe5bZXnrwOi9kH9PDmR4abtzd\nlHL8E1Wgw25ePDeHG7APrx0tVOJy1bP+g8vcarpGynWZoizDkBvYZD+xtxizpBXC\nJsDOSzczApptY6dnOtv0Vat8oh/Z/F99gBUahEu4WZ16ZgR1nj40PDK1Snl18Cgk\nMe1EZcde8SLEpTbCWYIfIw/O9Fkp5cWD/dAqoiO6g+gNxSZ/gGp57qoGfFxn7d/x\nH3aH8GljatAFjrwItw1JzR0THt0ukkOK+bw/pfCslk10sjHMitmz/GXa4qMS91DZ\nBKLUd0dSfQUQzkfwcojImbzJRvca4/DYe3mfG7+RCH0tDL6t72dKL9joB++u5R1u\nVZPgkToexlXcKWpiDB8H2/SEShKr4udAOjR5de9CYWM=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/nextcloud/screenshots/master/apps/Contacts/contacts.png"}],"translations":{"en":{"name":"Contacts","summary":"The new and improved app for your Contacts.","description":"The new and improved app for your Contacts."}},"isFeatured":true,"authors":[{"name":"Alexander Weidinger","mail":"","homepage":""},{"name":"Jan-Christoph Borchardt","mail":"","homepage":""},{"name":"Hendrik Leppelsack","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhATMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYxMDEyMjAzNzIyWhcNMjcwMTE4MjAzNzIyWjATMREwDwYD\r\nVQQDDAhjb250YWN0czCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANzx\r\n/zJF+5/s4lOJLWIlfKQgTy+UpvIpiUXCgrsHsDZTx+hjQAhIWukH88a+7NVAL7Ys\r\nkQNC0Tlm755FJi/T6EdR7edOwIRdo2ZwakOWLZXd209+6cCd2UloHL0bgnbWepTl\r\nR/4YgbLg/G+FVKCfkEiYc3PuDZ3EVrcwQFcg7h74X9ne6CHH0Z1WQLydxJuVEb2n\r\nX9I+nIRpPHcVostkSiUmzHR7C5TjTIo2PzzgnCU6GC0iBa6z6dDYfz24QEp/b8UA\r\nZaLhjkyKghVGMnoF/s9KPgH4NM8pvvtadQN8pxlOPju4wbmKPUrsXo4ujurDXbbc\r\nYkzNt8ojobGwdTXoyDogAsGZLQd2FQksWpRvY+I3zVPokBfPMdUPLllG5VcV0VA5\r\nDRK+h2ms+XmspdBvGonjF+XdbFm9hEmDoFmoi9aU6C6AdofjmG/e9+pw/20dXUWk\r\nmMorWwXQ5yLmIn5LnpRXrOuK7CS28VRhBYuVNMlsyKhzU0rophbsD9OFXxYLjr6s\r\n7UPNwZ5h+kjXZDBKD89QctBSViT8RhLe8nulRIm0iJn1sb9hca/CF63KmsFzENfK\r\nQeM6MO0H34PB84iNyz5AX1OIy+1wHD4Wrzt9O/i2LkWK6tBhL69aZiBqdLXWKffj\r\nARDCxxIfews51EZFyHzwsw65I97y46aBKxY382q7AgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBACLypX0spxAVAwQIS9dlC9bh1X/XdW2nAvSju2taUTBzbp074SnW6niI\r\nbnY4ihYs4yOuGvzXxnp/OlvWH7qhOIchJUq/XPcEFMa7P03XjVpcNnD3k0zQWlZb\r\ntGonX9EUOeLZKdqI4fkrCkMLScfjgJzoHGYQrm8vlIg0IVuRLCKd5+x4bS7KagbG\r\niuPit2pjkw3nWz0JRHneRXz/BNoAWBnJiV7JMF2xwBAHN4ghTM8NSJzrGTurmpMI\r\nGld7yCP47xNPaAZEC66odcClvNtJ2Clgp8739jD6uJJCqcKDejeef0VU1PG7AXId\r\n52bVrGMxJwOuL1393vKxGH0PHDzcB1M=\r\n-----END CERTIFICATE-----"},{"id":"mail","categories":["tools"],"userDocs":"","adminDocs":"https://github.com/nextcloud/mail#readme","developerDocs":"","issueTracker":"","website":"","created":"2016-10-19T19:41:41.710285Z","lastModified":"2016-10-19T19:57:33.689238Z","releases":[{"version":"0.6.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0 <7.1.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/mail/releases/download/v0.6.0/mail.tar.gz","created":"2016-10-19T19:57:33.676730Z","licenses":["agpl"],"lastModified":"2016-10-19T19:57:33.834580Z","isNightly":false,"rawPhpVersionSpec":">=5.4 <=7.0","rawPlatformVersionSpec":">=10 <=11","signature":"VbMsvDpt+gSPeFM8LrZXEK10rk8kkLlgCcblgqNdCSeGZeVpwDAYv3CccVSLa0+l\nlTSqQ0VIoH+OIU6vIQNBKHmSCzTplk7OrY0+L5FajXx8LnBaOh892GfGSlEt1neN\nKyM0i0uOjO/xpCP/NoUlgkz6hnmYY5XEdN6DTsJtJ/XZhDQ45IYuIkMkHE/eFehS\n0JnOagIz+PSipeBY2Ry+tV8YbRa7bC1JAvZzlod0dyI015AHZESeitRUY+MwMWkt\nN/me7g7/Kev0wggIQQZm9aYcw63GMk/1VHUPB7Y0ESW9tx2nR5+KwTDn/Jy4DGf1\nrg8h0t5I+aPhHOBLrpczH0qaZWY2lsVZWq8KWjJI9aR9P0v2f2aXixXzD/Cuz1cK\nhvhKWkOSla4D+/FxeyHGjQvdXMG8gXm0ZmTimKChCoVuCbncDd8pzkdyNoGXcvuk\nsP8OrkQFooL4E7S4BWfdSiN/a8jUITJQkuXp/OVrVGeCupLWJh7qegUw6DvoqyGy\nD4c6b+qYn68kx3CLaPPiz+tFAZQZQdj7+Kx/lohso8yTnVSiGYrMj4IvvCbpsQjg\nWF3WSqF/K/tTnPYTWb9NUPSihTbVNv6AXOfTsPEp/ba2YSS5DjvjVjkr5vhR9eg1\nikQ3Cw6lW3vaA4LVCC+hFkMRnI4N0bo5qQavP3PnZPc=","translations":{"en":{"changelog":"### Added\n- Alias support\n [#1523](https://github.com/owncloud/mail/pull/1523) @tahaalibra\n- New incoming messages are prefetched\n [#1631](https://github.com/owncloud/mail/pull/1631) @ChristophWurst\n- Custom app folder support\n [#1627](https://github.com/owncloud/mail/pull/1627) @juliushaertl\n- Improved search\n [#1609](https://github.com/owncloud/mail/pull/1609) @ChristophWurst\n- Scroll to refresh\n [#1595](https://github.com/owncloud/mail/pull/1593) @ChristophWurst\n- Shortcuts to star and mark messages as unread\n [#1590](https://github.com/owncloud/mail/pull/1590) @ChristophWurst\n- Shortcuts to select previous/next messsage\n [#1557](https://github.com/owncloud/mail/pull/1557) @ChristophWurst\n\n## Changed\n- Minimum server is Nextcloud 10/ownCloud 9.1\n [#84](https://github.com/nextcloud/mail/pull/84) @ChristophWurst\n- Use session storage instead of local storage for client-side cache\n [#1612](https://github.com/owncloud/mail/pull/1612) @ChristophWurst\n- When deleting the current message, the next one is selected immediatelly\n [#1585](https://github.com/owncloud/mail/pull/1585) @ChristophWurst\n\n## Fixed\n- Client error while composing a new message\n [#1609](https://github.com/owncloud/mail/pull/1609) @ChristophWurst\n- Delay app start until page has finished loading\n [#1634](https://github.com/owncloud/mail/pull/1634) @ChristophWurst\n- Auto-redirection of HTML mail links\n [#1603](https://github.com/owncloud/mail/pull/1603) @ChristophWurst\n- Update folder counters when reading/deleting messages\n [#1585](https://github.com/owncloud/mail/pull/1585)"}}}],"screenshots":[],"translations":{"en":{"name":"Mail","summary":"Easy to use email client which connects to your mail server via IMAP and SMTP.","description":"Easy to use email client which connects to your mail server via IMAP and SMTP."}},"isFeatured":false,"authors":[{"name":"Christoph Wurst, Thomas Müller, Jan-Christoph Borchardt, Steffen Lindner & many more …","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIID/zCCAucCAhAVMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDE5MTkzMDM0WhcNMjcwMTI1MTkzMDM0WjAPMQ0wCwYD\nVQQDDARtYWlsMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp++RuliQ\nlBeeiPtP0ecBn00OaU1UCpft/NVI5pnSiT9nU4l2kc5IvKjA8UxDB3gWfYTOeBFh\ntUHQ2P6UKCmHZT9sApHhqLu2n0V+YhlFIViuaxndSID/M414cl56xOYQusV3Pcae\no2dOSeRRzLab3tEaVHlkBSFkGmAwPZItsmTklvV3h1sUysDicYgfXPCkf7K+JgWA\nBP7vsWC8B7MDRhcB3enYv5tTcpsyvtGX7bb1oTIWVypcmKsGYfTX12VNBxKzNBIG\n8pwdb8Xo0o14TytWsWN7mSHf1XbwfwYMjDWOlMqiRc+mcoKMBH41TfM/CXslSivI\nsyvxasEaFdlj8lmKPENdzw1OfYRs43usIf4szwyt4rb8ocXfDipnY3P2hccN6YcZ\nl8y8Vsr69ASluDj2A2Pl5vH6xp6tNybZRnN5G6sghhaYaLNDU/TdMyYzz4AY33Ra\nHSaMypfcXjd76Aj8jZvcwk1BH+ZsvFqNK7ZKCb7WVcMH8KRcU1sxZ4rp9vviM2fL\nL7EVtznm3bSI9jjHXbiwq7RvNRRy+F6YRpAdWGwTU8uUkDabPFi41FikYyzNWauK\nJhlDJXl514XjKyMVBjAZYVr5gZZkO1J7C4XzLFbC5UzYNSzW5Iwx/1j5OeYJRxh6\n5rhiUwR+COT1wdVsl6khMC8MfBR4unSd338CAwEAATANBgkqhkiG9w0BAQsFAAOC\nAQEATBvpqz75PUOFPy7Tsj9bJPaKOlvBSklHH7s43fDDmQbJwswXarZi3gNdKf8D\nyO/ACZvO8ANWAWL/WahkOyQtKOYzffaABGcEIP7636jzBdKtgwSGzW3fMwDghG10\nqBr2dE6ruOEdSpuZxgMgh2EulgknZUXaHAMI2HjjtAMOBScLQVjOgUqiOHmICrXy\nZETmzhx0BXDt5enJYs8R2KMYJNIme1easQRYmWKliXogNY09W7ifT9FHtVW1HX+K\nxRS4JXbapjolkxyGSpP+iYSgItVnYzl6o9KZResR4yDsBv7G/8fpV4GQU9IS3zLD\nPiZOosVHWJdpUKCw9V4P1prGTQ==\n-----END CERTIFICATE-----"},{"id":"audioplayer","categories":["multimedia"],"userDocs":"https://github.com/rello/audioplayer/wiki#user-documentation","adminDocs":"https://github.com/rello/audioplayer/wiki#admin-documentation","developerDocs":"","issueTracker":"https://github.com/rello/audioplayer/issues","website":"https://github.com/rello/audioplayer","created":"2016-09-16T05:44:24.857567Z","lastModified":"2016-11-17T22:34:34.637028Z","releases":[{"version":"1.3.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/Rello/audioplayer/releases/download/1.3.1/audioplayer-1.3.1.tar.gz","created":"2016-11-17T22:34:34.215350Z","licenses":["agpl"],"lastModified":"2016-11-17T22:34:34.867778Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=9 <=11","signature":"p6Zz0IEFrxvw6y/3jHgGWWCxR6qpMzvU2HKfxcIVsK6sJnoRUhWLeAXwZ432fH2a S2llj+IGS9OvW+5VQElrXgPtEjDK1BT00DRJnp5RFCRlUv0LNoedJMzx6B6AHqPP JBufk3cG1O/CO0M0L1ITGSmSOzfKvWTRo3lxVGF792NyBaP/SyZCkH1N1TzBQzUi Ywl3+HiglPcXbHjtJm/arnKorbJWVKoaN93xFuaBapd2ozQSpi0fE0uGRsici+U7 HNa1M5WFE1rzUJoufE0E9246At07rFY1e+TdNEq8IlLgCXg5vGCKkEyuWpWno6aX LfRaIiT9x39UTAwNvuDKS0c+n4uWDYPsGfKhDx9N7CXpUrthfXVEWRzZEXG7as10 6ANvrRPJemSZH8FUSrdJhD7k12qa9R825y7mIG68Li8P71V92EOxFfo9tNXqXwBt VuDGxBqByFVPqSCj5I8hrzJzQl2Xt40g8+8ZcSF96RMg/pM+bwRMTv+mz0V+vQQ4 DWjqnWVPalaJ1PPD5/QFFErtXuNRbyxKZ6BMWxfJlLM9Kz66P75K+8fYaSwz+2KG NxY7I3svzS2K9LGH3fBLUy1t3Hl+c3zGFq/ll1MJrf9NswV4yxt2WmISfM/KDww8 yELkGs2cRzbw2tCvnmYlJJhIqRLkyFAbDzWRH/XdVx4=","translations":{"en":{"changelog":"2016-11-17\n- fix: one-click-play for wav not working\n- fix: wrong sql statement for PostgreSQL [#90](https://github.com/rello/audioplayer/issues/90)"}}},{"version":"1.3.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/Rello/audioplayer/releases/download/1.3.0/audioplayer-1.3.0.tar.gz","created":"2016-11-15T18:11:19.539636Z","licenses":["agpl"],"lastModified":"2016-11-15T18:11:19.592881Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=9 <=11","signature":"lbp7wd3JhMHW5mC8kVnQFvcwzf3aTIhYhq3ak/C/vfDXJDIPFuQ1odVRWtaHXEKQ XmKYIoTobV1TAU5q9G0O0Kds73T/XtHG4ATLxMZE8RsUWNSj5v3H4YDub6A0uoX6 rzyLEYV6SGEtdPFMwLcUjDExKpzAzKpgxcd9uyz2NhcHJEO8FJmirn34bm69//TO vjjiMW4zpL+dho+7LQbOX+L1SmwmdBqwypE9zzeuIuhUWDEQtImHAvjIO6Temajm lX0H5JaowJa8kvP6Jkh3KAvsHQ4sJklvWTPGcv0gboN+o6CmjWNOb+3LeSH0nhe6 BmiPloUDJcPQwq2gQejH2pY+qJEdRcULSKS09/dRbE3gOSlG36FThN0INpv6uNP4 qVIiYs3/SEHMmlS5CHvJDt2S2XN9LT9IX7QPeuS/0CMcuopaG/+cdC4KscVCq4D4 bllgew9asiBqix8iV8C4oerYOiC5vWcgBrZhGShoJT1Qq+NKz+H10dFgjFCAZuPj nVagJkbXmf2NdcvpSC7qsufhyEZyCSp+I7QEYsbo1PW3aUU35Syt47lgeVFX0hVQ jC1wMIhEW5Rm2nCkRSZkRupKDQ+N6uWuB0lykeMV2ShcDvvUZrhN3c49sooWgigB yIqKryzM4fLErjjNHdYgwCq6bbgPDLK3ic9b3B4rF3E=","translations":{"en":{"changelog":"2016-11-15\n- fix: handling of temporary scanner files [#68](https://github.com/rello/audioplayer/issues/68)\n- fix: simpler analysis of incorrect files in scanner [#57](https://github.com/rello/audioplayer/issues/57)\n- fix: album sorted correctly by artist and album [#80](https://github.com/rello/audioplayer/issues/80)\n- fix: neutral cover for unknown album [#16](https://github.com/rello/audioplayer/issues/16)\n- fix: error message from ID3 editor shown in front-end [#77](https://github.com/rello/audioplayer/issues/77)\n- enhancement: occ support for library scan and reset [#72](https://github.com/rello/audioplayer/issues/72)\n- enhancement: select a dedicated folder for scanning in personal settings [#79](https://github.com/rello/audioplayer/issues/79)\n- enhancement: exclude folders from scanning via .noaudio file [#79](https://github.com/rello/audioplayer/issues/79)\n- enhancement: significantly reduce database reads during scanning [#79](https://github.com/rello/audioplayer/issues/79)\n- enhancement: cleanup of classes; move from \\OC\\Files\\View to \\OCP\\Files\\IRootFolder [#72](https://github.com/rello/audioplayer/issues/72)"}}},{"version":"1.2.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/Rello/audioplayer/releases/download/1.2.2/audioplayer-1.2.2.tar.gz","created":"2016-10-06T21:21:05.414691Z","licenses":["agpl"],"lastModified":"2016-10-06T21:21:05.483224Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=9 <=11","signature":"toeS45z50Lm0djgrQokOTN7gA8a113IZtiKKiLsGUKWrCV/6AKJBmEFcSun6rhLH\nbz/RtIdFKwQql6O3E0m1Zch2y1A8aLWHzFTO+5orLCVi7y15SshrJYbb9aI5Pj3i\nSR7+kMHGS8uNx2uIn3B4mO6UYF8AzCfp+ule18DOjnpu86KWvEOGtFXsQkLtgepp\nbJhOGWW/uOVIos/T1xPP4GCmtVmgn7U3b9q0pMYRH7ONXEiNsfQxDrR66EZH3Jfo\nlVyM9UvQmMKoDSdBUlvLlhCEGJGqFOD7hFntLYloI4oXv9uGqcagaJVh3TkEysY2\nMbBZpVhch5zRJ/HGlZOvmEzZ8Inxkk3iap+JmJ5/gZTefwfKUyYHALsILlh820U2\nNA/1B5A015XH5a5uflGE/tnlPtrOeecIN4mg+1njo2RG89HJWJNHM2ZDO4SkXjSR\njgygmAS5aR5+KKifiA/pwjhLozDWPU4lNzsj3Foz3bx3Okopy7eq83LORqieT4Jp\nFvP64q/45LOSRBWIWLitYzRzZp7HYywMsnz12WpxtqxIjO7+7y/ByeWWOBNU1IJC\nK2D+035ZGWZr0CxDJte33WOISwjVoSwrcov++O3BQW8lM5IkcDNcJFyzNPKAXcQU\nPUXmQpYurHoIw6odAYcbrG6iOiSesuNOf2kQWbjV3/c=","translations":{"en":{"changelog":"2016-09-18\n- fix: icon issues with alternative apps folder [#65](https://github.com/rello/audioplayer/issues/65)"}}}],"screenshots":[{"url":"https://github.com/rello/screenshots/raw/master/audioplayer_main.png"},{"url":"https://github.com/rello/screenshots/raw/master/audioplayer_lists.png"},{"url":"https://github.com/rello/screenshots/raw/master/audioplayer_share.png"}],"translations":{"en":{"name":"Audio Player","summary":"Audio Player for ownCloud and Nextcloud","description":"Audio Player for MP3, MP4, Ogg, and Wave with a lot of flexibility for all your needs."}},"isFeatured":false,"authors":[{"name":"Marcel Scherello","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEBjCCAu4CAhAIMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE1MjExMjA4WhcNMjYxMjIyMjExMjA4WjAWMRQwEgYD\r\nVQQDDAthdWRpb3BsYXllcjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB\r\nALyC+iLscLs62NeNmUXEBmg+xMuUtDmZKr+xzJWtl6SSNRz+8K1JygvUIXFJ3RIL\r\nCYA3xyq8/wyZH1gNrLKyz5eTeYawG+eT3ges/FT6MWGUbZoRrBrikVcLC94QzxTH\r\nxOl8Dn+SCV/2bhcvPTQdhK+dqtvGilOtjHa40iMrk9gSdlKVys5CK/xdlEp8uiMa\r\nkz1WENn8MVCCJV58bAUbaCupDWXR9CCoSsw8XinNsCenZ2B2XlnmbM44280w0ojs\r\n72rfQRgj3yDG+ZUUyUOuxIuodu8liXYciLf0ph6t/f/qoSmctbBdsR5Fl1Upj1Ac\r\nqeHb5Yf/B3Vi6Mn3XfDx0H2EHk1v9Dhzxay+v9BHUzyIX2iH/q+7TE0/Jzo5AwBW\r\nvFKWXvG7wXaALcHYZf5v/M93IE0iCHsv2EsZKQPBnzXVGmp4DwFSP4po1B7hcog1\r\ngAMaellAzzvUAizgCovN6Qct3qDEANYniPlvtnlcaQGonajW4N019kFQRHLIzPFR\r\njab5iUMMwSnT8FhZO2ZOWuWhJven+gXjxC8mfMVgBfZnAVgydNfx9rN+KzTc88ke\r\nobUdZ0OOeBzA7pIxGEFg9V6KTEEWZ+qH048vxXz4HI9B1I+2wQLBrZl8CvweEZ5U\r\n5ID8XrrE/UaNZ1CvLKtCgB24gj/m1Elkh7wA3gEcEo2JAgMBAAEwDQYJKoZIhvcN\r\nAQELBQADggEBACtgUp+FCmjWIkQUuWSdzKWdO+IH4v9wBIrF9mo0OLIakFyDYyM5\r\nLlkYZXbplGXd4cfn3ruIqJNzlIb4xa5CU0bM4TMbD4oOSlLMKM/EamKPHI3bzr++\r\nzi7mQDFxmAE6FWSMBgKKUb4tqLc5oBap8e12tPEZl/UR6d9iUB2ltvrm3T3vrjjl\r\n2Worm0eYBNqnagXmX5+wS11AQqeJemGqRy5e1yXRlTgB0IJhH0dCsFNwifEigutp\r\nFNvGFVBn4r5qCiChEoq+rCXHRjPi/eCfbW21XeLFDiLxapcZyc85JIcA7znUYoFe\r\nP7Y/ekMscwWhLbF91OaQlcWpRtEMyde/DaI=\r\n-----END CERTIFICATE-----"},{"id":"calendar","categories":["organization"],"userDocs":"https://docs.nextcloud.com/server/10/user_manual/pim/calendar.html","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/nextcloud/calendar/issues","website":"https://github.com/nextcloud/calendar/","created":"2016-10-01T12:40:39.060903Z","lastModified":"2016-11-22T20:31:13.029921Z","releases":[{"version":"1.4.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/calendar/releases/download/v1.4.1/calendar.tar.gz","created":"2016-11-22T20:31:13.020268Z","licenses":["agpl"],"lastModified":"2016-11-22T20:31:13.087340Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"nThwe9CJBCan9nuDLdhfBiQyPhmum6Aa0UcYsIDdhGMw+C2acf81KhEmBJuTTWxo\nWGby6WcrcJJmeuCW+ePU91ju7Pd76RirprhVXIEceIDzSCxin+K0oZCZ1IGVIJjP\nIkVehTsLuCeTBbjvz1b3k5QFyhUhvd32Xt7k5d7VARyI4OqnqYYNBtH9vvgeRrFw\nAxsQr4o4axof6i3iykLg6WfWarYArY4dIuu5DkPuGPWf2bbgjwWEra4sQejhOs7G\nsk1xcsfYv2NpArIbpw/wnATdjiax+Gjz1URMD3NgL5ky0ecuZmNvN25QErg3nlVr\nhh1FBfA5pvCJbkJ6nr5bU4bKaffwDX1nr5h77FS5zzn0Pyd7ZIExmVmNtaeJfnfV\n5vnclapzXMNU+R6t/ATJQd1srvSJhyljQapzsqnrjNMEUojOEvqqygJp0KwNVPqs\n3g9XGSoOnO+WULWBeISW7UVOg8BOF8pwvHIU2++bSzOdpypW0Eq6p2DPWO6qL/H1\neFLKrUg3EvnTjvknbBxMB55h9jNJr0SAlkrmyEVm6+CE3BwRWpKB+cJMBuGiwPwv\nr/ASRiJrkDThbNWAUtX70rUmCqDV6/MujLXViqOc/Q2OHvcXd1oGDccJSQT92/1z\n7nonnedyYQIDqUt7u68WL8JRxp7pFsEqKLVuWSgxW3c=","translations":{}},{"version":"1.4.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/calendar/releases/download/v1.4.0/calendar.tar.gz","created":"2016-10-06T19:58:12.724588Z","licenses":["agpl"],"lastModified":"2016-10-06T19:58:12.790604Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"b//hJbICFMLR0Va1BGMzpLpaPREOo9QhjgfrHvDOfXVpddhvCM8ocz74X1s5hKyy\nGg67EE0pOp0dBf6RyJjduI+Dz1wQX55My7J9G1vXGCN30C/8zAcKSJoA218IWcub\nICavLkz2PkiitIOSZyBCAfEiSAeHPop/JGkq3KxQDC7QwFC78BnE9/adD9tO55c/\nDGLhvP/uTJIeH8RUifikTqVMmPH+aP3uPbZzl+AxhUezRiNCpEtZPA5QGqtQdJU4\nFc6x3d9y4IWbJV4TEIAP8jdfqtLVUQ6szFVnN8Oi1wtN9e8LIylBSYbmIZRj0+qh\nZcgntzEq6U843ZwXcAnL5jNYV0m+KNI+EkXFeWHkjvbwfCdvGPBvgFVbhc0YPzXU\nqHOe4Lvcx9X20ALG/MacV9zX69GzNnWgbBp9RnIHuaSRPFEKrNXUeXl2THuKsTyQ\nF9QtTwS5U5DcMyTO2RAN45NrRxIh8IL4stoIg5rmF7/ZaOm/Jza2gnUquOTarDE/\ntiWnNW5kWUAWyYYHvQgQix/of9qXvc2hhZaw0y623WDNrEwA+rngnjDMLA/vNv3B\nhgwQ6NbCOuHWsRK3S8DcJFpB9Kj/i7CDvDLEuJYnjSTvQ/q1XqawbJPDoRlydX43\n3/L0LvHvKVakYybv2OE5gy6bQ2Dw8e7D27DtZ6XTaBY=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/1.png"},{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/2.png"},{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/3.png"},{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/4.png"}],"translations":{"en":{"name":"Calendar","summary":"Calendar GUI for Nextcloud's CalDAV server","description":"The Nextcloud calendar app is a user interface for Nextcloud's CalDAV server.\n\nIt integrates with other apps, allows you to manage calendars and events, display external calendars and invite attendees to your events"}},"isFeatured":true,"authors":[{"name":"Georg Ehrke","mail":"","homepage":"https://georg.coffee"},{"name":"Raghu Nayyar","mail":"","homepage":"http://raghunayyar.com"},{"name":"Thomas Citharel","mail":"","homepage":"https://tcit.fr"}],"ratingRecent":0.944444444444444,"ratingOverall":0.944444444444444,"ratingNumRecent":9,"ratingNumOverall":9,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhARMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYxMDAzMTMyNjQwWhcNMjcwMTA5MTMyNjQwWjATMREwDwYD\r\nVQQDEwhjYWxlbmRhcjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMm6\r\nFTeqgzCXprkU83VM4/DrZWn3kqtfaR/edkC4gYT3ug7RHa/Uv1C/S++vr7pvgpnk\r\nYzQoavl/0Qlh5sKEYX+0ud/LQDoiidwBRDckFUQ1bRfVLxAD9UAVvDRHxDqJMOx2\r\ngZArbeQ3ztdSHZp4ThzBFWq2FILsJD86weG7LwHjzhW6SWgLb/YTLbuuW6tRCDVV\r\nbtB0I/a0vCwj2u91Chw3u6pWWjPakc9DQrIDH4HCIBKQ4zVrYDxAmJDRFGDvVVWx\r\nuIAeux8sd8drqSMqAhX+XMcZPRD71NQTWbCupSwWO8kgjmZnBpIiBNpzvMQzJf3A\r\nQloZtjZ2RDXAQG88eTeT8pp8yEOCEoDLpGdraKxJrh/z2Dsk30JP3lOiNYJ9vBaB\r\nC8NJbJ3oAlG7THwUaFF9fsdAKoTwzs5Xms04TI7W/v4Z/GClOzMymnR1T4sR72Oy\r\n3WaMNHv/1QGffvQn2/TtZt23Ou3P083xWx2vn5FgTcac8+x85vRgWsVCA4hq9v6m\r\nAlktB0+UWDEXpDTKD9BdFNWM8Ig9jQf7EJrvTLNnS7FIJZMB4GK8lpvPxyvACWnh\r\nR2hQOe987Zvl3B1JZNO5RvtSeYld9Y9UfMgW1aPRweDNjSuZYAKlugx1ZoyI5HyA\r\nQjfzAwicIMwZsCJDV/P5ZO8FE+23rdWaoJczpBqDAgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBAHQXwvj8q5khWR/ilg3JGYpmMNBYHE9OeDaOcNArkKaGMd478SDPOXeu\r\nyW7hCvNEpiTk5g0h3g3yleZFws0xH8fPsQgZANgvQXb3RCcD61NL77d0cMTr7Xzr\r\nN3Lq/ML1YLc/WwL4uV1XvpMQMwALFL1p63BU2c0ysO31zbLOjMKAJi0hHFDYz5ZQ\r\nD3xxtc17ll3B5IqrMnMHRqmOQ39Sbe56Y7T4agaIz/sUWpseo85D5kt7UAIOR+Mr\r\nQ0Bl/QinETk72afGR46Qvc7tC1t9JjQQD3AUbEGuJdGvXjJJ9GREYu01XoODmPdT\r\njXXOI8XIOK6kxXhPHUc3iWu9b4KqGm0=\r\n-----END CERTIFICATE-----"},{"id":"gpxpod","categories":["multimedia","tools"],"userDocs":"https://gitlab.com/eneiluj/gpxpod-oc/wikis/userdoc","adminDocs":"https://gitlab.com/eneiluj/gpxpod-oc/wikis/admindoc","developerDocs":"https://gitlab.com/eneiluj/gpxpod-oc/wikis/devdoc","issueTracker":"https://gitlab.com/eneiluj/gpxpod-oc/issues","website":"https://gitlab.com/eneiluj/gpxpod-oc","created":"2016-10-31T10:57:44.387319Z","lastModified":"2016-11-23T17:27:37.793159Z","releases":[{"version":"1.0.8","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":">=9.4.0","rawVersionSpec":">=9.4"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":">=5.5.0","rawVersionSpec":">=5.5"}],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/963bbf246412bcbe8979bccadb3b8d03/gpxpod-1.0.8.tar.gz","created":"2016-11-23T17:27:37.783365Z","licenses":["agpl"],"lastModified":"2016-11-23T17:27:37.862469Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"hqhMh1l/mnwbYf4uPzEjjLFtZWHidzgR57X471OuXv2K/s87T5WhIkTSKk+2r8sp\nS7CtrF5+Pc5AgCCHvwzawN3e2+4eO4cK0+HD9CCzygzzHZEbSjufNHMMQucVoSD8\nPqR6MV9azzUpwHa/5d8fp3cFLVAle+aG0o4v5eHky9c7eaKxVJcgfjw3pjDE73N6\ngJVdtw1jf1kOFYk5pZQxDfBKFDrO5BRo5ZfZGuOuP2u/SmTwj42oTZiT7oTVWhqd\nLvJw+2TPv7B8s0Gin+J5e9K1Rs6CEWQ6WBxM+NhS5KgWB5Ig3pwm0QvMgza2cvoh\nlwVobOotfKLUBJzg0+wR7B2YH9Ao+m94h93vg7H0OKPReoTKhlDj2UExoTyeurV8\nhJdQv8sKVAxjC7/xrVaGSjM4YxFdBpzq8Zl8z4zq1o2voH5+u4ko3c62C1loDpsC\n8KrL1t6A7QpMk/XAMrPqwEPmFqlLEdv6FhzpOGyt4IEVnv6vdMTShcYw3tPvU/mD\njPtiVwpo8gWbGVIfpmwBg4wPaTrWK8V3+/1iTahIQHZfu4Lebb5mzht80HLQIcd8\n+oB4cGDEX4Rix1WxnCmE5ZzURY8xQXcvqYN+mTrUDh/3OtxQPSm5yC945SGoFNpr\nBYxfEyQcwulZrOMBdY0Ssj1AB5NOeC9OHwjJrnVe7dQ=","translations":{"en":{"changelog":"### Added\n- save/restore options for logged user\n- option to choose picture style (popup/small/big marker)\n [#25](https://gitlab.com/eneiluj/gpxpod-oc/issues/25) @eneiluj\n- add average speed and average moving speed in comparison table\n\n### Changed\n\n### Fixed\n- bug when python PIL is not available\n- deletion of bad parameter given to getGeoPicsFromFolder() in controller\n [#20](https://gitlab.com/eneiluj/gpxpod-oc/issues/20) @eneiluj\n- bug in file cleaning, bad use of array\\_unique\n [#22](https://gitlab.com/eneiluj/gpxpod-oc/issues/22) @eneiluj\n- python script do not need to be exectuable now\n [#23](https://gitlab.com/eneiluj/gpxpod-oc/issues/23) @eneiluj\n- jquery.colorbox was brought by \"First run wizard\" app, now included\n [#21](https://gitlab.com/eneiluj/gpxpod-oc/issues/21) @eneiluj\n- avoid JS error when failed to get options values by ajax"}}},{"version":"1.0.8","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":">=9.4.0","rawVersionSpec":">=9.4"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":">=5.5.0","rawVersionSpec":">=5.5"}],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-nightly.tar.gz","created":"2016-11-16T14:06:33.937534Z","licenses":["agpl"],"lastModified":"2016-11-16T14:06:33.971502Z","isNightly":true,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"JtUhKRDFGYDx9xtHjdfEUFOb0O4idexUYw6ixlBhKPP8Dn7NfyBfV6KH6MJTIVLU\nQ5Jw6tv/Nr1YDOvVikcWPG0p23mQdn1+7w8DzzIGKmknxCat9/vKr83oJZdWYxS7\nTJ4I7qTvWNlbMfK8OEdl13VJXgc6ftX+1isluLYqLjEm3aBFCS+/awYNMmXO55a1\nyG0NgJRu3pw1CBCMhDaRLsunhpRNDVLsamZj1SPmeT8qy0I/arFaG6hQnAo6JosE\ndi1XkvK6TEt9g16L6eizd+JpGE7xiWFP9ZEmMmmQSOLQYwU5Sk1YWcrW3EX4vtz5\nWnEIC0SENyyAyzBO6YJfu/EP2lLnlbNJiuc4zzKLqRw/zyz3j+imJLcXHIA78ZkQ\nuyUOBkkk3xeyBGeUcYfDuBqYQOQs+F/7+cNMsIBKJhx9ef3OPURBc7X16upk3mxV\n6GsOktbHkgUwWk3WiXRriBIqbAZocvDp0+PN++PAEZVWFEZEJzztd4Fxaeo+QSN5\n5Pz/9yXYRsoSPZv82Tlh7dx5tIPUvYb+UsANh5eGWUGufTSwgYBN0H2KT/iO35D7\nkDzNyh1qNakfBhAgPjrC2p4mBKBJJjlM0D9erDwr5D4GSTW2fp92vlRHeD0X8sqo\n3kBbwGuWnmhdJhbd7zYy0jVM6tVX/zgbhycimNALG0I=","translations":{"en":{"changelog":"### Added\n- save/restore options for logged user\n- option to choose picture style (popup/small/big marker)\n [#25](https://gitlab.com/eneiluj/gpxpod-oc/issues/25) @eneiluj\n\n### Changed\n\n### Fixed\n- bug when python PIL is not available\n- deletion of bad parameter given to getGeoPicsFromFolder() in controller\n [#20](https://gitlab.com/eneiluj/gpxpod-oc/issues/20) @eneiluj\n- bug in file cleaning, bad use of array\\_unique\n [#22](https://gitlab.com/eneiluj/gpxpod-oc/issues/22) @eneiluj\n- python script do not need to be exectuable now\n [#23](https://gitlab.com/eneiluj/gpxpod-oc/issues/23) @eneiluj\n- jquery.colorbox was brought by \"First run wizard\" app, now included\n [#21](https://gitlab.com/eneiluj/gpxpod-oc/issues/21) @eneiluj"}}},{"version":"1.0.7","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":">=9.4.0","rawVersionSpec":">=9.4"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":">=5.5.0","rawVersionSpec":">=5.5"}],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-1.0.7.tar.gz","created":"2016-11-14T00:57:37.521001Z","licenses":["agpl"],"lastModified":"2016-11-14T20:35:45.363487Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"SigBof6QJZ9IMZyFgc+B3LO2+EXaAPvnxUHjJQjIl3jLzomocpDGR6WjO6gtvB81\nzXUHjJ8+huc+P9TvgjUGRTmn9a/29HZ4IKTXnYBKIUY7wSLcJNMbJSp2Zd3OFHAG\nJwRaEdh/cIRk2X6NE1VT6dFCxB+LhTM4BXOEwuNYQvU1lZDVQgTz/r68zFLWBt6R\nqhBCNJHrVp87ecS4+XaGq/CfT4k1ihiOv+f4eX9iaPzUhxBJ71iYKF7wHpDoVmIk\nNrzWFUJH3BLBuW9oiC0PApli6Xu5RXrWUsOV7OAmxXgylRCPuTFwe09hw16JMbiS\nii8WFiUtp4qW53+7eoS7Fllm7CRi/Dg6Jvjtp3msrf1m+OiYM7dLyoKw22/S4P/a\nBIErZpSCHaCfrZ+DBXrAYcas27GWE7HizzG3yXk3aDJMa0Otcsq56bSPo01JDfNx\nm1y9iuwmlon8zKKoxsJCwxaFDnQpqazaLcUO0ATHUk8LdomTA7MCXVvNFPaO86Ea\n16iyw7Cfs0k3GrvN71+SdpvWss359CEEwBMpDwJZqwSFbLRyHtogUgbRWLIJqR4n\n5uVvJqirxWkr/EtXw6UkDWAI3ZoMhMRtjn4H4ekANP5mC8R0yp+UuFs2RkEC5uA0\nKzzh73WmxmpeUl6jcMZ49gXn3PTCC2fJNrdmSYch5Dc=","translations":{"en":{"changelog":"### Added\n- option to choose waypoint style\n- show elevation, lat, lng in waypoint popup\n- ability to display geotagged jpg pictures on the map\n- pictures slideshow with colorbox\n- pictures work in public dir link\n- use NC/OC thumbnails to display pictures on the map\n- options block hidden by default\n\n### Fixed\n- fix bug in geojson generation for waypoint-only files"}}},{"version":"1.0.6","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-1.0.6.tar.gz","created":"2016-11-07T12:11:00.619161Z","licenses":["agpl"],"lastModified":"2016-11-07T12:11:00.699921Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"WBts2fm2rW/7LMHYjcx9a0k0WTXV6PnGRxTl+158cjfV7ruMpNvhK58iTjrox69k\nFWAoIi1wNAlLBu9Xet1j7HKi4TC9q61IEN+lPlnwBCu0uHawiqS2gqB4i8A019Ei\noLsgAPWh8ndy6+gyUtPhVLVduLH76aT6KTwAiHPknV0zPtxsUy1P6nbbNOS5A5rG\nSQBqljy0TbcjOctTudEPp1IqjJIwcd12eZ9MLG4CEIO13n53pMAsuXJf4jnKSCm0\ngimvsFOwFRjBab3ZPwtOqeVw6aIh/lYF3U3/k8YBpaDN74m30nDtkp8teXBgshSY\nVYvX3yOAYe0PIR419IX0eoHb61K0VfZYvPT4FsOqjDr0zlVB8Rjq+6SiK4vMD2+6\neGE0aHbjR9HV5jymUnFYdm/hlhcZGaKrAiQKfBY6Vh0SWKfIv7bdGfQYauePAdZt\njlsV8lIwOy7FGAeP81CcjzWWfDeBgYr+MSzfoDNoTi41MvUaT14iWPIU/s5P1/Qv\nALGxgsbmB19wEgNbdh1UtTUY3xARLpWPYdUqU7yDcsddX9vCoCG2G5wCcbYJRj8o\nC+H7wdgPJoiMY/p4Go/lyWkvmzhfXrOeXytZIFXjb3ERVd1vD9WSt1DSy/7gsFYt\nxzzOPgqMvL3BbeluNuzNv366oT872s3OuFKa1ZOYY7A=","translations":{}},{"version":"1.0.5","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-1.0.5.tar.gz","created":"2016-10-31T11:08:41.017766Z","licenses":["agpl"],"lastModified":"2016-10-31T11:08:41.068782Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"UXeZVh5f0/WZE+r/dHWc1pu9q4qr/zACX6XraMhhIuKIp7vNCwUESeqJtVc99QZw\nw9kJp0isvib6l0zbQBRS1vI7xwKKBQyeaEhIciEs1JjsaCiato1Gyi26N+fY2N0Z\nFWlTwCsF3DdlwERXTYfeCpsOWCoxLxHKhnJIjUc0PVme/Ste4zxYj+5Su1RpadSw\n4vGnkW8zy/0tzua50NQCrOg+B4jXzH9kMWAP47w3sdP5CYalHSHl8EX0D1RjgGU5\n7vZYX3wF853FvQDbL4JXXCJupj3wZe8py8McWpQIcgz1p3KmE7A7d/rdNWExT+T+\nDxtStJ56qTRMz4aFwoSFxJrrEfgHIsE9Gv+Vo7nshCUYA8gkfHeckiaUtH1EiFTh\nVNeO6mTIqGpRosFvfUrZMKcuF5j74vGQjNM1o+M5N31gtLoPSkU605f/U4v+j2oC\n3/N1rYF2SEDFO0EgAGXaXVhB0ltSDkHJw6vZJ1L8Qz6tooUMDxaMri8vycA6LHvE\nqN+z+S6TXMfLvN/6ATYPGhicrWmkMT/k7v1az/hcnfH+zRyLZyFx94s88JWF7Jf+\nI+tgDbfqTMAIcytJUC+KfdQW1ueXh5F0owrOYM6jgBRvhqj1T8s+Twgw8orGmRPe\n9h8G9Z3wZAooQvmC0KdVhLuOeIkqt/S5krELNFFBRnk=","translations":{}}],"screenshots":[{"url":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/db5af6ba7ae1cd4d22ea81d418f5c762/screen1.jpg"},{"url":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/123588561a8067185572a8d1887ef906/screen2.jpg"},{"url":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/427688b80bf8428dd45bd15d69b19075/screen3.jpg"}],"translations":{"en":{"name":"GpxPod","summary":"Display, analyse, compare and share gpx tracks","description":"\n# GpxPod owncloud/nextcloud application\n\nIf you want to help to translate this app in your language, take the english=>french files in \"l10n\" directory as examples.\n\nThis app's purpose is to display gpx, kml and tcx files collections,\nview elevation profiles and tracks stats, filter tracks,\n color tracks by speed, slope, elevation and compare divergent parts of similar tracks.\n\nIt's compatible with SQLite, MySQL and PostgreSQL databases.\n\nIt works with gpx/kml/tcx files anywhere in your files, files shared with you, files in folders shared with you.\nkml and tcx files will be displayed only if GpsBabel is found on the server system.\nElevations can be corrected for entire folders or specific track if SRTM.py (gpxelevations) is found.\nPersonal map tile servers can be added.\nIt works with encrypted data folder (server side encryption).\nA public link pointing to a specific track/folder can be shared if the corresponding gpx file/folder is already shared by public link.\n!!! GpxPod now uses the owncloud database to store meta-information. If you want to get rid of the .geojson, .geojson.colored and .markers produced by previous gpxpod versions, there are two buttons at the bottom of the \"Settings\" tab in user interface. !!!\nGeolocated pictures can be displayed if python PIL is installed on the server.\n\nGpxPod proudly uses Leaflet with lots of plugins to display the map.\n\nThis app is tested under Owncloud/Nextcloud 9.0/10 with Firefox and Chromium.\nThis app is under development.\n\nLink to Owncloud application website : https://apps.owncloud.com/content/show.php/GpxPod?content=174248\n\n## Install\n\nNo special installation instruction except :\n!! Server needs python2.x or 3.x \"gpxpy\" and \"geojson\" module to work !!\nThey may be installed with pip.\n\nFor example, on Debian-like systems :\n\n```\nsudo apt-get install python-pip\nsudo pip install gpxpy geojson\n```\nor on Redhat-like systems :\n```\nsudo yum install python-pip\nsudo pip install gpxpy geojson\n```\n\nThen put gpxpod directory in the Owncloud/Nextcloud apps to install.\nThere are several ways to do that.\n\n### Clone the git repository\n\n```\ncd /path/to/owncloud/apps\ngit clone https://gitlab.com/eneiluj/gpxpod-oc.git gpxpod\n```\n\n### Download from apps.owncloud.org\n\nExtract gpxpod archive you just downloaded from apps.owncloud.org :\n```\ncd /path/to/owncloud/apps\ntar xvf 174733-gpxpod-1.0.0.tar.gz\n```\n\n### Post install precautions\n\nJust in case, make python scripts executables :\n```\ncd /path/to/owncloud/apps\nchmod +x gpxpod/*.py\n```\n\n## Known issues\n\n* bad management of file names including simple or double quotes\n* _WARNING_, kml conversion will NOT work with recent kml files using the proprietary \"gx:track\" extension tag.\n\nAny feedback will be appreciated.\n\n "}},"isFeatured":false,"authors":[{"name":"Julien Veyssier","mail":"","homepage":""},{"name":"Fritz Kleinschroth","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEATCCAukCAhAaMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDMxMTA1MTI2WhcNMjcwMjA2MTA1MTI2WjARMQ8wDQYD\nVQQDDAZncHhwb2QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCq9p5l\nzNzR98l/xPgrplWrGQBhF6aQSLpnIyCdLAYKk+CmXn47W1pHh5CRYyCCyB8YPBBG\nTwbpP69pP1updfK2vUt+ShYmCXLxOLB3qEdhnwgqFfwpC48Ocev9d6XcacYp7jwu\nRNtv0ocMkm5o0TWWupcutQWkmqzCVq+OkrqM0xrf3mfPymuM6edEREshukoL86Ei\ngTuMMGT0XO99LikszvdceNQYEATix1MHzSVhkE7jHCNBXb95H6nQGr0v7R1MIbrI\nGFlgqxwwNNKwBFNfPMWZVnKwz9hoIwW6WOuu7ntwVcPqwB/gUsRZJTu7EjIW0trX\nnhA6xLlc4X66W1sdUCkJOxsV+Y21akz6wynI0SzIfjALLI2Ls4QWrPM8GOX8nPVM\nm+Y5WXzqLJScdWYoefFJKS7kxwUJRewREB9ykCG5OdDubV+Iu/6jh6HWx3h4p3ih\nqkDypPWoxpfLgA8VZkLD1RRKGkRa858QBGdF/RHbYT3JfLEp9l9gJVKZE/yw7HKk\nwsZ/T6CMpLyorpd1XWtp2wLX8lr3pp9ecVDOdAMSqD2thDMDsZA82JrJ/vITwkCF\nBlqtDZmT0UnpxYNYTfYBam5Cd00jsqCt+Hr+QkODNe8Yae9c/D0zE3h2Vt7g9H+W\n7Ei+rF5nDYTBAApoETxK7+aUZpycBf3THAJOcwIDAQABMA0GCSqGSIb3DQEBCwUA\nA4IBAQBbCGAEwg3M5QJDMnZgu0zNOH2f9bamAS9ksyCZqzLoeQic1W7GYYe9NqAi\n7lO5jXRZpTN4L133IUQPtxCxuDooD2vFmCne92tLxJbc7uqlSVfhL8uMVOlnrA99\nKTAhySTZU5so8/OibrngnBmcdWwbhaWoCQ671M8aXM1wg2FVYDqB2GP3RvbpW11L\nOc+4tfh4mO4TwXygf7KYMOJyJW8mNNY7PZ+XW2Qe3vSXR3DuN8H8fgMh5wppXPJf\nE0+yNs42hwFjSojtI8BCb0s5DTleaakpDo8HQGNzEXP8tBlUYudtjzdP0jxFXbFa\nsT9pcMdeJ0/t5HqJSx1EjUCLYS4y\n-----END CERTIFICATE-----"},{"id":"ownpad","categories":["tools"],"userDocs":"https://github.com/otetard/ownpad/blob/master/README.md#mimetype-detection","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/otetard/ownpad/issues","website":"","created":"2016-09-29T15:58:52.814912Z","lastModified":"2016-11-19T17:37:52.278497Z","releases":[{"version":"0.5.6","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/otetard/ownpad/releases/download/v0.5.6/ownpad.tar.gz","created":"2016-11-19T17:37:52.234684Z","licenses":["agpl"],"lastModified":"2016-11-19T17:37:52.423930Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"dh+Txg1iVfqXr8+cxplNQuBZGErSnXUo0ewGwnybNMJqp8/EjEo72+zPpW3dVnhY\n67YCvhrm2bo+VRdFFymEfymzSJu9nWVFkGJhEwvTxPyIdAtuD5YAVrzmnR6L+H7m\n7Q1nXE63ICPCAQpHkxIfIXLh25OhWeyofBB8AVsjDUNn58FEYJ8fFkr6dCgPriZS\nsM2J+xtZMDYufy+xFMsVf/Q3WopjFuBjMC3qOecW76ZTwtREaswOC2RtpzUku2r1\nsogrfFlFer3Ii9/CWgOktnLfjB1DzbTwdEkM2xNVBRJgdMXt2VLA9FsxFFkjmr5A\nl7x9cNLWA8RLpOIpIMBbaef75u5HgRBvSvq114UsA9GCu/EYbIgD8YxEt7xuKd4t\nenksJB5gJ2IQNdHrPbsil59AsJ/dismDN6ktYgWQEk5dINzvm9EAvucueW0Gt+Jr\nqEC5WBgJucsFxSvkHh52v43M8jgPYBfHWEL/M/+377z3+mbuIh+BcQ+vcDdiqxTF\no3n0+gw3QYIhLEe75sUhxG6ynVUdW25AKKju1kVj3KJnZTBH1R8t8/zy4DnJG8d4\nuRGqyU4BXpZjEC3nVlsC7vCncWWhxl0WZQ/MWKqsfjVAU4I88E518D6NioqMnPEJ\niCZ2x+69UCDEQyfCSKajgAYT17r3OhZei8F9KSCH8Vw=","translations":{}},{"version":"0.5.5","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <11.0.0","minIntSize":32,"download":"https://github.com/otetard/ownpad/releases/download/v0.5.5/ownpad.tar.gz","created":"2016-10-06T07:51:05.278637Z","licenses":["agpl"],"lastModified":"2016-10-06T07:51:05.348825Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=10","signature":"nYsQ9U5r7uXwtcquaWGm2XMJBNYCcA95aUx9gLZ/wEmjCHqId7+MzcCdBnom33+j\nat2XR2a4R96UAUP78bfSC4Yb7nPepFT51Y8CSpV3mDT85/+SgJdq500fXldq+qGY\nffXLneadAztyOfZO9TXljaCLdREYI0LJIGVENsxBQVKM/eyGIuZO7fF70cH5vbfS\ns37+BXB+fxcDTlP2Xuulra8HsNoS81bzjsdVMLM7B7QwwO6rZ1zd5c3UzQ1LmY5g\npQUBNd0KjfHfZ6+Fd64XZO6NGfgucGNmL3lgxdsfUqKiLtikvFxK39dYW5MckV8p\nvLoS2nZ7cgETQmAW9Ahn3ro7gXWcPxzL41oWtZOOHRRC2Yz5zlZ3Bky1o+bF9g5a\nYdDF13zV6utUkhlplZhWbjKaXa04rzOvmut8Iqhx/tmDtZRYtaQXJZWutVJYtPC3\nH86uJJnUHHNFHeoT560mp1Hq0dTeR+G+yWsPacPD1rTYgZOUVEtj3Y+YdbTODR2o\nOdGzeYFl+6CL/OcY4wPGRUCTFwvc31lIUd4DK5SPfN+IGtuuXhAqVhwy6lpkcKRs\ncj8sBoVXbMvEtMnt5uARBvA4tyVffUL4oyoIsUnvXz4u+q4WVt3T17swLm6HjGVC\nNVqU0srHN7EeBRhHlXP1CrKQWGQlS4k9j9Li4Iw+X8s=","translations":{}}],"screenshots":[],"translations":{"en":{"name":"Ownpad","summary":"\n Create and open Etherpad and Ethercalc documents.\n ","description":"\n Ownpad is an ownCloud application that allows to create and open\n Etherpad and Ethercalc documents.\n\n This application requires to have access to an instance of\n Etherpad and/or Ethercalc to work properly.\n "}},"isFeatured":false,"authors":[{"name":"Olivier Tétard","mail":"olivier.tetard@miskin.fr","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEATCCAukCAhAPMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYwOTI5MTU1NDA3WhcNMjcwMTA1MTU1NDA3WjARMQ8wDQYD\nVQQDDAZvd25wYWQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC6CY7I\nHRJTaqDu376vt+kruX+QOL864joScxRuh3IOVcQktCvxasuA0EtrX7TCAQrV1tBK\nfkqJxU9uOV54RTgyh30yH/ZtnF2bYQwViGM06Snc0riqWydFrN5fxK52dpZWs63o\nUFCNhHxrX4aUGyfXu5nQMISLm4QHoZ3LDLofk1ZsiK62fM/Jz8N2PM8qeHzf1ATo\nSKcAOd3UeaS9C8bv2DuiZM7unkSO/tjrBzkMiq8ds9sIzBBsyk6BRh2HQjHPOtmO\ned+pS9mIZmc2xhssXoHL4IfZwTqwhktpsaTl7v0ROw2dwDATz/QoKMkUpboQ5lkz\nwgLQhoIZw6uAZ1R/Qjze59I3iU8zIo9quDarHBotZNXboYCmg9FRfE4mHtegVaa8\nv1a1JvFQ5gvsWEsKSV6Bzb65GTp4KG4q7YnUrzh6HJyDCGLvLlWm5OWsFj6sNzXX\nwLOv6JLORMbF4ZIo2iybb3x7gdfCu9JxMZ4JtOUC8KSJ6+ub15C1Aia3lN68dNts\nY6KwUF1Ted0o4OQPAulq5pUc+g6dTYmIKsavIiPKhMtl86AbUK50vRTeuGdFsT7X\nav73IanPdFI9bKth+tajgvB6dxcVnvBXbrsLUyEcsxsxtBJvQcMYS4aZ6ZJYLTep\n7AdK0Zt1iMdXB8+4PCps4rcG6bYB/uJeEAVm7QIDAQABMA0GCSqGSIb3DQEBCwUA\nA4IBAQCM10O+sCYhIExnx01vGzKlnRS7MSQNx8ZMmbR5Elfz4AVJAEJ96ytS2DXH\n2c+hcD0wAenXQEFk920AEqFQBT8DP34p0FmF83aMHW08ovzFiu4MdlhcqrLnko0h\ncZTXHVyS/8JZh+o6SVm8R0/BBLF1MQQ5TqRkJehbmk6gL0+MSYxehUDKWTjJITkR\nifneTw/Ba1d0AXBOq0c0HFyGxMPIlWe4qn5LtxH5t0wyVGeSj4jyv4nvd3ZGuAgY\nEUa2uYht/z475k4+vf0YhV98iQH07GnmlfD2TDZgmOCQGKlNfJh1v88OZyLLa3dz\ngRHzGwKbAiJ8T8bbpZ3e2ozXxADr\n-----END CERTIFICATE-----"},{"id":"announcementcenter","categories":["organization"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/nextcloud/announcementcenter/issues","website":"https://github.com/nextcloud/announcementcenter","created":"2016-09-14T10:38:53.939634Z","lastModified":"2016-11-24T11:21:50.324839Z","releases":[{"version":"2.0.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=10.0.0 <11.0.0","minIntSize":32,"download":"https://github.com/nextcloud/announcementcenter/releases/download/v2.0.1/announcementcenter-2.0.1.tar.gz","created":"2016-11-24T11:21:50.317635Z","licenses":["agpl"],"lastModified":"2016-11-24T11:21:50.386203Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=10 <=10","signature":"lmqeE6xBqUJfhuXPbjCfuWiIP0FEB4V/SsF/OvYar6rLpvDpJVf3DJoeIoxXurRP\nE9/xCcNN44P8PreRRDnFLCa0XsKOtwoGa56Lxk7IKvtiQG6xu4J6PKM+q/tIeF9K\nakw0LQXtjZB5InPhnCDDbY5YS9jgGEBylSHsgNgrElipcW+BzOBu1Amw4FECVlQw\ncQ83bio+YPZvsnE5+v3/bAx0m6QNxfyN9Sn6rMEqRkY3jfA3vejXGQH/XkputfV+\n5hOz48KbOVg7cKxg+ieJlSwC0aYjb+RXiopjc3icCoIF1llltOOeSsVYSflOb080\nupociPgQ6qIab/VNNXa2YQ==","translations":{}},{"version":"2.0.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/announcementcenter/releases/download/v2.0.0/announcementcenter-2.0.0.tar.gz","created":"2016-10-06T12:41:56.195206Z","licenses":["agpl"],"lastModified":"2016-10-06T12:41:56.263124Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=10 <=11","signature":"NVWYz73KtuoZ7ti2sluztJO5aFUc7PzhlDcg0VWyAQd1H7sk5wjw7i0bhrjw8O7M\nLsrb+PegnsL9eMlYM2WrRom+RF1PDP482xymZf1T8vh8qcTCm3TK89xSuiSm8yoA\niWUb/Uv/ODj74wVDWqWxAFKaAG/FestCB3InOOZQqQZLzlAV0U9ziYDGNzBjFqof\n9rLNxJ2IOqZOA7hhMIKhSrpA0KkSfNhBsVf8CWClYnVkZQiq0LoYkHkHIlXmXUr3\nOfQFKEjtsx+bNLa6CkAaocHGHJXAofX3GQZ9cjBsjZqiTfbXfcVk0kRfz7pwL92L\nI1McfJYvgMxDQG5bjRpNJw==","translations":{}}],"screenshots":[{"url":"https://github.com/nextcloud/announcementcenter/raw/stable10/docs/AnnouncementCenterFrontpage.png"}],"translations":{"en":{"name":"Announcement Center","summary":"An announcement center for Nextcloud","description":"An announcement center for Nextcloud"}},"isFeatured":true,"authors":[{"name":"Joas Schilling","mail":"","homepage":""}],"ratingRecent":0.75,"ratingOverall":0.75,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIDDTCCAfUCAhABMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwODIzMDkyNTQ0WhcNMjYxMTI5MDkyNTQ0WjAdMRswGQYD\r\nVQQDDBJhbm5vdW5jZW1lbnRjZW50ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\r\nggEKAoIBAQDPx4Hp1HdBo5v7bDEiVcv2UrVjNW+fPPKS/5rwbagtPcE/1v3WDcwX\r\nvFwaXk8qCn2UpPSQ2b1rTuTDm51G1ZmEZhNiio+rBfEe9F+3tLsq9lElqIPKhkAq\r\nEUVI6dcN+jSqvLmLhuwloEoQQSYaLrX75mY3lGqTb83h1l2Pk/brVixuVf4vJW31\r\nTgeieuGKnC+keLzKOrvTHffJakU8ktwB2Nuu1o+jN5a7u1bxKkP3LjEWPjq236hk\r\nAoOcW/wi1dUEyUKUZsZQeJyvTJh1UXdLHKwYywtUu1/VLZ1IUtNyPBfiQ8ukPp3T\r\nTnSSmG3ZnvsfM6DmAvLZ8bBQkMBzEcTLAgMBAAEwDQYJKoZIhvcNAQELBQADggEB\r\nAAB3i2NgiZ4rpNag7cXYdaFxAxdDWnke1+LX2V2R3hzGmx73/W6cKLpo3JBn9+zT\r\n1aEjlqkt0yHu4aAPVYQzOa5zIV8mjP84p3ODSyV9J8lfjFNXT7wdA8+9PVx3lVki\r\n2ONoCNBh1kOxnxI4+BsMlQfF00ZbBSuGcMm3Ep3lTFWXzuUn3MQITzPwkL5LkW6a\r\nsli/yAYQRTVDsXD8A3ACYT7BG31jGxyXtIHzqCci0MhZFdKKayMYkwfjZchIUtGN\r\nJJoU8LQoHwGRtp3wutk0GlFzpEQEvSsn/Lsvvot5IfIe46tnzA6MVj5s64s5G8+Q\r\nphhXFlzXqO/VxquPdbfYjvU=\r\n-----END CERTIFICATE-----"},{"id":"ocsms","categories":["tools"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/nerzhul/ocsms/issues","website":"https://github.com/nerzhul/ocsms","created":"2016-09-19T21:56:04.745481Z","lastModified":"2016-11-11T16:29:55.864273Z","releases":[{"version":"1.10.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://ftp.unix-experience.fr/owncloud-sms/v1.10.1.tar.gz","created":"2016-11-11T16:29:55.856768Z","licenses":["agpl"],"lastModified":"2016-11-11T16:29:55.947926Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9.0","signature":"hVzbkmmtJCtiOkZGe1mkWElqS3IPQ8wLtSzikVvoKmcg+Zq3YLQjpQWzy0t3UVjo\n9I/BfnL0bF+kjtGc9xF6M8IQaFqPrfJmN+lNT8WYIKLI97TTsLmJGg8Q8PAux3nY\n8/NxMjWdByMw9nVBClKo0o9eSW4+EnaUSJ62Gl/XWjq728kbB16WZm+iesk8LjJJ\nqqAgczWGwz6lkZTCN5o9n0a/YoLJTf4iT+OItHZyS609Cqaxx9CAmZPj/Xn5g1fm\n8hqO2ITAXLoBj4rYS/QsZTMcubtGkJ8fq3XYKVSv2UXZfvGsNWbbGV7puKN33uWJ\n5MrdoMlJ8XnJRPDlCBcb00LY+AB+hAMooLnNy765/Ew6ztp4KNLEPWGG+Ut8/Lkk\n0jIULl1RF/FjlW8P26NfwH36K30RCJFY06OFcWnxGBkkQaNFORDIsKcqTAxkl4x5\nnfKBkNdQZppCVfOSKOZj4NkWfWx75Ouq1S0QksmOsMZoOcjy1TbBKR8h6dt9DQub\nWpYBL0QwyQShGp0Vb1qCKkP69ZQAHVUJNzIFPz9LyoguvFyv8iZmAPLYDnFBvlf2\nnSHtA19rnJmZ4H7RJ02r6BdkstxISvEiHU7RLjNQxcb+DptIWX5C03wH87HTNIhr\nvptPorEoSY1KwW9fqUvvLE/c+vfkr5cvIEwZlyVKVXU=","translations":{}}],"screenshots":[],"translations":{"en":{"name":"ownCloud SMS","summary":"A app to sync SMS with your ownCloud","description":"A app to sync SMS with your ownCloud"}},"isFeatured":false,"authors":[{"name":"Loic Blot","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEADCCAugCAhALMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE5MjE1MzU5WhcNMjYxMjI2MjE1MzU5WjAQMQ4wDAYD\r\nVQQDDAVvY3NtczCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANqZVIzM\r\nwBJuacuvgYKr2KnXuYhjKjZ58nfspSebsaGLr0ifBbo8L+NH5eaynnLCNhpegmu0\r\nO8D+KrbM1LtIkcdg1/eFpN5dTc6G2OAc9H9stmHs9nroF6MNhszgdZCz8Q8xkSoD\r\nGdSm8hdPg5GcfLrH27UilGtzdQlWJ1DralLMt3l+SfGJo152c/dc+e6SuT8+EbY2\r\nCeLdH5ImasXNpUgY+tAoEt2ZvhBrUghykBJTJVOjwL1jGLT37ybMtV4FBKo6hpeg\r\ntq/YzEk1ijBAC4pmoNWixDKCdolpVJVz0fijI9mlda3llurcp8eMhxfYJ9soXLHp\r\njvLX02YY6RfPcyy48uWVk4IEt9BvZWEVAAp7hCGA2yXrVSsR37E6sDbLsBcKav9A\r\n6dkGAgfmGkr2WT6O1/EhK/MakmnYO4WD1B+E7PnxtP/wOa+aQBmntQcd7igDiwzG\r\n6h05NYAWcRhqfZ4KWYsq0t0SezMbuHOhwzzi22q8wijC5YZbmhKSh+b3N8XwYKDi\r\nZaw+fSahPbRWaLyR3wn9zh7vKCwqrG3ugrNo6CtyoACAnmxKZ97ROFJIQTe3ndLL\r\nmv7Wy8iCZLhRYUaW/GKrF11AFwBVec9xmvkgU+PIKq2HSjwi9sCF+pFyhVjmq29C\r\nmZEPKUV7ySIpNHXpsXm8kTJJfqjSdb2ECbLfAgMBAAEwDQYJKoZIhvcNAQELBQAD\r\nggEBABvn97e8Nw8KAscf6FX/nZ99rEX+3IrZxTC8fmBgNwAvlbF2A+QZQcFI4G9/\r\n85nHK117+u7XDuwWl4QG3flWlI0hDE59Ud9Bd4AiTQ12VoXlNdYoTg/mXARxVozb\r\nKYqZ+1xRQclZKb2AqW8YiGo18okIKovn9VVRAFYPYx4O3Ve1FjgfsaMlIZLiXUFm\r\nkk+2qWo6kYsdU9FABLo6izx7RFOMbnYNre5FmDrWP1Dga/U7ErK/Dilh8g9b3HrP\r\nwP8OIZhdtFWw21wDTfyqrb9EhC/tsjPVP9u+bqyognHeiMhjbVYRbSvz5o8T7Mhj\r\nbxalCt4/LnMIfMwVyIvye7Uy2GY=\r\n-----END CERTIFICATE-----"},{"id":"rainloop","categories":["social","tools"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/RainLoop/rainloop-webmail/issues","website":"http://www.rainloop.net/","created":"2016-10-20T04:17:37.217555Z","lastModified":"2016-11-18T11:36:04.309739Z","releases":[{"version":"4.26.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/pierre-alain-b/rainloop-nextcloud/releases/download/v4.26.0/rainloop-4.26.0.tar.gz","created":"2016-10-20T04:28:21.491747Z","licenses":["agpl"],"lastModified":"2016-11-18T11:36:04.619927Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=10 <=11","signature":"nTYIVSB6mIwKtXIrKoVGsOGFflpLjed8jFem1VLQNtXQj4bztnNrdc4YaPIn0yzM\nyLpMSqRDNzdYNFuOeDiyKLPJPTA++MotLCNjEe7kxUekek+m+qzgnGBdcT7RQT6R\np9xWGecnVx94d6aA55uiRhgQRyHpdDMMLCOz1be+HvpwHy69DRFZ1+SPmGUt6eW0\nu5yS0vHCu1K22cbrVNXFKjxAOlGcIDm61oQuz7ycl3uAujZO4rZbWt55jilgKGak\new559A5gTp9W+j+TWKIcg6LIZ9zLRlGjcQrWJrsc+OBZQcqiYimSFyO6HhfT9TPS\nPof//I+dSsd+H0SRGGeL8DvSnK+NKZL1q5EX5pziqsv6nZFITpCDwmAN+I8AnXXL\nSNkFi53M8RZTOABpD2x7YPYP1cEvwrRweqV/C/oHcYnpfh7D2DjFeWwXsjeAXrHY\nhgFhPrg+7rf7g6UmJFOCp0dC9sBdyQ3KtJkv7bGqPr854r2cdA7xW0QHWQ2in9qQ\nLhIczc32ECi3ZVVgyF8zyT4Y/3MRS05oX3FHvHyt88mjni6bVaO78F7ZRSha8gHh\nNOAkku7AMXPvUCHaZP2iVCCoAViEso8GeR3O8xh2G42Ai61RLYwx8LB1+23EoJTr\nmfFuRYNSg+qAKCokXNnh+lDlwu4AkaQo3vtKGPXvU7A=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/pierre-alain-b/rainloop-nextcloud/master/screenshots/2016.10.20-screenshot.jpg"}],"translations":{"en":{"name":"RainLoop","summary":"RainLoop Webmail","description":"Simple, modern and fast web-based email client."}},"isFeatured":false,"authors":[{"name":"RainLoop Team","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEAzCCAusCAhAXMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDE5MTkzNDEwWhcNMjcwMTI1MTkzNDEwWjATMREwDwYD\nVQQDDAhyYWlubG9vcDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANqB\n5jnF9qZ/qjckt0kRjpHCOMtJumW/KiQoMeNP5nGv4ad0DS3KemOapUef8Zn7qCYb\nMnODhK7HBwPifFzI1j8bnT2hP6E0geFLb0MdN59d2NF0n4CCs1+BnepQPJ1kFbPK\n35wQRi0RDeTf/GQ+/owEVCU9a9W1P/VUXk8Z0vMoQxCXEdRqnB63SgsKl7DB9G/C\n4SYrgGor+OHVGl4ntMZhJujiM996DttrNK3iZRGkQ07L+lfUIwQ52XOhQNRdic4p\nB03lw7PpChwPGMv/EEvdR5HpCJQBJniqJbbu3Jh8bMBKTE/8fCzN3vMXICB2g3Bq\nlKkZW6fnJRGsrZ79fsQnl+WBPNSrWRLOxOfe1fyCFV1ljFB4nTH7uF3pC8ZRgJes\nkHIESHz3GJm28hn4+17ESMGHBCbs7L9FK2GY31cobU0VRntLxpSG+d9njbIAgMG1\nS7U+oKVFQhSVpdXNOaUNqhcQ3HkbQTLEP0k53A/lhLQb2+KPd8nntaELjwNyrmZg\nsVMgHj/zdlvrbguZjZFzUzDBFvkuv/5M58lNT/D1C6ufVp/R6eLsYI+nnk1ojAjz\nl7N6U8X5SXpD+Bm7+Kn1PH+bHl7cViCx8oXJXO2RhP+COXckw7BDZKtjItYHNG7M\npFwgYqWpvCu9LN6IN5a/eLqSI76dOOP3iYbaTH+NAgMBAAEwDQYJKoZIhvcNAQEL\nBQADggEBAGB0Vq0l6ndGTgNbZxSEFyBR3u3tiR3pWK81DYjsui7qBoO6P/BaGmf+\nraSwHPaBOwA9XNS8jcGLh5xdqY2p/m0dTS64xNjVL9nweWsG+FwVnPANo8C4nXdm\n9ajJ4cdg54stQK8qn1uh/xPcd23GKfYJazjYSwYmZ3pXXdzlGN9NxkeYJQxJ6B+5\npzAeVGiABI/e5URpxzz2UayRX7EE+vtpe3B84hzkLqsq0N39ZN6KLfaTyEBGLzqE\niLYeXQTV0XSRs8xVt+iyGlj7nPkv2DR0oCqRpWUFWeSBI//niDG5WxS3qg8kacSW\nfDSYhSN+IjrnIkwNtc8V9t7/GeQB5FE=\n-----END CERTIFICATE-----"},{"id":"richdocuments","categories":["integration","office"],"userDocs":"https://nextcloud.com/collaboraonline/","adminDocs":"https://nextcloud.com/collaboraonline/","developerDocs":"","issueTracker":"https://github.com/owncloud/richdocuments/issues","website":"","created":"2016-10-31T08:55:45.631429Z","lastModified":"2016-11-24T12:13:53.905352Z","releases":[{"version":"1.1.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=8.2.0 <9.3.0","minIntSize":32,"download":"https://github.com/owncloud/richdocuments/releases/download/1.1.3/richdocuments.tar.gz","created":"2016-10-31T09:03:40.389355Z","licenses":["agpl"],"lastModified":"2016-10-31T09:03:40.439510Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=8.2 <=9.2","signature":"s5giQeiU2zwV5X6FmxWXiG9LtNDeKBlFqK+hfvGNbGZ+nic77Y+AnXHodV4lb3Ko\n0C0ThFLuafaZRdp9rBIN2K/acCfCYKJewGuYErb7FlEl+P9J4OQbb9pva0htZJw6\niuG5eyeTufi5MKB4vuj4+jo9zhepOFAtZMa7o+ZCfJkt8vDBuq5AXxomEiZRtW+n\nf9PPUnq0z7DJVwINhHvvBZJlSLjkpJ6VIHAr+/ElWr8O/mDKq5S5ohbvpDcPqR7b\njnsBckFDLFUz1FX9dA0JCJEKMMfkcfGqZcjH17NdjKAxRW2soN5cEKluu5MkOhz9\nFEPKfshzbrfUIm5MaFGv6w==","translations":{}},{"version":"1.1.14","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/owncloud/richdocuments/releases/download/1.1.14/richdocuments.tar.gz","created":"2016-11-24T12:10:13.337165Z","licenses":["agpl"],"lastModified":"2016-11-24T12:13:53.963638Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"prDGlfRPxqT6LP0BsAFPwGww7P4Bngha2N4u5B6+F02N+RVOjGtTcXKqvM1KjZb1\nCo7qJvgJmjpvIvDmB+rup02i8ObfwP2ct6UdsD7ouzOWJG2sJANXK31bHyvOmQ2h\nvKu5eNcOkf+WFyFKYi51TbsfWn2+1Wge3WWujKAVcEvqtcOOz+uMWNtqzBptEupk\nE1aaRnQfTx488YB8Ubul06LIY0PNCHgGCWPgy817tOVT7JA+V0P0FFonl/PXE0dr\nWgtxRJmvGaNiFzYq+kQmdKMfayZTm3kdVgP0W52t5wp878K0i4s2KPg5lANvjTz7\nDCT+VV2IGIE52o4RpMUGyQ==","translations":{}}],"screenshots":[{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-document.png"},{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-app.png"},{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-presentation.png"},{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-spreadsheet.png"}],"translations":{"en":{"name":"Collabora Online","summary":"Edit office documents directly in your browser.","description":"Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that."}},"isFeatured":false,"authors":[{"name":"Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIDCDCCAfACAhAZMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDMxMDg1NDExWhcNMjcwMjA2MDg1NDExWjAYMRYwFAYD\nVQQDEw1yaWNoZG9jdW1lbnRzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC\nAQEA1jk29m6JykcJ2Ld0YEpjPMYh6kwxY6GysNJnfkA/th7tPWL3+vBJ9oTYyVnZ\njwAE1Cqwfa9MyBKMZ2IdfIqtT8PeWzuFP7Ib942EdxUpwwh9F3lykeGsj0h4zQwX\nF9OooiS99PfLX+JpkKm15Ujb00iLB6xQmq0+3NeOT1CTD1ziJ1ueOcxBKMwaFp2a\nPuz3F5ywqCvpmxG/OBuOs0LI3/zStXhBNbUMxBrWblr7zaVNJXl/I2JCKj8Wah/H\nXUEEGbW15fAUP1f+90eQSxpEoCZDBHXOQCTJYzySGv+BjU+qlI9/gS0QbrsiyzUf\nO5lyvi8LvUZBzpBw+yg1U75rqQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQA9jU3m\nZmD0ywO3MUsG/GLigFtcWi/p7zp2BliR+NpuY2qNFYDcsIb8ZUudmUc/cJRRctzy\nAPaLLj/d+h5RFaxjTVvim1PSe6M7urK/IMSvyUVYCeQRYpG8ZJixKTCOVIBaWHMz\nxTfc51tm9EPlpJpK6JtaWrYYoWGE3k9sINdJ4JkvKkE2CBAqVhX6ZGyEQ0bnEhtk\nRu1DXn+LW7TJ4NZ8VtLWvmW/6Kfmi7dQ1V++Kmn0lO5ntRt5altePbStCHC8bhGp\nmyBOrjhrJgLIwvgH26MYZhdiSkFzoE38nMPZdrUmUDxcPCwucWJqgzDPudguFthj\nWCVZ3TTG/2z3+tWM\n-----END CERTIFICATE-----"},{"id":"ocr","categories":["files","tools"],"userDocs":"https://janis91.github.io/ocr/","adminDocs":"https://github.com/janis91/ocr/wiki","developerDocs":"https://github.com/janis91/ocr/wiki","issueTracker":"https://github.com/janis91/ocr/issues","website":"https://janis91.github.io/ocr/","created":"2016-09-19T12:07:49.220376Z","lastModified":"2016-11-21T11:22:21.024501Z","releases":[{"version":"1.0.0","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":"*","rawVersionSpec":"*"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"}],"shellCommands":["ocrmypdf","tesseract"],"phpVersionSpec":">=5.6.0 <8.0.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/janis91/ocr/releases/download/v1.0.0/ocr.tar.gz","created":"2016-10-24T06:50:43.283900Z","licenses":["agpl"],"lastModified":"2016-11-21T11:22:21.269108Z","isNightly":false,"rawPhpVersionSpec":">=5.6 <=7","rawPlatformVersionSpec":">=10 <=11","signature":"CBJkCIiUKyf2NuWfz2zJ3grhf8p7wJes7DPV/OxUzhlxIH0Fh7K54+U5A9JOOi6f\nWPhjXG1ylkyIVY1glr/B8svWNsD4jAclpnUi1/9ZW5UPT8LnRBfTbtF9Uoj0OgNs\ntsGQYbpuREoHnjbJWTRe0kq1OsOfX44xuf8PuX43B+lpQPW4iRSSz3ZIhdPcDGq1\n7pyqQM7gdKhBQ6/tOiwd7Enyt5Hi4V6jhwhUOCYeTNiLD2V3yKL+qA9DzpXUfNNw\nLGTjcaMrifibHQIZBZWbPPMmCfMJZ7GO9oR4gWHwkhWqt0yVWAJXAHJBLd5vXC5I\njtRTXRpHO/k6Dtqem8tZCVoDE5MAC7fDZ/0XzoFiXHciP6MenVasVcXo6xJOJc5y\nGsrecNftUEhP/ngxA6lMBVkLmmdpiexVisvsavPi64i34OUA6qOuxjgNVBDwg56i\n2lOEVvHa3nn0UX7ZZoQ/Nu6Mz7J3Hx/VDlttPuWe42eeJAphyDGubT1M62gW8dVB\nD3tJOF7spnK6I3BhVLviou/zs30AIRVBDTU0Orzx78cbInwy6/vyJib2a1olAaHz\nv05SzlQRnBWM4jYBe0mA/2ds9AO6VrXGrT/iLlHemj6JYoGBM185TGewA7OJyX3a\nHSlSDqaremmi+aS3onx3AKhXykDxTRkMVarePwTzzFs=","translations":{}},{"version":"0.8.8","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":"*","rawVersionSpec":"*"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"}],"shellCommands":["ocrmypdf","tesseract"],"phpVersionSpec":">=5.6.0 <8.0.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/janis91/ocr/releases/download/v0.8.8-beta/ocr-0.8.8-beta.tar.gz","created":"2016-10-10T18:01:16.076330Z","licenses":["agpl"],"lastModified":"2016-10-10T18:01:16.169733Z","isNightly":false,"rawPhpVersionSpec":">=5.6 <=7","rawPlatformVersionSpec":">=10 <=11","signature":"uEvhHfQCrzb6z+QuOoO8rYXiMsZFkrFWEqDvTyOTSgFKvo7dVoj3EfDfaApgcKEB\nIM/SqjLSO0lNhrp8F2mST3twbvLDprKsfrDWKFE6eiH0yKl2aNB+cHWE27utARaX\n/QZBD114vbWeDnbaBa4b9OwtBXDqKJrnO1LmqSLFP8guAlVTkU1jSPkRTpmwAcAZ\nJA/aiN/D2LSGfiNp/YdeTuzU+gPINIs9dCb6+PPkyam8PCBaXUSSaW+c0lAQHln+\ntb3EXxZ5YXdjPWrpEyHvFLk1N8s/w615QoMxr5fEs1M8D29aGbcL/wu7LXH4X0Yn\noiWwIFbpfrpJQlrIFumxWZR74JXiNr9J7ijnQ7SjxdHCcrLxMdnZ2cwq4iD6PnYm\nnIojhlhPOqUIzsWYCYutLWDQbUQz9eyWbj/+7XL+5KjetUUr/MnCu6xJ27IqFbAX\nHc8KRCO+9I0/qMQ2/rCZXBMeo39MGhhkgkVl5YAKwC1IEN/jlfyVNXZwYlfcHLKj\n6aNQ4zN6gGOerWWZ8qXtOeNJN+qv0nmXUKrZdnZUAhxOdB4G9Ym+JujxJZ9yNIWV\nsiqAI9J+OIzCwv/dzZhaHadONoo/RTF+Fl6Hy56HyBtMehb8w9p8ksVediqf33yt\nFAE/tzKtNK5NiRd+8MZkq/GbocaFUv3C7Y6pLMpTE1c=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc1.png"},{"url":"https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc2.png"},{"url":"https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc3.png"}],"translations":{"en":{"name":"OCR","summary":"Character recoginition for your images and pdf files.","description":"# Description\n\nNextcloud OCR (optical character recoginition) processing for images and PDF with tesseract-ocr and OCRmyPDF brings OCR capability to your Nextcloud 10.\nThe app uses tesseract-ocr, OCRmyPDF and a php internal message queueing service in order to process images (png, jpeg, tiff) and PDF (currently not all PDF-types are supported, for more information see [here](https://github.com/jbarlow83/OCRmyPDF)) asynchronously and save the output file to the same folder in nextcloud, so you are able to search in it.\nThe source data won't get lost. Instead:\n - in case of a PDF a copy will be saved with an extra layer of the processed text, so that you are able to search in it.\n - in case of a image the result of the OCR processing will be saved in a .txt file next to the image (same folder).\n\n**One big feature is the asynchronous ocr processing brought by the internal php message queueing system (Semaphore functions), which supports workers to handle tasks asynchronous from the rest of nextcloud.**\n\n## Prerequisites, Requirements and Dependencies\nThe OCR app has some prerequisites:\n - **[Nextcloud 10](https://nextcloud.com/)** or higher\n - **Linux** server as environment. (tested with Debian 8, Raspbian and Ubuntu 14.04 (Trusty))\n - **[OCRmyPDF](https://github.com/jbarlow83/OCRmyPDF)** >v2.x (tested with v4.1.3 (v4 is recommended))\n - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 with corresponding language files (e.g. tesseract-ocr-eng)\n\nFor further information see the homepage or the appropriate documentation."},"de":{"name":"OCR","summary":"Schrifterkennung für Bilder (mit Text) und PDF Dateien.","description":"# Beschreibung\n\nOCR (Automatische Texterkennung) für Bilder (mit Text) und PDF Dateien mithilfe von tesseract-ocr und OCRmyPDF ermöglicht Ihnen automatische Schrifterkennung direkt in Ihrer Nextcloud 10.\nDie App nutzt Tesseract-ocr, OCRmyPDF und den internen Message Queueing Service von PHP, um so asynchron (im Hintegrund) Bilder (PNG, JPEG, TIFF) und PDFs (aktuell werden nicht alle Typen unterstützt, näheres [hier](https://github.com/jbarlow83/OCRmyPDF)) zu verarbeiten. Das Ergebnis, welches jetzt durchsuchbar, kopierbar und ähnliches ist, wird anschließend im selben Ordner gespeichert, wie die Ursprungsdatei.\nDie Ursuprungsdatei geht dabei nicht verloren:\n - im Falle einer PDF wird eine Kopie mit einer zusätzlichen Textebene gespeichert, damit sie durchsuchbar und kopierbar wird.\n - im Falle eines Bildes wird das Resultat in einer txt-Datei gespeichert.\n\n**Ein großer Vorteil ist, dass das Ausführen und Verarbeiten asynchron im Hintergrund stattfindet. Dies geschieht mithilfe der PHP internernen Unterstützung einer Message Queue (Semaphore Funktionen). Die Aufgaben werden somit getrennt von der Nextcloud in einem eigenen Arbeits-Prozess (Worker) abgearbeitet.**\n\n## Anforderungen und Abhängigkeiten\nFür die OCR App müssen folgende Anforderungen erfüllt sein:\n - **[Nextcloud 10](https://nextcloud.com/)** oder höher\n - **Linux** server als Betriebssystem. (getestet mit Debian 8, Raspbian und Ubuntu 14.04 (Trusty))\n - **[OCRmyPDF](https://github.com/jbarlow83/OCRmyPDF)** >v2.x (getestet mit v4.1.3 (v4 empfohlen))\n - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 mit den dazugehörigen Übersetzungs- und Sprachdateien (z. B. tesseract-ocr-deu)\n\nFür weiter Informationen besuchen Sie die Homepage oder lesen Sie die zutreffende Dokumentation."}},"isFeatured":false,"authors":[{"name":"Janis Koehr","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIID/jCCAuYCAhAKMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYwOTE5MTEzNTAxWhcNMjYxMjI2MTEzNTAxWjAOMQwwCgYD\nVQQDDANvY3IwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDDpXiwec4f\nXAT//7YBPSb4z6ZsBJSMfBq0VTL/HagjJnQ7BL+WagzWlS69IStNDqlIlenamYRX\n4B40heJIUinzYKjTRbr5UAw6MX29HibZccm/qgrk36o1XTgIsoRhmvSxbXDVIo1k\nbDOJN8gc2Gvswa8X+uOe9pfcDgAdqGxOvFnoKW89GnB01pCNT+xakNErGAFqVLsr\n2AeademAZnbxJ1cB54tQn2Bygb/7DKKY8EmFfIq6/27n9Jbph1FG9HIlWRT4/M2H\nU2pG3cCScWMEBPsW7kpfpnzLk7Q30Oj6k/rEYjJgmNYgg6oVnn0D9uRmhBYBnGyx\nMab1ilsK53lyuzQY0pmU8V5ULqpnNFAK6DVFfofEamDUhBPO+TZXEA5cZmuULRpf\nQQXmGpUQSyV6pS9WirMIqXFp9wmQ4vtjMdhu/6CP7cmtYZdq9uOhWEHbQM0mZUkb\n8hMjeItPx9XITI7Cge1JUOI8ZIwiB3USnQXcMd3v82l++/VgqHB7s5OaKPhygsWI\nM6RCoBcGiuQB5/fEUOg5ACOpGVyJiBda0Mi57AdoxdJmfnr7Bxcf2tAWIJL9Y7T3\nE1+V2BMxJOWwvVz26Cq83F41yXK2hJS+SbfQTqNUR8Cfh50CS9POvgRxNrJK9yvI\nkKle3ITRtGVM1XU0njWjnsdGg3D3O2mmjQIDAQABMA0GCSqGSIb3DQEBCwUAA4IB\nAQAbFddMbgfPI1szT57V1FKZrOrdYqQ7qjewlIQOzshGydbMtqS/9XL5hYocJCMt\nY6w+C/i6iEzO2Jx8D/k4rcZMXoVR6y3ZvO0Ke0gzSRsU+5eYj2FK1VV+cNIQW5Iu\nCYYIVa7pVPVHdeQH2Bba680bLV0HMF6b1fI9IwkfdCAinvCYZLjyEXZlmB7YjyA8\nHR7qPCNz4uG2Va7mlUHE3UYUYnlv8JFOV3YdbVL0nxhWwIdzSri5sxFIhdlabpzY\nyA1z/MCBEyTRo80jxFmL+MpwbsdbUJi7Qxlnd56zb6HHDGrLHXZTh9LXgyVbnhWL\nkxomWjIXQh4aMHQL4QF7U4EK\n-----END CERTIFICATE-----"},{"id":"spreedme","categories":["tools"],"userDocs":"https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md","adminDocs":"https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md","developerDocs":"","issueTracker":"https://github.com/strukturag/nextcloud-spreedme/issues","website":"","created":"2016-09-27T08:43:07.835196Z","lastModified":"2016-11-21T16:51:23.703819Z","releases":[{"version":"0.3.4","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz","created":"2016-11-21T16:51:23.689599Z","licenses":["agpl"],"lastModified":"2016-11-21T16:51:23.826509Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"Mhy3hXeGWlIujx1Op39MMRdqHYOo360BCwr4FPWoTNNggH3aS0gWlh48DAfGYK9W\netNiOqIuRyA0NrVlsqR2vDILgFtODJSbKPyHd3PQn3hcGsjogjQ+dkKciLNLinw7\nOhbv6aDdRFLBeRHpX/7wOnWL5W3ko/gyn0Awvi88M9+nC5aARtqncQqPy2SxDGzH\nKlOZHSNDnEQCGMhA8hNWWKdVwNUJHod/wmBWpW5QVNSJq5DqrKZcNwpGM2UUJoql\nEqUMwDXk5uVH5r5k62Tr9kguDWoUEG1OqQSyeMY24AmA64tq/HSlAdZ+CX32bc4E\nZvm+n8poJBrdSVmWEaa4ZfYaLFdOc6Kcuid1B1Sv9kPhD9WD6T1sicdzjDzcorBK\n/MLReCuSb2E8aPTnFWRoAZ4xCUGs1IXzX5fmxI8VdzwR42R6RhGJ/rqMuZRFenZF\nbOks45K5gE1da4QpkYOUQa3GVMNPqPiT3CqjmJ8tjxq7bGpb6v+YoCLACjjPpPZL\n2Y28qLxwHVaINDFUUxD75WWdrlulRbqHwiSw8jolP9qrpXhDuLAqYam9tRwV5K5R\n8uNawnFwWkicBEYkN/WtBTouWzehOPn38tHXov6SyEyD6lkuxUBZrsGQ2ru+t33U\nk0kKCbV0GFw43I+3Ji5DiB4TUVNZYVoPG1B7Qve+UfA=","translations":{}},{"version":"0.3.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <11.0.0","minIntSize":32,"download":"https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz","created":"2016-10-20T09:09:26.520692Z","licenses":["agpl"],"lastModified":"2016-10-20T09:09:26.666738Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=10","signature":"D62Ck7JUnrYbrfFlX7xXVaYUMZIh2acmykIKapqfemD/tuX5Bvb08GYGTeFG61MA\nQzsqcIylDfGnC1UJbf8yWEX7PbyJD5w/R4WlbFv34njDvM8rBs4HpzSjkqQoykOF\nZpYAjH2ydfKqtZadgoIRm7et5B8X2AeoGg11ec52DId5t1wAEBcDIv824CDBUt8t\n0pVY8Z8n1MUYwU7DCjCbPy23br2+EBODFCHp+cFfMBLg3F0BJI5nY3Q8ku+0tqMR\n0NDxQcscNZ2Ck/wpVDWylfhpS+ICIxSMiyq7urP593mRrK3399SUyaMqDfgl/pxo\nqTzdBxHLaAqcnKZYglbqp+Gxbyj4teqCod8TiSMlp90VaxhC72ACuVQQRWQKuTNI\nZeW3YweWB5d7VErqBNmQR1tGnX5YFFHiKo41fVDQFsrOqHx4zP6AeU3nkl2ol/r/\n3pg553so1MOxMkyLEhGYGMfrdQqVEtajNWHUdj3B73LS+M3jcjBFIdOD+AGXPtDX\njCRymt07c1znhkL+aT8yY5SHMVbKBZj9mExL49hcLjAYYc4U++60uq9MFH5r9g4T\ndph+yT6VVEM/UH2HjvKsHv2wm937sNgG3EXQdh79JU8nCXIz7cVrJ8f5/9r6n1VP\nBbjtfDAPEjmfVCXX2gmgLuZHV+GMhLBS9bTh+61AhhE=","translations":{}},{"version":"0.3.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <11.0.0","minIntSize":32,"download":"https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz","created":"2016-10-06T08:14:05.212553Z","licenses":["agpl"],"lastModified":"2016-10-06T08:14:05.278533Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=10","signature":"X9zXDyMBPoXPMpZ+XXWK3MLufjY2MG8lJ+93LiW3rv0iq9yd8PafK4IvP9czO6o9\nf/vNilq+1mfl6mjTvL6QF5+sySlzbRGbT3uTBwYXyYL07HVYgl1ZLrwe0kxvxqaW\nxTvPem7+HzwClI3VnWc7ylQfzGrcYIaSIg7nNq1GOHocsgZVNyj/nVW/eQx24MjZ\nuLzZs9SJqYoBGq+mo63vRswhqv5OzGebo+G6dHm0hvRSOw9qsWCDWBugiSRU8zU4\nD9PQ0e8WbyrIrQhBoUvvkuijO3zCySx606S1HUyaHmbJzMc4Fbpwz6ggmi6IRBbT\nFBKB1DWJDwN/7mY4fhS4KhircVnAHDqiBVCTu5i3pSfMPrwFymcmbn9OBuFHAFuZ\nd9PZvWQg4v32w+Q/NNvZVW5lRi+l0w5DEqNREaj79hljk2reZMaB65lvtV9NCYw+\nHmwWqsGqZ1SgGZuhYkOzEIkCfJ2fF/VpyavJ4X6bHP9yYdkt1pxnSSoZ2HC8mkG4\nBnPf28mEXRcY8EJv0rEePqKSBIhAt8yfEW+joH/8nupe1qOdfPvP08ifLad5m76s\nt23UzlSljzq9kVO+d16z2uagKomN9USZaNnJcUDVblfjvCPpdiHLfRPEJnRsDZCm\nNffFWEMcz+TWmwBboZgTRO9v0bPDEuwfCCEW0zy8rT0=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/conference.gif"},{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/presentation.png"},{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/import.png"},{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/users.png"}],"translations":{"en":{"name":"Spreed.ME","summary":"Audio-, video- and text chat for your Nextcloud","description":"Securely communicate with your friends and family using rich audio-, video- and text chat, and much more right from your Nextcloud – in your browser"}},"isFeatured":false,"authors":[{"name":"struktur AG","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhANMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTI2MTYxNzMzWhcNMjcwMTAyMTYxNzMzWjATMREwDwYD\r\nVQQDEwhzcHJlZWRtZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKLx\r\n2dCPBLIgX948BnOdLij0YyI2+FKD6uZOvzxMaoi3rlxNf8MJgraNMzTBWEXtxT5b\r\n7ZISNp89WEXhaQ1dwwCocodd/xow4Ek63m5nUvTZXsm+YSbMgrFbxzsBhYU7KuIE\r\nT/jhKdzYgemzErwwN/gtwkLMfPo3jkgg6c8NPPohYv6k7V4VnsqtJ0JS0kX19FqM\r\nMiNz9XkcncBHy9x0BSxy4+YnwbFcgIx/MtYKlBL8NkPuuJaB/6C1O+IPYhdEdnpX\r\n+RaIue71nSStOYOqT4YDqHAIw7EmqgA1my09mmK+0Pn92GJVEAEN7JGBSQ+F32RI\r\ndB3ivGAOVtUtVvJlepWdbHxj1xqeP+LCjWzHMLQjm0TyH8VqU4Cg/wxwAEFnBATH\r\naOaWwrggzY2d9KBo1mp0k71NArLbBdlHykFU4bgiSDWrXXMz0fZzLQVwGI0Eqcxc\r\nouf6t0kvrK8oKjrnso+FjBoT7lHV/H6ny4ufxIEDAJ/FEBV/gMizt5fDZ+DvmMw4\r\nq+a088/lXoiI/vWPoGfOa77H5BQOt3y70Pmwv2uVYp46dtU8oat+ZvyW9iMmgP1h\r\nJSEHj1WGGGlp45d10l4OghwfTB0OSuPUYwWR+lZnV8sukGvQzC9iRV1DGl/rREMC\r\ncQ5ajRAtO5NPnThvN5/Zuh4n8JoDc0GK4jEZsIivAgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBAGHMRbPV0WTI9r1w6m2iJRrMbZtbBb+mQr8NtOoXQwvSXWT1lXMP2N8u\r\nLQ1a8U5UaUjeg7TnoUWTEOqU05HpwA8GZtdWZqPPQpe691kMNvfqF64g0le2kzOL\r\nhuMP9kpDGzSD8pEKf1ihxvEWNUBmwewrZTC3+b4gM+MJ3BBCfb5SCzMURLirfFST\r\naxCNzc7veb2M98hS73w5ZE6vO+C/wz0GTsxuK0AoLitApT5naQnjvxSvSsjFPEGD\r\nsUNUEU2Decyp0jxLVnrrpz6Y5UupfBR0V8yAv1t5Od/mCKLc5DxHsDWiKOpsob9U\r\nJN+bdzJil2NNftihD4Dm7Ha7OS3O8W0=\r\n-----END CERTIFICATE-----"},{"id":"nextant","categories":["files","tools"],"userDocs":"","adminDocs":"https://github.com/nextcloud/nextant/wiki","developerDocs":"","issueTracker":"https://github.com/nextcloud/nextant/issues","website":"https://github.com/nextcloud/nextant/wiki","created":"2016-09-14T14:34:35.977699Z","lastModified":"2016-11-22T16:02:57.758477Z","releases":[{"version":"0.6.6","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.6/nextant-0.6.6.tar.gz","created":"2016-11-16T15:11:14.344704Z","licenses":["agpl"],"lastModified":"2016-11-16T20:39:59.030384Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"aOZeEeThyZ0V/vXBcn6c+Z0vyCsZcN6nfSJ8oWEea4zXh4g705Si+MFZESqix3M2\nOPCnA/U8eASwdRTAEwQJrW5ECmu1THXSIsrzQzc9kFycvyOGzCgAWtuu0ayzZD2/\nU5aDWlzpLHC1Czg9QJ5UnfZR0AfChWQ402N1YzGqMShdJv6AHXFrVE+uYnIyxuYI\noPJQBUYbQwthVUjpYwFwSxw50YU17gmx5RZ0Y0OPz3i/EiuEUrxopXtfDVYAuCML\npDw37LOTRQ2JqxSU3teALh8LcrwJbTeOP0n4bTeV+vU3jvtiaEoRrwfVrK41F701\nQymGXy1/EFG0kxPGS2dRNPBAXYLZfeoWlROl3D5BWlbsCcXKU1S+22yn0TEdS7x1\nY44x8jRKnBddDE7qkn+QoQYHNNcxOREsFFLmIoyCUpdNOdDX2PvTFUYkIqdnXaJy\noAKv2GkvWPQ0aiiBtA1i4oXuzvHW/M2wOrK7v7DCpNfILrD/sjxpljxcX082nRCd\n9P3iPd2hQ6yOM9fG21LVN74b6wggI81BzFf/xJPd4ZqYLjfeG/yqd0zaiMOzMm1W\nse+kc/a4iB3BoCNX3E942pBBzew4ya8LkCXdCHUUsuelDf1va1ikTh/G7D84ll9/\n2avNqQnUh3hgOnxFCLI/5VrbqxfSTVdO6O/LTuAmwgw=","translations":{}},{"version":"0.6.5","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.5/nextant-0.6.5.tar.gz","created":"2016-11-09T16:58:06.856332Z","licenses":["agpl"],"lastModified":"2016-11-09T16:58:07.139404Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"DVOIbLEVggiLkNkuPW+pXqu8WYT15unUsMoqHSw81NiU6HF0Nuf3XiwnHJJDDqo5\nyX+QyHADO4ZiQpvXhGigvwD2eS1jVLatAztyxE0tEQv5eBU/7R0jQYxI8YCnC/jE\nZDa0qs+TI58EkDek0LBzueVQqrLubKgGU9P+E9H8gbWi1JHvl/2LdY7CplPqaJ+J\nMRokobPntzgx9m4DZC1RsCoXzSON7o2gp2cmunPJiXVHPhMUfIfolGEbNGJ1/xdp\nra7Y7XkPnDx4po98a38UpUh1x/2m5goOV54em35bWbh4ShNDykiE5ttz6tOywlYN\ngxceSsStTKyqscVaOV2Xu6Ive0pY9CInvrSfRnRktIWBYDyWdbK9sJuqs/s69kqn\nKQ/SjzE2smw0zwOUMnSaz0Jzr1vdPFgNu2xDYAVQO5G03V+wQ5AhxuhBz5Xp5Fll\nLaOhymZLCC7lq0DUqkeTeQ2QCfiG23hvG2VUPsIqW7xFe2YzKHZVXi9JuH//Gwym\nDmJmcyZDMvNwNiObx3ZRKsZNH2XwbldFZ9nTpb9AafyoSR/qbwd473NewaDLRTiY\nLrOP5Wx1xx6DOkRmDF2l2iT1bSJ6eoAoWQU2I0aYRH9NAr2Ugd4f2Um4o61EJaL+\nRHT9cERRySEloU/NdgmZEOi+CG0rEu+9LC5G/jGlHE8=","translations":{}},{"version":"0.6.4","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.4/nextant-0.6.4.tar.gz","created":"2016-11-05T18:17:47.622023Z","licenses":["agpl"],"lastModified":"2016-11-05T18:17:47.678445Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"RdkvnhNjw+kAnT6Or3+N9FzAv9DjJ9BAlmgANMwZZcaqo1gZRFewsGD2Rx1KEb9X\numSC28tl2B5/3r/+dprVJmOnYJny/7+kDmI/d+vigKfnaQJOUZ0ya5+f72pFgow7\nth8fw9rX/3+zIBs2IeEN66cis8ioFq97BJDsnDMBDr7wl7CnFJjYe6eviWuiFTnC\n4sBXlYjHoaIRRu561nwAooV+WXmWsparYPVhj2cXdyP/CnWo5HSF5jA51WCsz7Up\n7a0URXdh85xmxEbZtnjUymTW2BIegdxj9Erbfiuy/m3ApgnP+DiEQRcM13J7pXqg\n4cgFOBSzKDZgim599WBW2uNO1ztnDYOzz47GXDfJhcdvKiZZoQpUF9W4LMRtheMz\nxD9YArO3j3d+VOInSYU2Rpvhugwo1LExhwnRdT4+cOZfEeq0VojiM7yBZLDdEjIb\nGdYUJtNWSU0F6cPab2Au8FgZymLrHL9EpGvxuA1oAwtRxHAgMElJG2O6Jp89gGl9\nh/AptypeTvzNEc9/Kg24ueBKqmSUd5a45pZ3gM2pNATJhUK7fzLb/K6cq/kEzZtj\nOPra1ZfP0/20u8VP32Rgw1cFmIjqt8DFzUmOMpMfyoJkdldtTwQtGk+yIvtN1zp6\nT2zDknAKA2N/rZ/0SJl8KxVVNLhQWtYBJ+rFAdapuxI=","translations":{}},{"version":"0.6.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.3/nextant-0.6.3.tar.gz","created":"2016-11-03T21:51:27.654342Z","licenses":["agpl"],"lastModified":"2016-11-04T18:25:35.697130Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"Hf5GB4xd+rVXzWvVpGbbF5tqmnI+DGHlNHdLYPImFLS/Z4K5wKeNp80E5sd/RkAi\nhyuEsdWHlGDVMT6s7oeCmH/ClyWqLNSz9VH4KYqyFgD4+usHZp9PrEeEKbvPDPKv\nD3eB7Ats34cWcpf4E1oR5wsPicgmdgIgb2uMXzc/1G9xUBRWzocwCstzjEEAB/VJ\nvJuHvhDTGG294P4gOb82MxKCQ8LZ4i1QXzOf/mLETOubiUbZtJgTReYvpdAo2Wct\nbdfDFw13LYZkCf71r9jIQ3PSPlIpD+0BwAlE1fi0Br9dP2JjIfiKN6CGVaki6O0v\nKR42jtcE9xXiAop0Ym1FYMWJvQUy5PFLMwYDfEd6CvfEFJl+fi+RjXNDNZcTyw00\nHa48sACoGzxwts2JknWMU57mwvi0Z4uwpE0cFp/PRzBsXmSlCzWHjJhu7+2qambE\nAabdP9nH2NvqJHUJyPsxtDSrSWCBY4CoL3wYu36UrIA4NepyudMPNe9fhKTEU0bg\n8DLclw6hYdj5p9Zj3OUuwOZLz6r85KwnooTsUjOYkBXvdUuHWkgONqqZlPMApS4i\nChRQ7ysHAinPyyzsvr0PR9g6J52CSCO/7qwSJy6yqSzuSWrbZUa4FVTcKIwWJJPu\nJ2XzB4rWVG1wWjzMM6MIvFbO2HY9upzh651OdOwsYvk=","translations":{}},{"version":"0.6.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.2/nextant-0.6.2.tar.gz","created":"2016-11-01T11:24:58.054892Z","licenses":["agpl"],"lastModified":"2016-11-01T11:24:58.151609Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"h8KgwMh2RGGIp7q/II23VSfE5Ibkha7p/C1kvIfG6QIIc2Zu/Mm3Oekynnysh5ZJ\nZuMTaeWbejbBAmlnxW+AwBWa/s2PoMhv7foVvdtg76l9/qr+9jGvUM7D1LbbBvAy\n/XW6JSrhhBZHOohdU7kwV5Xnwsn/NC/zUe0G4eZ+9fc9uSntkob9wnWvUs2daAeD\nY6Mi7Xt/XAIX65OIVTKfC6ah1SlbXgtJ2i2j4G32I9jRhmbkpt/UJEangn90fHnY\nQXNJ85OyV0aNMafNHoMSL3uLscdvjp0Hy8w4iBeavsRlCs0GiUoG1+YdwTwmC9EM\n4CjbMfRJ0DYK7u697TOmS8MQzk8O7f5THtjeokZlrom2YnV9t6gLvjnxl/+gXPdJ\nmgLixnA8P6tPsff9pquHKQZsvxjv6vVa2DVJc8VpcqJRih7yj/3V7rxesEP7MUnP\nznIOcwzTsKXHuAnvujpCwyQj3QtpQK2XJPQ5WkKgwbTdvriVJfnzPironhcHo1vC\nbuUDOdhL59aySChw2cZGD9lCWaxYR7I1BDDzWKNl9Qg0AZ2auyGUGTv8P2vi5qUB\n0CmnkzkZurR5ju6Nb9/2lcZvda7QJdIdMtm2Wnn+Ak/Z3Y4IehB5PPDP5/MMAhQY\nXE8Jqe0mGtiU/O2346L5IThkS58JlRmep4kYv+II9zE=","translations":{}},{"version":"0.6.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.1/nextant-0.6.1.tar.gz","created":"2016-10-27T21:16:47.066097Z","licenses":["agpl"],"lastModified":"2016-10-27T21:16:47.125641Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"axSX4Kz2P4PbKU676DibjPZsxk8hCIG3lLOmeMXoiBhp3ka4wJ8u5tNwTzgY8/MV\n3mjXe5DNttD66SqmiRNSPKbotYHVFFW3wFK+Dgh/++n/KTomGYUeIwt88Z9ecbuG\nNT6U46jFrfZBYzRHWzbgiJ4c7MCoid9cfmoB7HDuQSyw+E0S2vbLL8+jzMcIzF+5\nTh/sJEterXCyrWSciw/9x98F+4svNbskdEIvrOox3+K6UIhpsojqJR2+bQhG3rsM\nPerOb6J+bzHdLV1ZL/4nWEz1F30T7B08QxY/4pHD68JFQcdtzmHMIhXfCoRvWhN2\nVRnizx3IXBALY4F49Ql6bjsnr6BCp+LroM5RSQ3eupDcqejDJLbjPz8xfOMOwlx7\nz84Xd0MUyqaEkxg1ihsWLbPlYACUZ2aoDkSQUIbfZTTiov7eqTM8UBc/UqVID/LU\nyEW4gjFZzQy6kX76XRAGq1vebKFjCU63asCnVyJhF/YQVTu1hPGbFslkRKnYuh8W\ne4MeaNfbdjcSEX+7oTcPJz6V09pOPvukXL0M1m7lS9PhTisI6oGj8c33GPYp/DSK\n6SGk+ukbt1mwFuFKdTvAMxo1lk96D+pKUv4MX/ralaaoIAmwPTGsSQ04RyL454ae\nU6q8PApwrVyPHYwMBPtXGoQMyb2ZV9rylazYbKCQ8I0=","translations":{}},{"version":"0.6.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.0/nextant-0.6.0.tar.gz","created":"2016-10-26T01:46:48.419025Z","licenses":["agpl"],"lastModified":"2016-10-26T01:46:48.521063Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"W2TmbX/NbbfPPjIJLalO0kCDhhQF1pEohH/CxO9bY+yR+a5NKiTbpAhG2McqpTSj\nmgC4J8/thmwGlWGC+VW+KlpXzzjc7wCgMGMKViOpGD3pIy8p8U5MXTqVgjjrEb9g\nKgr9uErXzxJ5oDfkx8Uh1bUeBJTsAAivGJqMlhBYFGxw8BSB09sfOZytNxo4wbwZ\nNAcYP1qvkUQ8CVR0nInSTRfLvAp5+e/8xxyYZwJIWrdNgpoP0CxiwzKP/VSjBk/U\nsPU4R72UQnVZB0InRCeh/KNTwu1YiPkUKm+mNmt2hCfN7Fm6bY2rUMH7oa8KTkqn\nh52FhbaYRSAR1OPdC5RnHiQWlPh71gq+4Xqgp19Eawnl/QiVteVifSjNQZ+Ban8M\nRyw/PxHnzIWg/OAjx81Jx9mXjUIHSeUxMTJTKTp+lEqIAzjku0iHeU5UPGCfE+VM\nwmopZfnlfk2nLkUwjQXLCIcnZD1ME1m0h/H4Ad0Q/qXpBScUp47npkxg2b8zPIhk\n3aXUmNPLgwyXPWvAuaBK/WwpNefUnqWFns8t2Alpzg/EpC2PrZqciCNDcRFEycoa\nX+JsFyD7eYA7Dc9iIf09gXZX+tZ+Jinb+iPDwYrl1u/7IIBoBlUGCgo+cF7/dL9S\nc3vYeWw6MCH8Sv+ckgS2g726BfdN5EjB/8cb071b4lE=","translations":{}},{"version":"0.5.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/daita/nextant/releases/download/0.5.1/nextant-0.5.1.tar.gz","created":"2016-10-17T15:23:04.515057Z","licenses":["agpl"],"lastModified":"2016-10-17T15:23:04.576640Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"Pp3rC/9RmAYURneGpGit4HZ2t1qH9A9nwsUnGDgRuJ0akIii7CtJC+n8l1b9k73/\nhxMYnp2JOBu2HWKgFp9a3yeo1xphI5hOUdVQ1UZAWxIQyDI1FZVYDr81l7GCdkqm\n2lMxgviFADSYURCgEnAsj9Nt0NZ6LDcJZiJg3iPAjkDI0U+KnEBjtx/XRFqGUnfp\nCUZ/XLHh/hvoEitSHepTBDCMKkTNjbDEwBYfA2rAoz4zbMR5zKLU+1r1DIUgWSRe\nbk2i8TaTDVL4cbb6MhkGKwkujb+Atikvkpi45o7+fyQMs84c6fjjh/TZJaC+dMyG\n1GCikMPwwtEPjXtnLzynERAxJOd5mP4Ee4sD8ZrnzNUehpyFR88pwWU6r+dmiebb\nnsYlGkhIu2aIO2O4HZ4sUTsO5sfjZ9me7jsafhgJl6iG4IBeHa/L1MsSbhsh6mvH\nYsz4Xsluwr0QcFLmSDDQQYynyogKfJZG2xQsadM0GETWgXE44dVeRvMUsILfB4uZ\nmfKgd23SgaOhYC8m4bg5Hxnkl+xHJnyGZ6jhqg7bhuKwsoLymc18Vmjmb7a45HGV\nXbL5CTmw9yaPOBS3v7v91TnlB+0lhlzbKzZ0xIhY55qsTC76uScbTLwndPqNGaF7\n2koxRbJ3jcmf/Z2MLymdRi2BTZbZkPkxgVrSf9plaR0=","translations":{}},{"version":"0.5.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/daita/nextant/releases/download/0.5.0/nextant-0.5.0.tar.gz","created":"2016-10-11T11:47:46.191539Z","licenses":["agpl"],"lastModified":"2016-10-11T11:55:40.393000Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"qzQJSLK8nkrQedwwxUdhxL8bq3aXyppAlWJo+n3GqSvqA8uNTzl3Wsci0LsnBV0E\nDvDNW8K0enhl563F/bywQrDhgKl8jTX/CA5KCxqO9P+tvE80zAfMqiRnQayVcWuY\nSWX6RqfI/kqiWyN1SsFp2EDlas6eb+xfIoiJamlfsN0qzHYOFt5W77wmw2Bn9dB5\n9nwHHyC0z60Pf2pPduc/KuZ/971WrDFaIapL7Gm+z9XoaKSwUT575VtS+RNJkOKy\niBrwnHdc8x/62HPFOXsUYjCt2aEmLzPCQN8Ke5pd3596hm5wbAVzTHuxf2H35tb3\nljfGqAZ5AJX2Xd13d4aHXFdSEILwv6IFq2fx0hO3vkvFEoKF5oQ2t3hi++Mw/h8R\n15OKZCOC1bFH3gTwdshmnHSTSr3LxDeTF60aH16wpXcehQuJHagpb/aG8mPD1w+v\n759/mekqa4LYlqT9TLWTqX3UPeQXYIwcPijG84IvW1BDK1M4Mj2Vqsld4jXwG6CP\nORIL8xoQbA52dQI1Y19JXcU9zxIb6GaHYgpV0wejatsZRfhPv2Yd0CBShF4HY7aw\nnfcm88pqzOKNvjnLZjTFQwuJ0AUUSOsWhgZzYt8tATJ2KDZ+lxz+WAMGXJAC/ciY\ntrrglY7YxwJNLbYp+arE0sowZx+IOVaSZBvmUGHiEBY=","translations":{}},{"version":"0.4.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/daita/nextant/releases/download/0.4.2/nextant-0.4.2.tar.gz","created":"2016-10-06T10:31:12.482416Z","licenses":["agpl"],"lastModified":"2016-10-06T10:31:12.551117Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"QHJhYcBMi5HyPofshZ7EdcXsOfRrl7o48Y3BBBq8CkmYtFDbekghdJqjFbwwZa5u\n8FtgMVwssql/RSDNP6M2Zc/MpQ3K9gDm+DyxE5KRmtMEpzHB+oD+1DxP7kAoyW8/\nnBr5iiQSdLCelddMcTwbdxskLFUXIs3cFuLGhMvr8pdQOAgfxte5lolrj4/8EsJ0\n0yUImgIYG4NlgmvCygGApdpVaOcK7XVtv4oH+x43JmX9YZ3Ce0DQPYPUbFTCf4ZS\nS075j1vcnPx2cRFGxc+YpKzYVVYoy7ZdB75Hq+kaei/atxrTyV5+gcCrVPnH1RkX\n6G8rgu5l8FoGJYopi8/9dd8LsGLFx53CHMdEVob3tFR0WeK4TJAGJa403zE6S3hM\nxr86WCedmjuti0uOhSQr5AEVAoXZ/JUWQMMsPAUMuKEYVjKfmve6TlcNMC2oM5XT\nXcOf4OP3pcQq4ViN53o4Pj6NGSci6IzD6xLeAxKZUoTX37ArVKH6RHS5Najc193H\nRhYRnfE7D5YOr1u10HaZCFCVJif2MgMP0/uH2759NoRjXFowrh7Z6dW7JQG5lbHN\ne0jjJH1Y8m8H1peGGcmM0YxFiOVZ0ER7P+AxT4Cbau/cVhaS8vnPF2a2a6YFRiFS\nVH4aqazvvXrtifDr3lfvlyPCrP/570nwvOJgZGk+K/Y=","translations":{}},{"version":"0.10.0-alpha","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/0.10.0/nextant-master-0.10.0.tar.gz","created":"2016-11-22T16:02:57.740378Z","licenses":["agpl"],"lastModified":"2016-11-22T16:02:57.900805Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"kDO3xbPpoUdl2qo362tXfJIqKeiKE12M8FkMXbdKiRNzuQyvDOehQq3dErALZDOr\nLG47Tpez/Kn9Fsx1y4dQDx0w9SD3pyoqvjj1O6KkTYN6srpitQcj9EzEItCY+MZd\ngRSc7Px9MzxpFpgwtuThGVlSt5kLMd0vjWFLVcv7k07rZfWEsTwXd24INIDtlr1A\nC7hyLB777nEOGa7oAzx8nr+FJcIbmu9opVZk8AL40FOFDNBgfAy2AS9hGZreUmRV\ndV9Zh7UAR+RsEeO51xcU/CKqC8Jb0jL1gkYyUaQy16oe1HF9bRs1PWuNL5mYwsmy\nZNn0ay/a7mb7hxJbza1F3lbgBtodvbgUm7+So/QvaR29CSAqqoUXeQy6FfSBVWhZ\nYlTxdQfKcBcUPFO14BBk/O5p5iQaG8JCLJ/EZGDPDIVDMn7crGQ4oLZJv80eqTeB\n7ueDmWaD3gQ9j2XKsMk1uLSyY4unt9AaTofBylsKD1SjLhyxofGZym4jc2+M1GnQ\nyLcoEMSexnKuextu4nzrA0y5k3z9tvO07R29lwT1GFp6oGAakMLob/6XrGsm3YQY\nRQXgfXKFw8XmXBumqG8ayEIyvQ/O8nO6r4R1H8a7ooj6oWa3PhPsen+gLE0SpJPZ\nz3e2TLliwC4VtZp69H7u3px5Qn1Fc6RMDTh571edCr8=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/displayResult.jpg"},{"url":"https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/admin.jpg"}],"translations":{"en":{"name":"Nextant","summary":"Navigate through your cloud using Solr","description":"\n\t Navigate through your cloud using Solr\n\n\n**Nextant** performs fast and concise _Full-Text Search_ within:\n\n- your own files,\n- shared files,\n- external storage,\n- bookmarks\n\n\n### Recognized file format:\n- plain text,\n- rtf,\n- pdf,\n- html,\n- openoffice,\n- microsoft office,\n- image JPEG and TIFF (will requiert Tesseract installed)\n- pdf with no text layer (will also requiert Tesseract) _[work in progress]_\n\n\n\n## Installation\n\n- [You first need to install a Solr servlet](https://github.com/nextcloud/nextant/wiki)\n- Download the .zip from the appstore, unzip and place this app in **nextcloud/apps/** (or clone the github and build the app yourself)\n- Enable the app in the app list,\n- Edit the settings in the administration page.\n- Extract the current files from your cloud using the **./occ nextant:index** commands\n- Have a look to this [explanation on how Nextant works](https://github.com/nextcloud/nextant/wiki/Extracting,-Live-Update)\n- _(Optional)_ [Installing Tesseract](https://github.com/tesseract-ocr/tesseract/wiki) ([Optical Character Recognition](https://en.wikipedia.org/wiki/Optical_character_recognition) (OCR) Engine) will allow Nextant to extract text from images and pdfs without text layer.\n\n\n\t"}},"isFeatured":false,"authors":[{"name":"Maxence Lange","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEAjCCAuoCAhAFMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYwOTE0MTI1NDQwWhcNMjYxMjIxMTI1NDQwWjASMRAwDgYD\nVQQDDAduZXh0YW50MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsbnQ\n+9acjKHfcrUj4yqBpD++GmQ5z2Sp8C8uOz4ZbLyM9bUXEYHo4a4u3CdC49kGUkb3\np5MkEAEzslTWDi1eh5MZgPWpbPgItsDsXY1o55O3jtxNkzSG5/yYcPQcuKtIOm9S\n7DY0K+UQt3nK+RrXEZfARMNrzFbEzpE3b7w901Yl5n+m/B8rhW4pqg8uSfx3u04J\nwduV1fHwoHUB0Ox5HyWib4Pq1XppNh7xdc2Fg93JxshwuCPJyOOzrFTnxC7s1yzQ\nUvaqkjPW5QeQRunQjZ2XtpYH8f8v01W18bNEiHwqtFwuDEyCVx1rvEMgUDVXdPkP\ngZrlB5TzGmz0U3HzYvf6205WuzfHxz7kPj502wP51PoZBKpniggKzmuXkx6BpsZC\nZX45VpDHdiATLwRj1t2bMs3C01nzpIWO5ZwFtkepH3Y+mvwX5lDh/XDsqJC2Yo8o\nWMmniWNW7dspufYOsBUqqYGP7rkailgVT4oYk6D1j6oFZ5SSpfPF5lsyYedDSM6y\nbIGVkSF+sjLK6R9BenBijKceAKsS//WwRYCBPC+JHlsYpXKW12bL+C47Kj2/N6d4\nrYryzV6ofVSF6pwIq0oEjoyfBfNpYavf3xrRkSSmIIlPSnMY7DT1xkGD5retxSm6\n+WIfkWKRZpv2S6PhMHGLspYc4H5Dj8c48rG5Co8CAwEAATANBgkqhkiG9w0BAQsF\nAAOCAQEAOZUwyPaUi+1BOUgQJMWqYRoTVZUyBshTXSC7jSwa97b7qADV9ooA6TYF\nzgsPcE41k7jRkUbnjcY45RGtL3vqsgZbx5TjPa5fGMxlqJ6eYBOY61Q6VIHEVm3u\nxnPEO9dsMoDBijvo5D7KtE+Ccs907Rq70kCsbrdgPHkyb5tDSnCKogN1LiQrg1EP\nmy7Z1C7jG9/h57vx0+QBMDCYnTmqLsvMKqo27uHskzAiB7VXLEdSZ2FtMGHkLUQO\n0bfhnvTZ2VhMmK83t7ovo71An4ycmsolGD/MA0vNI78VrVISrdI8rRh2WntUnCBU\nEJL3BaQAQaASSsvFrcozYxrQG4VzEg==\n-----END CERTIFICATE-----"}] EOD; - static $expectedResponse = array ( + static $expectedResponse = [ 'data' => - array ( + [ 0 => - array ( + [ 'id' => 'direct_menu', 'categories' => - array ( + [ 0 => 'customization', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -75,28 +75,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-01T09:16:06.030994Z', 'lastModified' => '2016-10-06T14:01:05.584192Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.9.2', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/juliushaertl/direct_menu/releases/download/v0.9.2/direct_menu.tar.gz', 'created' => '2016-10-06T14:01:05.578297Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-06T14:01:05.643813Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -113,36 +113,36 @@ class AppFetcherTest extends TestCase { uWtzoaLi71/1BWTFAN+Y9VyfZ8/Z3Pg3vKedRJ565mztIj0geL3riEsC5YnPS0+C +a3B9sDiiOa101EORzX3lrPqL7reEPdCxrIwN+hKFBQ=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://bitgrid.net/~jus/direct_menu_nc.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Direct Menu', 'summary' => 'Provide easy access to all apps in the header.', 'description' => 'Provide easy access to all apps in the header.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Julius Härtl', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -171,14 +171,14 @@ class AppFetcherTest extends TestCase { G2dF9Gtu4GiQ5fuaJknaxlgXHovfqeZwZJX9o4M+Ug81AqiY7XjdiaCPdh0Tthcx 2OmWZo7UBREWenjKyFZZ/iKoqH5sdenBtpo= -----END CERTIFICATE-----', - ), + ], 1 => - array ( + [ 'id' => 'apporder', 'categories' => - array ( + [ 0 => 'customization', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -187,49 +187,49 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-01T09:16:47.111889Z', 'lastModified' => '2016-10-12T19:50:16.038821Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.3.3', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/juliushaertl/apporder/releases/download/0.3.3/apporder.tar.gz', 'created' => '2016-10-12T19:14:10.802359Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-12T19:50:16.104357Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', 'rawPlatformVersionSpec' => '>=9 <=11', 'signature' => 'nhlT9lhrmBxIsqh/e3RLm2NDw/U8ZvvoMyYQTLMM3H19DQmVcPYPYC9QWVTsowUzXblVaOXVGylbpKma9yOlOAqJtF3qyXecLl4+tA/Awb6BBhKPgHFdcLDAL5yy1K7/uei3SgEojMlJoI9vEK5I1C5YTh43yNH+//Im6MAuNYFUTlMXK426zdOe6ogpCI5GlYdXopqYANxcpT+WXWET6DDSM5Ev+MYwMcSAY4r8+tvARRU4ZAenRgjkBT6R5z6cD76emRax14tbV6vkjjwRcO+dQtM0tFPbd+5fsNInbauv50VzIMgjA6RnKTOI17gRsSdGlsV4vZn2aIxEPWauu6T/UohMvAE9HMn13vtbpPBSFwJAktj6yHASYGzupNQLprA0+OdyALoLZPpQAKNEXA42a4EVISBKu0EmduHJlUPeqhnIGkkGgVNWS8AWqzP2nFoPdXBgUWateiMcBTHxgEKDac5YmNc9lsXpzf1OxBaXHBhGYKuXPwIfyH3jTWb1OdwixJEuRe9dl63T9qOTRre8QWns/bMqKLibGfMtFhVB21ARJayBuX70eVvabG/2N7Y5t1zUlFygIKu51tvo3AVCRDdRrFWDvkAjxzIz5FIdALVZ+DReFYu/r4WF/w3V9rInFuEDSwb/OH4r8sQycs07tSlMyA74Y3FpjKTBxso=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://bitgrid.net/~jus/apporder-nc.gif', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'AppOrder', 'summary' => 'Sort apps in the menu with drag and drop', 'description' => ' @@ -252,18 +252,18 @@ class AppFetcherTest extends TestCase { Users will now get redirected to the first app of the default order or to the first app of the user order. ', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Julius Härtl', 'mail' => 'jus@bitgrid.net', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -292,14 +292,14 @@ class AppFetcherTest extends TestCase { Tu+WGOL2Ee5U4k4XFdzeSLODWby08iU+Gx3bXTR6WIvXCYeIVsCPKK/luvfGkiSR CpW1GUIA1cyulT4uyHf9g6BMdYVOsFQ= -----END CERTIFICATE-----', - ), + ], 2 => - array ( + [ 'id' => 'twofactor_totp', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -308,28 +308,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-08T14:13:54.356716Z', 'lastModified' => '2016-10-12T14:38:56.186269Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.4.1', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0 <7.1.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/ChristophWurst/twofactor_totp/releases/download/0.4.1/twofactor_totp.tar.gz', 'created' => '2016-10-12T14:38:56.174612Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-12T14:38:56.248223Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4 <=7.0', @@ -346,32 +346,32 @@ class AppFetcherTest extends TestCase { Ml2RKcPeutMHHSLiGIN/h7fM5aSs49wGgGZmfz28fHVd7/U0HFSMYmkT/GMq5tMP Iyc+QZAN4qbX8G0k/QSTkK/L4lOT2hQiQqiSqmWItMk=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( - ), + [ + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Two Factor TOTP Provider', 'summary' => 'A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)', 'description' => 'A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Christoph Wurst', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -400,16 +400,16 @@ class AppFetcherTest extends TestCase { VMgQ6yUWNuzOQMZpMIV7RMOUZHvxiX/ZWUFzXNYX0GYub6p4O2uh3LJE+xXyDf77 RBO7PLY3m4TXCeKesxZlkoGke+lnq7B8tkADdPI= -----END CERTIFICATE-----', - ), + ], 3 => - array ( + [ 'id' => 'contacts', 'categories' => - array ( + [ 0 => 'office', 1 => 'organization', 2 => 'social', - ), + ], 'userDocs' => 'https://docs.nextcloud.com/server/11/user_manual/pim/contacts.html', 'adminDocs' => 'https://docs.nextcloud.com/server/11/admin_manual/configuration_server/occ_command.html?highlight=occ%20commands#dav-label', 'developerDocs' => 'https://github.com/nextcloud/contacts#building-the-app', @@ -418,28 +418,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-30T14:00:58.922766Z', 'lastModified' => '2016-11-22T22:08:01.904319Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.5.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/contacts/releases/download/v1.5.0/contacts.tar.gz', 'created' => '2016-11-22T22:08:01.861942Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-22T22:08:02.306939Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -456,48 +456,48 @@ class AppFetcherTest extends TestCase { BKLUd0dSfQUQzkfwcojImbzJRvca4/DYe3mfG7+RCH0tDL6t72dKL9joB++u5R1u VZPgkToexlXcKWpiDB8H2/SEShKr4udAOjR5de9CYWM=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/screenshots/master/apps/Contacts/contacts.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Contacts', 'summary' => 'The new and improved app for your Contacts.', 'description' => 'The new and improved app for your Contacts.', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Alexander Weidinger', 'mail' => '', 'homepage' => '', - ), + ], 1 => - array ( + [ 'name' => 'Jan-Christoph Borchardt', 'mail' => '', 'homepage' => '', - ), + ], 2 => - array ( + [ 'name' => 'Hendrik Leppelsack', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -526,14 +526,14 @@ class AppFetcherTest extends TestCase { Gld7yCP47xNPaAZEC66odcClvNtJ2Clgp8739jD6uJJCqcKDejeef0VU1PG7AXId 52bVrGMxJwOuL1393vKxGH0PHDzcB1M= -----END CERTIFICATE-----', - ), + ], 4 => - array ( + [ 'id' => 'mail', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => 'https://github.com/nextcloud/mail#readme', 'developerDocs' => '', @@ -542,28 +542,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-19T19:41:41.710285Z', 'lastModified' => '2016-10-19T19:57:33.689238Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.6.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0 <7.1.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/mail/releases/download/v0.6.0/mail.tar.gz', 'created' => '2016-10-19T19:57:33.676730Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-19T19:57:33.834580Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4 <=7.0', @@ -580,9 +580,9 @@ class AppFetcherTest extends TestCase { WF3WSqF/K/tTnPYTWb9NUPSihTbVNv6AXOfTsPEp/ba2YSS5DjvjVjkr5vhR9eg1 ikQ3Cw6lW3vaA4LVCC+hFkMRnI4N0bo5qQavP3PnZPc=', 'translations' => - array ( + [ 'en' => - array ( + [ 'changelog' => '### Added - Alias support [#1523](https://github.com/owncloud/mail/pull/1523) @tahaalibra @@ -616,32 +616,32 @@ class AppFetcherTest extends TestCase { [#1603](https://github.com/owncloud/mail/pull/1603) @ChristophWurst - Update folder counters when reading/deleting messages [#1585](https://github.com/owncloud/mail/pull/1585)', - ), - ), - ), - ), + ], + ], + ], + ], 'screenshots' => - array ( - ), + [ + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Mail', 'summary' => 'Easy to use email client which connects to your mail server via IMAP and SMTP.', 'description' => 'Easy to use email client which connects to your mail server via IMAP and SMTP.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Christoph Wurst, Thomas Müller, Jan-Christoph Borchardt, Steffen Lindner & many more …', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -670,14 +670,14 @@ class AppFetcherTest extends TestCase { xRS4JXbapjolkxyGSpP+iYSgItVnYzl6o9KZResR4yDsBv7G/8fpV4GQU9IS3zLD PiZOosVHWJdpUKCw9V4P1prGTQ== -----END CERTIFICATE-----', - ), + ], 5 => - array ( + [ 'id' => 'audioplayer', 'categories' => - array ( + [ 0 => 'multimedia', - ), + ], 'userDocs' => 'https://github.com/rello/audioplayer/wiki#user-documentation', 'adminDocs' => 'https://github.com/rello/audioplayer/wiki#admin-documentation', 'developerDocs' => '', @@ -686,78 +686,78 @@ class AppFetcherTest extends TestCase { 'created' => '2016-09-16T05:44:24.857567Z', 'lastModified' => '2016-11-17T22:34:34.637028Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.3.1', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/Rello/audioplayer/releases/download/1.3.1/audioplayer-1.3.1.tar.gz', 'created' => '2016-11-17T22:34:34.215350Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-17T22:34:34.867778Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4', 'rawPlatformVersionSpec' => '>=9 <=11', 'signature' => 'p6Zz0IEFrxvw6y/3jHgGWWCxR6qpMzvU2HKfxcIVsK6sJnoRUhWLeAXwZ432fH2a S2llj+IGS9OvW+5VQElrXgPtEjDK1BT00DRJnp5RFCRlUv0LNoedJMzx6B6AHqPP JBufk3cG1O/CO0M0L1ITGSmSOzfKvWTRo3lxVGF792NyBaP/SyZCkH1N1TzBQzUi Ywl3+HiglPcXbHjtJm/arnKorbJWVKoaN93xFuaBapd2ozQSpi0fE0uGRsici+U7 HNa1M5WFE1rzUJoufE0E9246At07rFY1e+TdNEq8IlLgCXg5vGCKkEyuWpWno6aX LfRaIiT9x39UTAwNvuDKS0c+n4uWDYPsGfKhDx9N7CXpUrthfXVEWRzZEXG7as10 6ANvrRPJemSZH8FUSrdJhD7k12qa9R825y7mIG68Li8P71V92EOxFfo9tNXqXwBt VuDGxBqByFVPqSCj5I8hrzJzQl2Xt40g8+8ZcSF96RMg/pM+bwRMTv+mz0V+vQQ4 DWjqnWVPalaJ1PPD5/QFFErtXuNRbyxKZ6BMWxfJlLM9Kz66P75K+8fYaSwz+2KG NxY7I3svzS2K9LGH3fBLUy1t3Hl+c3zGFq/ll1MJrf9NswV4yxt2WmISfM/KDww8 yELkGs2cRzbw2tCvnmYlJJhIqRLkyFAbDzWRH/XdVx4=', 'translations' => - array ( + [ 'en' => - array ( + [ 'changelog' => '2016-11-17 - fix: one-click-play for wav not working - fix: wrong sql statement for PostgreSQL [#90](https://github.com/rello/audioplayer/issues/90)', - ), - ), - ), - ), + ], + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://github.com/rello/screenshots/raw/master/audioplayer_main.png', - ), + ], 1 => - array ( + [ 'url' => 'https://github.com/rello/screenshots/raw/master/audioplayer_lists.png', - ), + ], 2 => - array ( + [ 'url' => 'https://github.com/rello/screenshots/raw/master/audioplayer_share.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Audio Player', 'summary' => 'Audio Player for ownCloud and Nextcloud', 'description' => 'Audio Player for MP3, MP4, Ogg, and Wave with a lot of flexibility for all your needs.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Marcel Scherello', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -786,14 +786,14 @@ class AppFetcherTest extends TestCase { FNvGFVBn4r5qCiChEoq+rCXHRjPi/eCfbW21XeLFDiLxapcZyc85JIcA7znUYoFe P7Y/ekMscwWhLbF91OaQlcWpRtEMyde/DaI= -----END CERTIFICATE-----', - ), + ], 6 => - array ( + [ 'id' => 'calendar', 'categories' => - array ( + [ 0 => 'organization', - ), + ], 'userDocs' => 'https://docs.nextcloud.com/server/10/user_manual/pim/calendar.html', 'adminDocs' => '', 'developerDocs' => '', @@ -802,28 +802,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-01T12:40:39.060903Z', 'lastModified' => '2016-11-22T20:31:13.029921Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.4.1', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/calendar/releases/download/v1.4.1/calendar.tar.gz', 'created' => '2016-11-22T20:31:13.020268Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-22T20:31:13.087340Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -840,62 +840,62 @@ class AppFetcherTest extends TestCase { r/ASRiJrkDThbNWAUtX70rUmCqDV6/MujLXViqOc/Q2OHvcXd1oGDccJSQT92/1z 7nonnedyYQIDqUt7u68WL8JRxp7pFsEqKLVuWSgxW3c=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/1.png', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/2.png', - ), + ], 2 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/3.png', - ), + ], 3 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/4.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Calendar', 'summary' => 'Calendar GUI for Nextcloud\'s CalDAV server', 'description' => 'The Nextcloud calendar app is a user interface for Nextcloud\'s CalDAV server. It integrates with other apps, allows you to manage calendars and events, display external calendars and invite attendees to your events', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Georg Ehrke', 'mail' => '', 'homepage' => 'https://georg.coffee', - ), + ], 1 => - array ( + [ 'name' => 'Raghu Nayyar', 'mail' => '', 'homepage' => 'http://raghunayyar.com', - ), + ], 2 => - array ( + [ 'name' => 'Thomas Citharel', 'mail' => '', 'homepage' => 'https://tcit.fr', - ), - ), + ], + ], 'ratingRecent' => 0.94444444444444398, 'ratingOverall' => 0.94444444444444398, 'ratingNumRecent' => 9, @@ -924,14 +924,14 @@ class AppFetcherTest extends TestCase { Q0Bl/QinETk72afGR46Qvc7tC1t9JjQQD3AUbEGuJdGvXjJJ9GREYu01XoODmPdT jXXOI8XIOK6kxXhPHUc3iWu9b4KqGm0= -----END CERTIFICATE-----', - ), + ], 8 => - array ( + [ 'id' => 'ownpad', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => 'https://github.com/otetard/ownpad/blob/master/README.md#mimetype-detection', 'adminDocs' => '', 'developerDocs' => '', @@ -940,28 +940,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-09-29T15:58:52.814912Z', 'lastModified' => '2016-11-19T17:37:52.278497Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.5.6', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/otetard/ownpad/releases/download/v0.5.6/ownpad.tar.gz', 'created' => '2016-11-19T17:37:52.234684Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-19T17:37:52.423930Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -978,17 +978,17 @@ class AppFetcherTest extends TestCase { uRGqyU4BXpZjEC3nVlsC7vCncWWhxl0WZQ/MWKqsfjVAU4I88E518D6NioqMnPEJ iCZ2x+69UCDEQyfCSKajgAYT17r3OhZei8F9KSCH8Vw=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( - ), + [ + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Ownpad', 'summary' => ' Create and open Etherpad and Ethercalc documents. @@ -1000,18 +1000,18 @@ class AppFetcherTest extends TestCase { This application requires to have access to an instance of Etherpad and/or Ethercalc to work properly. ', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Olivier Tétard', 'mail' => 'olivier.tetard@miskin.fr', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1040,14 +1040,14 @@ class AppFetcherTest extends TestCase { EUa2uYht/z475k4+vf0YhV98iQH07GnmlfD2TDZgmOCQGKlNfJh1v88OZyLLa3dz gRHzGwKbAiJ8T8bbpZ3e2ozXxADr -----END CERTIFICATE-----', - ), + ], 9 => - array ( + [ 'id' => 'announcementcenter', 'categories' => - array ( + [ 0 => 'organization', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -1056,28 +1056,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-09-14T10:38:53.939634Z', 'lastModified' => '2016-11-24T11:21:50.324839Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '2.0.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/announcementcenter/releases/download/v2.0.0/announcementcenter-2.0.0.tar.gz', 'created' => '2016-10-06T12:41:56.195206Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-06T12:41:56.263124Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1089,36 +1089,36 @@ class AppFetcherTest extends TestCase { OfQFKEjtsx+bNLa6CkAaocHGHJXAofX3GQZ9cjBsjZqiTfbXfcVk0kRfz7pwL92L I1McfJYvgMxDQG5bjRpNJw==', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://github.com/nextcloud/announcementcenter/raw/stable10/docs/AnnouncementCenterFrontpage.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Announcement Center', 'summary' => 'An announcement center for Nextcloud', 'description' => 'An announcement center for Nextcloud', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Joas Schilling', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.75, 'ratingOverall' => 0.75, 'ratingNumRecent' => 0, @@ -1142,15 +1142,15 @@ class AppFetcherTest extends TestCase { JJoU8LQoHwGRtp3wutk0GlFzpEQEvSsn/Lsvvot5IfIe46tnzA6MVj5s64s5G8+Q phhXFlzXqO/VxquPdbfYjvU= -----END CERTIFICATE-----', - ), + ], 11 => - array ( + [ 'id' => 'rainloop', 'categories' => - array ( + [ 0 => 'social', 1 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -1159,28 +1159,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-20T04:17:37.217555Z', 'lastModified' => '2016-11-18T11:36:04.309739Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '4.26.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/pierre-alain-b/rainloop-nextcloud/releases/download/v4.26.0/rainloop-4.26.0.tar.gz', 'created' => '2016-10-20T04:28:21.491747Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-18T11:36:04.619927Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4', @@ -1197,36 +1197,36 @@ class AppFetcherTest extends TestCase { NOAkku7AMXPvUCHaZP2iVCCoAViEso8GeR3O8xh2G42Ai61RLYwx8LB1+23EoJTr mfFuRYNSg+qAKCokXNnh+lDlwu4AkaQo3vtKGPXvU7A=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/pierre-alain-b/rainloop-nextcloud/master/screenshots/2016.10.20-screenshot.jpg', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'RainLoop', 'summary' => 'RainLoop Webmail', 'description' => 'Simple, modern and fast web-based email client.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'RainLoop Team', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1255,15 +1255,15 @@ class AppFetcherTest extends TestCase { iLYeXQTV0XSRs8xVt+iyGlj7nPkv2DR0oCqRpWUFWeSBI//niDG5WxS3qg8kacSW fDSYhSN+IjrnIkwNtc8V9t7/GeQB5FE= -----END CERTIFICATE-----', - ), + ], 12 => - array ( + [ 'id' => 'richdocuments', 'categories' => - array ( + [ 0 => 'integration', 1 => 'office', - ), + ], 'userDocs' => 'https://nextcloud.com/collaboraonline/', 'adminDocs' => 'https://nextcloud.com/collaboraonline/', 'developerDocs' => '', @@ -1272,28 +1272,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-10-31T08:55:45.631429Z', 'lastModified' => '2016-11-24T12:13:53.905352Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.1.14', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/owncloud/richdocuments/releases/download/1.1.14/richdocuments.tar.gz', 'created' => '2016-11-24T12:10:13.337165Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-24T12:13:53.963638Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1305,48 +1305,48 @@ class AppFetcherTest extends TestCase { WgtxRJmvGaNiFzYq+kQmdKMfayZTm3kdVgP0W52t5wp878K0i4s2KPg5lANvjTz7 DCT+VV2IGIE52o4RpMUGyQ==', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-document.png', - ), + ], 1 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-app.png', - ), + ], 2 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-presentation.png', - ), + ], 3 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-spreadsheet.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Collabora Online', 'summary' => 'Edit office documents directly in your browser.', 'description' => 'Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1370,15 +1370,15 @@ class AppFetcherTest extends TestCase { myBOrjhrJgLIwvgH26MYZhdiSkFzoE38nMPZdrUmUDxcPCwucWJqgzDPudguFthj WCVZ3TTG/2z3+tWM -----END CERTIFICATE-----', - ), + ], 13 => - array ( + [ 'id' => 'ocr', 'categories' => - array ( + [ 0 => 'files', 1 => 'tools', - ), + ], 'userDocs' => 'https://janis91.github.io/ocr/', 'adminDocs' => 'https://github.com/janis91/ocr/wiki', 'developerDocs' => 'https://github.com/janis91/ocr/wiki', @@ -1387,48 +1387,48 @@ class AppFetcherTest extends TestCase { 'created' => '2016-09-19T12:07:49.220376Z', 'lastModified' => '2016-11-21T11:22:21.024501Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.0.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( + [ 0 => - array ( + [ 'id' => 'pgsql', 'versionSpec' => '*', 'rawVersionSpec' => '*', - ), + ], 1 => - array ( + [ 'id' => 'mysql', 'versionSpec' => '*', 'rawVersionSpec' => '*', - ), + ], 2 => - array ( + [ 'id' => 'sqlite', 'versionSpec' => '*', 'rawVersionSpec' => '*', - ), - ), + ], + ], 'shellCommands' => - array ( + [ 0 => 'ocrmypdf', 1 => 'tesseract', - ), + ], 'phpVersionSpec' => '>=5.6.0 <8.0.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/janis91/ocr/releases/download/v1.0.0/ocr.tar.gz', 'created' => '2016-10-24T06:50:43.283900Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-21T11:22:21.269108Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.6 <=7', @@ -1445,29 +1445,29 @@ class AppFetcherTest extends TestCase { v05SzlQRnBWM4jYBe0mA/2ds9AO6VrXGrT/iLlHemj6JYoGBM185TGewA7OJyX3a HSlSDqaremmi+aS3onx3AKhXykDxTRkMVarePwTzzFs=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc1.png', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc2.png', - ), + ], 2 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc3.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'OCR', 'summary' => 'Character recoginition for your images and pdf files.', 'description' => '# Description @@ -1488,9 +1488,9 @@ class AppFetcherTest extends TestCase { - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 with corresponding language files (e.g. tesseract-ocr-eng) For further information see the homepage or the appropriate documentation.', - ), + ], 'de' => - array ( + [ 'name' => 'OCR', 'summary' => 'Schrifterkennung für Bilder (mit Text) und PDF Dateien.', 'description' => '# Beschreibung @@ -1511,18 +1511,18 @@ class AppFetcherTest extends TestCase { - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 mit den dazugehörigen Übersetzungs- und Sprachdateien (z. B. tesseract-ocr-deu) Für weiter Informationen besuchen Sie die Homepage oder lesen Sie die zutreffende Dokumentation.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Janis Koehr', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1551,14 +1551,14 @@ class AppFetcherTest extends TestCase { yA1z/MCBEyTRo80jxFmL+MpwbsdbUJi7Qxlnd56zb6HHDGrLHXZTh9LXgyVbnhWL kxomWjIXQh4aMHQL4QF7U4EK -----END CERTIFICATE-----', - ), + ], 14 => - array ( + [ 'id' => 'spreedme', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => 'https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md', 'adminDocs' => 'https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md', 'developerDocs' => '', @@ -1567,28 +1567,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-09-27T08:43:07.835196Z', 'lastModified' => '2016-11-21T16:51:23.703819Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.3.4', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz', 'created' => '2016-11-21T16:51:23.689599Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-21T16:51:23.826509Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1605,48 +1605,48 @@ class AppFetcherTest extends TestCase { 8uNawnFwWkicBEYkN/WtBTouWzehOPn38tHXov6SyEyD6lkuxUBZrsGQ2ru+t33U k0kKCbV0GFw43I+3Ji5DiB4TUVNZYVoPG1B7Qve+UfA=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/conference.gif', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/presentation.png', - ), + ], 2 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/import.png', - ), + ], 3 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/users.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Spreed.ME', 'summary' => 'Audio-, video- and text chat for your Nextcloud', 'description' => 'Securely communicate with your friends and family using rich audio-, video- and text chat, and much more right from your Nextcloud – in your browser', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'struktur AG', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1675,15 +1675,15 @@ class AppFetcherTest extends TestCase { sUNUEU2Decyp0jxLVnrrpz6Y5UupfBR0V8yAv1t5Od/mCKLc5DxHsDWiKOpsob9U JN+bdzJil2NNftihD4Dm7Ha7OS3O8W0= -----END CERTIFICATE-----', - ), + ], 15 => - array ( + [ 'id' => 'nextant', 'categories' => - array ( + [ 0 => 'files', 1 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => 'https://github.com/nextcloud/nextant/wiki', 'developerDocs' => '', @@ -1692,28 +1692,28 @@ class AppFetcherTest extends TestCase { 'created' => '2016-09-14T14:34:35.977699Z', 'lastModified' => '2016-11-22T16:02:57.758477Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.6.6', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/nextant/releases/download/v0.6.6/nextant-0.6.6.tar.gz', 'created' => '2016-11-16T15:11:14.344704Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-16T20:39:59.030384Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1730,25 +1730,25 @@ class AppFetcherTest extends TestCase { se+kc/a4iB3BoCNX3E942pBBzew4ya8LkCXdCHUUsuelDf1va1ikTh/G7D84ll9/ 2avNqQnUh3hgOnxFCLI/5VrbqxfSTVdO6O/LTuAmwgw=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/displayResult.jpg', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/admin.jpg', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Nextant', 'summary' => 'Navigate through your cloud using Solr', 'description' => ' @@ -1787,18 +1787,18 @@ class AppFetcherTest extends TestCase { ', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Maxence Lange', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1827,12 +1827,12 @@ class AppFetcherTest extends TestCase { 0bfhnvTZ2VhMmK83t7ovo71An4ycmsolGD/MA0vNI78VrVISrdI8rRh2WntUnCBU EJL3BaQAQaASSsvFrcozYxrQG4VzEg== -----END CERTIFICATE-----', - ), - ), + ], + ], 'timestamp' => 1234, 'ncversion' => '11.0.0.2', 'ETag' => '"myETag"', - ); + ]; protected function setUp(): void { diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index 8312bef5b9842..52965d4a72d12 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -64,7 +64,7 @@ protected function setUp(): void { ->getMock(); $this->l10nMock->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = array()) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); }); @@ -80,11 +80,11 @@ protected function setUp(): void { * @param string $intSize */ public function testPhpVersion($expectedMissing, $minVersion, $maxVersion, $intSize) { - $app = array( - 'dependencies' => array( - 'php' => array() - ) - ); + $app = [ + 'dependencies' => [ + 'php' => [] + ] + ]; if (!is_null($minVersion)) { $app['dependencies']['php']['@attributes']['min-version'] = $minVersion; } @@ -126,10 +126,10 @@ public function testDatabases($expectedMissing, $databases) { * @param string|null $commands */ public function testCommand($expectedMissing, $commands) { - $app = array( - 'dependencies' => array( - ) - ); + $app = [ + 'dependencies' => [ + ] + ]; if (!is_null($commands)) { $app['dependencies']['command'] = $commands; } @@ -145,10 +145,10 @@ public function testCommand($expectedMissing, $commands) { * @param $libs */ function testLibs($expectedMissing, $libs) { - $app = array( - 'dependencies' => array( - ) - ); + $app = [ + 'dependencies' => [ + ] + ]; if (!is_null($libs)) { $app['dependencies']['lib'] = $libs; } @@ -165,9 +165,9 @@ function testLibs($expectedMissing, $libs) { * @param $oss */ function testOS($expectedMissing, $oss) { - $app = array( - 'dependencies' => array() - ); + $app = [ + 'dependencies' => [] + ]; if (!is_null($oss)) { $app['dependencies']['os'] = $oss; } @@ -184,9 +184,9 @@ function testOS($expectedMissing, $oss) { * @param $oc */ function testOC($expectedMissing, $oc) { - $app = array( - 'dependencies' => array() - ); + $app = [ + 'dependencies' => [] + ]; if (!is_null($oc)) { $app['dependencies'] = $oc; } @@ -429,12 +429,12 @@ function providesOC() { * @return array */ function providesOS() { - return array( - array(array(), null), - array(array(), array()), - array(array('Following platforms are supported: ANDROID'), 'ANDROID'), - array(array('Following platforms are supported: WINNT'), array('WINNT')) - ); + return [ + [[], null], + [[], []], + [['Following platforms are supported: ANDROID'], 'ANDROID'], + [['Following platforms are supported: WINNT'], ['WINNT']] + ]; } /** @@ -489,28 +489,28 @@ function providesCommands() { * @return array */ function providesDatabases() { - return array( + return [ // non BC - in case on databases are defined -> all are supported - array(array(), null), - array(array(), array()), - array(array('Following databases are supported: mongodb'), 'mongodb'), - array(array('Following databases are supported: sqlite, postgres'), array('sqlite', array('@value' => 'postgres'))), - ); + [[], null], + [[], []], + [['Following databases are supported: mongodb'], 'mongodb'], + [['Following databases are supported: sqlite, postgres'], ['sqlite', ['@value' => 'postgres']]], + ]; } /** * @return array */ function providesPhpVersion() { - return array( - array(array(), null, null, null), - array(array(), '5.4', null, null), - array(array(), null, '5.5', null), - array(array(), '5.4', '5.5', null), - array(array('PHP 5.4.4 or higher is required.'), '5.4.4', null, null), - array(array('PHP with a version lower than 5.4.2 is required.'), null, '5.4.2', null), - array(array('64bit or higher PHP required.'), null, null, 64), - array(array(), '5.4', '5.4', null), - ); + return [ + [[], null, null, null], + [[], '5.4', null, null], + [[], null, '5.5', null], + [[], '5.4', '5.5', null], + [['PHP 5.4.4 or higher is required.'], '5.4.4', null, null], + [['PHP with a version lower than 5.4.2 is required.'], null, '5.4.2', null], + [['64bit or higher PHP required.'], null, null, 64], + [[], '5.4', '5.4', null], + ]; } } diff --git a/tests/lib/App/PlatformRepositoryTest.php b/tests/lib/App/PlatformRepositoryTest.php index 783f8f473ffbe..555247f7ddaa1 100644 --- a/tests/lib/App/PlatformRepositoryTest.php +++ b/tests/lib/App/PlatformRepositoryTest.php @@ -25,41 +25,41 @@ public function testVersion($input, $expected) { } public function providesVersions() { - return array( - 'none' => array('1.0.0', '1.0.0.0'), - 'none/2' => array('1.2.3.4', '1.2.3.4'), - 'parses state' => array('1.0.0RC1dev', '1.0.0.0-RC1-dev'), - 'CI parsing' => array('1.0.0-rC15-dev', '1.0.0.0-RC15-dev'), - 'delimiters' => array('1.0.0.RC.15-dev', '1.0.0.0-RC15-dev'), - 'RC uppercase' => array('1.0.0-rc1', '1.0.0.0-RC1'), - 'patch replace' => array('1.0.0.pl3-dev', '1.0.0.0-patch3-dev'), - 'forces w.x.y.z' => array('1.0-dev', '1.0.0.0-dev'), - 'forces w.x.y.z/2' => array('0', '0.0.0.0'), - 'parses long' => array('10.4.13-beta', '10.4.13.0-beta'), - 'parses long/2' => array('10.4.13beta2', '10.4.13.0-beta2'), - 'parses long/semver' => array('10.4.13beta.2', '10.4.13.0-beta2'), - 'expand shorthand' => array('10.4.13-b', '10.4.13.0-beta'), - 'expand shorthand2' => array('10.4.13-b5', '10.4.13.0-beta5'), - 'strips leading v' => array('v1.0.0', '1.0.0.0'), - 'strips v/datetime' => array('v20100102', '20100102'), - 'parses dates y-m' => array('2010.01', '2010-01'), - 'parses dates w/ .' => array('2010.01.02', '2010-01-02'), - 'parses dates w/ -' => array('2010-01-02', '2010-01-02'), - 'parses numbers' => array('2010-01-02.5', '2010-01-02-5'), - 'parses dates y.m.Y' => array('2010.1.555', '2010.1.555.0'), - 'parses datetime' => array('20100102-203040', '20100102-203040'), - 'parses dt+number' => array('20100102203040-10', '20100102203040-10'), - 'parses dt+patch' => array('20100102-203040-p1', '20100102-203040-patch1'), - 'parses master' => array('dev-master', '9999999-dev'), - 'parses trunk' => array('dev-trunk', '9999999-dev'), + return [ + 'none' => ['1.0.0', '1.0.0.0'], + 'none/2' => ['1.2.3.4', '1.2.3.4'], + 'parses state' => ['1.0.0RC1dev', '1.0.0.0-RC1-dev'], + 'CI parsing' => ['1.0.0-rC15-dev', '1.0.0.0-RC15-dev'], + 'delimiters' => ['1.0.0.RC.15-dev', '1.0.0.0-RC15-dev'], + 'RC uppercase' => ['1.0.0-rc1', '1.0.0.0-RC1'], + 'patch replace' => ['1.0.0.pl3-dev', '1.0.0.0-patch3-dev'], + 'forces w.x.y.z' => ['1.0-dev', '1.0.0.0-dev'], + 'forces w.x.y.z/2' => ['0', '0.0.0.0'], + 'parses long' => ['10.4.13-beta', '10.4.13.0-beta'], + 'parses long/2' => ['10.4.13beta2', '10.4.13.0-beta2'], + 'parses long/semver' => ['10.4.13beta.2', '10.4.13.0-beta2'], + 'expand shorthand' => ['10.4.13-b', '10.4.13.0-beta'], + 'expand shorthand2' => ['10.4.13-b5', '10.4.13.0-beta5'], + 'strips leading v' => ['v1.0.0', '1.0.0.0'], + 'strips v/datetime' => ['v20100102', '20100102'], + 'parses dates y-m' => ['2010.01', '2010-01'], + 'parses dates w/ .' => ['2010.01.02', '2010-01-02'], + 'parses dates w/ -' => ['2010-01-02', '2010-01-02'], + 'parses numbers' => ['2010-01-02.5', '2010-01-02-5'], + 'parses dates y.m.Y' => ['2010.1.555', '2010.1.555.0'], + 'parses datetime' => ['20100102-203040', '20100102-203040'], + 'parses dt+number' => ['20100102203040-10', '20100102203040-10'], + 'parses dt+patch' => ['20100102-203040-p1', '20100102-203040-patch1'], + 'parses master' => ['dev-master', '9999999-dev'], + 'parses trunk' => ['dev-trunk', '9999999-dev'], // 'parses branches' => array('1.x-dev', '1.9999999.9999999.9999999-dev'), - 'parses arbitrary' => array('dev-feature-foo', 'dev-feature-foo'), - 'parses arbitrary2' => array('DEV-FOOBAR', 'dev-FOOBAR'), - 'parses arbitrary3' => array('dev-feature/foo', 'dev-feature/foo'), - 'ignores aliases' => array('dev-master as 1.0.0', '9999999-dev'), + 'parses arbitrary' => ['dev-feature-foo', 'dev-feature-foo'], + 'parses arbitrary2' => ['DEV-FOOBAR', 'dev-FOOBAR'], + 'parses arbitrary3' => ['dev-feature/foo', 'dev-feature/foo'], + 'ignores aliases' => ['dev-master as 1.0.0', '9999999-dev'], // 'semver metadata' => array('dev-master+foo.bar', '9999999-dev'), // 'semver metadata/2' => array('1.0.0-beta.5+foo', '1.0.0.0-beta5'), // 'semver metadata/3' => array('1.0.0+foo', '1.0.0.0'), // 'metadata w/ alias' => array('1.0.0+foo as 2.0', '1.0.0.0'), - ); + ]; }} diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index 3fb18979b8a84..fd83b6feae5c2 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -30,7 +30,7 @@ use OCP\AppFramework\Http\Response; function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { rrmdir($directory . '/' . $file); @@ -59,12 +59,12 @@ class AppTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', array()); + $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', []); $this->controller = $this->createMock(Controller::class); $this->dispatcher = $this->createMock(Dispatcher::class); $this->io = $this->createMock(Http\IOutput::class); - $this->headers = array('key' => 'value'); + $this->headers = ['key' => 'value']; $this->output = 'hi'; $this->controllerName = 'Controller'; $this->controllerMethod = 'method'; @@ -72,7 +72,7 @@ protected function setUp(): void { $this->container[$this->controllerName] = $this->controller; $this->container['Dispatcher'] = $this->dispatcher; $this->container['OCP\\AppFramework\\Http\\IOutput'] = $this->io; - $this->container['urlParams'] = array(); + $this->container['urlParams'] = []; $this->appPath = __DIR__ . '/../../../apps/namespacetestapp'; $infoXmlPath = $this->appPath . '/appinfo/info.xml'; diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index 23ebe6ec98472..675d4b7ccec29 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -41,7 +41,7 @@ public function __construct($appName, $request) { public function custom($in) { $this->registerResponder('json', function ($response) { - return new JSONResponse(array(strlen($response))); + return new JSONResponse([strlen($response)]); }); return $in; @@ -103,9 +103,9 @@ public function testFormatResonseInvalidFormat() { public function testFormat() { - $response = $this->controller->buildResponse(array('hi'), 'json'); + $response = $this->controller->buildResponse(['hi'], 'json'); - $this->assertEquals(array('hi'), $response->getData()); + $this->assertEquals(['hi'], $response->getData()); } @@ -118,10 +118,10 @@ public function testFormatDataResponseJSON() { 'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'", ]; - $response = $this->controller->customDataResponse(array('hi')); + $response = $this->controller->customDataResponse(['hi']); $response = $this->controller->buildResponse($response, 'json'); - $this->assertEquals(array('hi'), $response->getData()); + $this->assertEquals(['hi'], $response->getData()); $this->assertEquals(300, $response->getStatus()); $this->assertEquals($expectedHeaders, $response->getHeaders()); } @@ -131,7 +131,7 @@ public function testCustomFormatter() { $response = $this->controller->custom('hi'); $response = $this->controller->buildResponse($response, 'json'); - $this->assertEquals(array(2), $response->getData()); + $this->assertEquals([2], $response->getData()); } diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php index c8ebda55a8683..43770eba17a5a 100644 --- a/tests/lib/AppFramework/Db/EntityTest.php +++ b/tests/lib/AppFramework/Db/EntityTest.php @@ -77,15 +77,15 @@ public function testResetUpdatedFields(){ $entity->setId(3); $entity->resetUpdatedFields(); - $this->assertEquals(array(), $entity->getUpdatedFields()); + $this->assertEquals([], $entity->getUpdatedFields()); } public function testFromRow(){ - $row = array( + $row = [ 'pre_name' => 'john', 'email' => 'john@something.com' - ); + ]; $this->entity = TestEntity::fromRow($row); $this->assertEquals($row['pre_name'], $this->entity->getPreName()); @@ -153,7 +153,7 @@ public function testSetterShouldFailIfAttributeNotDefined(){ public function testFromRowShouldNotAssignEmptyArray(){ - $row = array(); + $row = []; $entity2 = new TestEntity(); $this->entity = TestEntity::fromRow($row); @@ -162,7 +162,7 @@ public function testFromRowShouldNotAssignEmptyArray(){ public function testIdGetsConvertedToInt(){ - $row = array('id' => '4'); + $row = ['id' => '4']; $this->entity = TestEntity::fromRow($row); $this->assertSame(4, $this->entity->getId()); @@ -170,7 +170,7 @@ public function testIdGetsConvertedToInt(){ public function testSetType(){ - $row = array('testId' => '4'); + $row = ['testId' => '4']; $this->entity = TestEntity::fromRow($row); $this->assertSame(4, $this->entity->getTestId()); @@ -178,10 +178,10 @@ public function testSetType(){ public function testFromParams(){ - $params = array( + $params = [ 'testId' => 4, 'email' => 'john@doe' - ); + ]; $entity = TestEntity::fromParams($params); @@ -215,12 +215,12 @@ public function testSetterDoesNotCastOnNull() { public function testGetFieldTypes() { $entity = new TestEntity(); - $this->assertEquals(array( + $this->assertEquals([ 'id' => 'integer', 'testId' => 'integer', 'trueOrFalse' => 'bool', 'anotherBool' => 'boolean', - ), $entity->getFieldTypes()); + ], $entity->getFieldTypes()); } diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php index 67d88c879a3b8..79a9a1884e0b5 100644 --- a/tests/lib/AppFramework/Db/MapperTest.php +++ b/tests/lib/AppFramework/Db/MapperTest.php @@ -73,28 +73,28 @@ public function testMapperShouldSetTableName(){ public function testFindQuery(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('hi') - ); + $params = ['jo']; + $rows = [ + ['hi'] + ]; $this->setMapperResult($sql, $params, $rows); $this->mapper->find($sql, $params); } public function testFindEntity(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('pre_name' => 'hi') - ); + $params = ['jo']; + $rows = [ + ['pre_name' => 'hi'] + ]; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->mapper->findOneEntity($sql, $params); } public function testFindNotFound(){ $sql = 'hi'; - $params = array('jo'); - $rows = array(); + $params = ['jo']; + $rows = []; $this->setMapperResult($sql, $params, $rows); $this->expectException(DoesNotExistException::class); $this->mapper->find($sql, $params); @@ -102,8 +102,8 @@ public function testFindNotFound(){ public function testFindEntityNotFound(){ $sql = 'hi'; - $params = array('jo'); - $rows = array(); + $params = ['jo']; + $rows = []; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->expectException(DoesNotExistException::class); $this->mapper->findOneEntity($sql, $params); @@ -111,10 +111,10 @@ public function testFindEntityNotFound(){ public function testFindMultiple(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('jo'), array('ho') - ); + $params = ['jo']; + $rows = [ + ['jo'], ['ho'] + ]; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->expectException(MultipleObjectsReturnedException::class); $this->mapper->find($sql, $params); @@ -122,10 +122,10 @@ public function testFindMultiple(){ public function testFindEntityMultiple(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('jo'), array('ho') - ); + $params = ['jo']; + $rows = [ + ['jo'], ['ho'] + ]; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->expectException(MultipleObjectsReturnedException::class); $this->mapper->findOneEntity($sql, $params); @@ -134,7 +134,7 @@ public function testFindEntityMultiple(){ public function testDelete(){ $sql = 'DELETE FROM `*PREFIX*table` WHERE `id` = ?'; - $params = array(2); + $params = [2]; $this->setMapperResult($sql, $params, [], null, null, true); $entity = new Example(); @@ -153,7 +153,7 @@ public function testCreate(){ $sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' . 'VALUES(?,?)'; - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -173,7 +173,7 @@ public function testCreateShouldReturnItemWithCorrectInsertId(){ $sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' . 'VALUES(?,?)'; - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -202,7 +202,7 @@ public function testUpdate(){ '`email` = ? ' . 'WHERE `id` = ?'; - $params = array('john', 'my@email', 1); + $params = ['john', 'my@email', 1]; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -215,7 +215,7 @@ public function testUpdate(){ public function testUpdateNoId(){ - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -227,7 +227,7 @@ public function testUpdateNoId(){ public function testUpdateNothingChangedNoQuery(){ - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setId(3); $entity->setEmail($params[1]); @@ -241,7 +241,7 @@ public function testUpdateNothingChangedNoQuery(){ public function testMapRowToEntity(){ - $entity1 = $this->mapper->mapRow(array('pre_name' => 'test1', 'email' => 'test2')); + $entity1 = $this->mapper->mapRow(['pre_name' => 'test1', 'email' => 'test2']); $entity2 = new Example(); $entity2->setPreName('test1'); $entity2->setEmail('test2'); @@ -251,38 +251,38 @@ public function testMapRowToEntity(){ public function testFindEntities(){ $sql = 'hi'; - $rows = array( - array('pre_name' => 'hi') - ); + $rows = [ + ['pre_name' => 'hi'] + ]; $entity = new Example(); $entity->setPreName('hi'); $entity->resetUpdatedFields(); - $this->setMapperResult($sql, array(), $rows, null, null, true); + $this->setMapperResult($sql, [], $rows, null, null, true); $result = $this->mapper->findAllEntities($sql); - $this->assertEquals(array($entity), $result); + $this->assertEquals([$entity], $result); } public function testFindEntitiesNotFound(){ $sql = 'hi'; - $rows = array(); - $this->setMapperResult($sql, array(), $rows); + $rows = []; + $this->setMapperResult($sql, [], $rows); $result = $this->mapper->findAllEntities($sql); - $this->assertEquals(array(), $result); + $this->assertEquals([], $result); } public function testFindEntitiesMultiple(){ $sql = 'hi'; - $rows = array( - array('pre_name' => 'jo'), array('email' => 'ho') - ); + $rows = [ + ['pre_name' => 'jo'], ['email' => 'ho'] + ]; $entity1 = new Example(); $entity1->setPreName('jo'); $entity1->resetUpdatedFields(); $entity2 = new Example(); $entity2->setEmail('ho'); $entity2->resetUpdatedFields(); - $this->setMapperResult($sql, array(), $rows); + $this->setMapperResult($sql, [], $rows); $result = $this->mapper->findAllEntities($sql); - $this->assertEquals(array($entity1, $entity2), $result); + $this->assertEquals([$entity1, $entity2], $result); } } diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php index cddf015cbea90..11905a9bbbb2e 100644 --- a/tests/lib/AppFramework/Db/MapperTestUtility.php +++ b/tests/lib/AppFramework/Db/MapperTestUtility.php @@ -89,7 +89,7 @@ private function getPDOType($value) { * of the database query. If not provided, it wont be assumed that fetch * will be called on the result */ - protected function setMapperResult($sql, $arguments=array(), $returnRows=array(), + protected function setMapperResult($sql, $arguments=[], $returnRows=[], $limit=null, $offset=null, $expectClose=false){ if($limit === null && $offset === null) { $this->db->expects($this->at($this->prepareAt)) diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php index b629c6d385ea9..7af11807d87a4 100644 --- a/tests/lib/AppFramework/Http/DataResponseTest.php +++ b/tests/lib/AppFramework/Http/DataResponseTest.php @@ -41,15 +41,15 @@ protected function setUp(): void { public function testSetData() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->response->setData($params); - $this->assertEquals(array('hi', 'yo'), $this->response->getData()); + $this->assertEquals(['hi', 'yo'], $this->response->getData()); } public function testConstructorAllowsToSetData() { - $data = array('hi'); + $data = ['hi']; $code = 300; $response = new DataResponse($data, $code); @@ -59,9 +59,9 @@ public function testConstructorAllowsToSetData() { public function testConstructorAllowsToSetHeaders() { - $data = array('hi'); + $data = ['hi']; $code = 300; - $headers = array('test' => 'something'); + $headers = ['test' => 'something']; $response = new DataResponse($data, $code, $headers); $expectedHeaders = [ @@ -78,12 +78,12 @@ public function testConstructorAllowsToSetHeaders() { public function testChainability() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->response->setData($params) ->setStatus(Http::STATUS_NOT_FOUND); $this->assertEquals(Http::STATUS_NOT_FOUND, $this->response->getStatus()); - $this->assertEquals(array('hi', 'yo'), $this->response->getData()); + $this->assertEquals(['hi', 'yo'], $this->response->getData()); } diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 494f19a6d24ab..b6b43d4a5d38c 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -52,9 +52,9 @@ public function __construct($appName, $request) { */ public function exec($int, $bool, $test=4, $test2=1) { $this->registerResponder('text', function($in) { - return new JSONResponse(array('text' => $in)); + return new JSONResponse(['text' => $in]); }); - return array($int, $bool, $test, $test2); + return [$int, $bool, $test, $test2]; } @@ -66,9 +66,9 @@ public function exec($int, $bool, $test=4, $test2=1) { * @return DataResponse */ public function execDataResponse($int, $bool, $test=4, $test2=1) { - return new DataResponse(array( - 'text' => array($int, $bool, $test, $test2) - )); + return new DataResponse([ + 'text' => [$int, $bool, $test, $test2] + ]); } } @@ -140,7 +140,7 @@ protected function setUp(): void { * @param string $httpHeaders */ private function setMiddlewareExpectations($out=null, - $httpHeaders=null, $responseHeaders=array(), + $httpHeaders=null, $responseHeaders=[], $ex=false, $catchEx=true) { if($ex) { @@ -226,7 +226,7 @@ public function testDispatcherReturnsArrayWith2Entries() { $response = $this->dispatcher->dispatch($this->controller, $this->controllerMethod); $this->assertNull($response[0]); - $this->assertEquals(array(), $response[1]); + $this->assertEquals([], $response[1]); $this->assertNull($response[2]); } @@ -234,7 +234,7 @@ public function testDispatcherReturnsArrayWith2Entries() { public function testHeadersAndOutputAreReturned(){ $out = 'yo'; $httpHeaders = 'Http'; - $responseHeaders = array('hell' => 'yeah'); + $responseHeaders = ['hell' => 'yeah']; $this->setMiddlewareExpectations($out, $httpHeaders, $responseHeaders); $response = $this->dispatcher->dispatch($this->controller, @@ -249,7 +249,7 @@ public function testHeadersAndOutputAreReturned(){ public function testExceptionCallsAfterException() { $out = 'yo'; $httpHeaders = 'Http'; - $responseHeaders = array('hell' => 'yeah'); + $responseHeaders = ['hell' => 'yeah']; $this->setMiddlewareExpectations($out, $httpHeaders, $responseHeaders, true); $response = $this->dispatcher->dispatch($this->controller, diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php index 79c03ce1ab063..14097a2a58150 100644 --- a/tests/lib/AppFramework/Http/HttpTest.php +++ b/tests/lib/AppFramework/Http/HttpTest.php @@ -37,7 +37,7 @@ class HttpTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->server = array(); + $this->server = []; $this->http = new Http($this->server); } @@ -56,7 +56,7 @@ public function testProtocol10() { public function testEtagMatchReturnsNotModified() { - $http = new Http(array('HTTP_IF_NONE_MATCH' => 'hi')); + $http = new Http(['HTTP_IF_NONE_MATCH' => 'hi']); $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); $this->assertEquals('HTTP/1.1 304 Not Modified', $header); @@ -64,7 +64,7 @@ public function testEtagMatchReturnsNotModified() { public function testQuotedEtagMatchReturnsNotModified() { - $http = new Http(array('HTTP_IF_NONE_MATCH' => '"hi"')); + $http = new Http(['HTTP_IF_NONE_MATCH' => '"hi"']); $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); $this->assertEquals('HTTP/1.1 304 Not Modified', $header); @@ -76,8 +76,8 @@ public function testLastModifiedMatchReturnsNotModified() { $dateTime->setTimestamp('12'); $http = new Http( - array( - 'HTTP_IF_MODIFIED_SINCE' => 'Thu, 01 Jan 1970 00:00:12 +0000') + [ + 'HTTP_IF_MODIFIED_SINCE' => 'Thu, 01 Jan 1970 00:00:12 +0000'] ); $header = $http->getStatusHeader(Http::STATUS_OK, $dateTime); @@ -87,7 +87,7 @@ public function testLastModifiedMatchReturnsNotModified() { public function testTempRedirectBecomesFoundInHttp10() { - $http = new Http(array(), 'HTTP/1.0'); + $http = new Http([], 'HTTP/1.0'); $header = $http->getStatusHeader(Http::STATUS_TEMPORARY_REDIRECT); $this->assertEquals('HTTP/1.0 302 Found', $header); diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php index 95d2e2a0a4c42..2a0978db62a85 100644 --- a/tests/lib/AppFramework/Http/JSONResponseTest.php +++ b/tests/lib/AppFramework/Http/JSONResponseTest.php @@ -49,15 +49,15 @@ public function testHeader() { public function testSetData() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->json->setData($params); - $this->assertEquals(array('hi', 'yo'), $this->json->getData()); + $this->assertEquals(['hi', 'yo'], $this->json->getData()); } public function testSetRender() { - $params = array('test' => 'hi'); + $params = ['test' => 'hi']; $this->json->setData($params); $expected = '{"test":"hi"}'; @@ -100,7 +100,7 @@ public function testRenderWithNonUtf8Encoding() { } public function testConstructorAllowsToSetData() { - $data = array('hi'); + $data = ['hi']; $code = 300; $response = new JSONResponse($data, $code); @@ -110,12 +110,12 @@ public function testConstructorAllowsToSetData() { } public function testChainability() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->json->setData($params) ->setStatus(Http::STATUS_NOT_FOUND); $this->assertEquals(Http::STATUS_NOT_FOUND, $this->json->getStatus()); - $this->assertEquals(array('hi', 'yo'), $this->json->getData()); + $this->assertEquals(['hi', 'yo'], $this->json->getData()); } } diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php index 8f6dffd4e9188..97951ea4b9f95 100644 --- a/tests/lib/AppFramework/Http/RequestStream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -77,7 +77,7 @@ function stream_seek($offset, $whence) { public function stream_stat() { $size = strlen($GLOBALS[$this->varname]); $time = time(); - $data = array( + $data = [ 'dev' => 0, 'ino' => 0, 'mode' => 0777, @@ -91,7 +91,7 @@ public function stream_stat() { 'ctime' => $time, 'blksize' => -1, 'blocks' => -1, - ); + ]; return array_values($data) + $data; //return false; } diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 67fef79dcff4e..8f7c26cc9529f 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -51,10 +51,10 @@ protected function tearDown(): void { } public function testRequestAccessors() { - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET', - ); + ]; $request = new Request( $vars, @@ -82,12 +82,12 @@ public function testRequestAccessors() { // urlParams has precedence over POST which has precedence over GET public function testPrecedence() { - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), - 'post' => array('name' => 'Jane Doe', 'nickname' => 'Janey'), - 'urlParams' => array('user' => 'jw', 'name' => 'Johnny Weissmüller'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], + 'post' => ['name' => 'Jane Doe', 'nickname' => 'Janey'], + 'urlParams' => ['user' => 'jw', 'name' => 'Johnny Weissmüller'], 'method' => 'GET' - ); + ]; $request = new Request( $vars, @@ -107,10 +107,10 @@ public function testPrecedence() { public function testImmutableArrayAccess() { $this->expectException(\RuntimeException::class); - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET' - ); + ]; $request = new Request( $vars, @@ -127,10 +127,10 @@ public function testImmutableArrayAccess() { public function testImmutableMagicAccess() { $this->expectException(\RuntimeException::class); - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET' - ); + ]; $request = new Request( $vars, @@ -147,10 +147,10 @@ public function testImmutableMagicAccess() { public function testGetTheMethodRight() { $this->expectException(\LogicException::class); - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET', - ); + ]; $request = new Request( $vars, @@ -164,10 +164,10 @@ public function testGetTheMethodRight() { } public function testTheMethodIsRight() { - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET', - ); + ]; $request = new Request( $vars, @@ -186,10 +186,10 @@ public function testTheMethodIsRight() { public function testJsonPost() { global $data; $data = '{"name": "John Q. Public", "nickname": "Joey"}'; - $vars = array( + $vars = [ 'method' => 'POST', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8') - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'] + ]; $request = new Request( $vars, @@ -210,10 +210,10 @@ public function testJsonPost() { public function testNotJsonPost() { global $data; $data = 'this is not valid json'; - $vars = array( + $vars = [ 'method' => 'POST', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8') - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'] + ]; $request = new Request( $vars, @@ -230,12 +230,12 @@ public function testNotJsonPost() { public function testPatch() { global $data; - $data = http_build_query(array('name' => 'John Q. Public', 'nickname' => 'Joey'), '', '&'); + $data = http_build_query(['name' => 'John Q. Public', 'nickname' => 'Joey'], '', '&'); - $vars = array( + $vars = [ 'method' => 'PATCH', - 'server' => array('CONTENT_TYPE' => 'application/x-www-form-urlencoded'), - ); + 'server' => ['CONTENT_TYPE' => 'application/x-www-form-urlencoded'], + ]; $request = new Request( $vars, @@ -257,10 +257,10 @@ public function testJsonPatchAndPut() { // PUT content $data = '{"name": "John Q. Public", "nickname": "Joey"}'; - $vars = array( + $vars = [ 'method' => 'PUT', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8'), - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'], + ]; $request = new Request( $vars, @@ -278,10 +278,10 @@ public function testJsonPatchAndPut() { // PATCH content $data = '{"name": "John Q. Public", "nickname": null}'; - $vars = array( + $vars = [ 'method' => 'PATCH', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8'), - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'], + ]; $request = new Request( $vars, @@ -302,14 +302,14 @@ public function testPutStream() { global $data; $data = file_get_contents(__DIR__ . '/../../../data/testimage.png'); - $vars = array( + $vars = [ 'put' => $data, 'method' => 'PUT', 'server' => [ 'CONTENT_TYPE' => 'image/png', 'CONTENT_LENGTH' => (string)strlen($data) ], - ); + ]; $request = new Request( $vars, @@ -335,11 +335,11 @@ public function testPutStream() { public function testSetUrlParameters() { - $vars = array( - 'post' => array(), + $vars = [ + 'post' => [], 'method' => 'POST', - 'urlParams' => array('id' => '2'), - ); + 'urlParams' => ['id' => '2'], + ]; $request = new Request( $vars, @@ -349,7 +349,7 @@ public function testSetUrlParameters() { $this->stream ); - $newParams = array('id' => '3', 'test' => 'test2'); + $newParams = ['id' => '3', 'test' => 'test2']; $request->setUrlParameters($newParams); $this->assertSame('test2', $request->getParam('test')); $this->assertEquals('3', $request->getParam('id')); diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 3d76d24496dab..86a909b7688aa 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -49,11 +49,11 @@ public function testAddHeader(){ public function testSetHeaders() { - $expected = array( + $expected = [ 'Last-Modified' => 1, 'ETag' => 3, 'Something-Else' => 'hi' - ); + ]; $this->childResponse->setHeaders($expected); $headers = $this->childResponse->getHeaders(); @@ -105,31 +105,31 @@ public function testAddCookie() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->addCookie('bar', 'foo', new \DateTime('1970-01-01')); - $expectedResponse = array( - 'foo' => array( + $expectedResponse = [ + 'foo' => [ 'value' => 'bar', 'expireDate' => null, - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'foo', 'expireDate' => new \DateTime('1970-01-01') - ) - ); + ] + ]; $this->assertEquals($expectedResponse, $this->childResponse->getCookies()); } function testSetCookies() { - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'value' => 'bar', 'expireDate' => null, - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'foo', 'expireDate' => new \DateTime('1970-01-01') - ) - ); + ] + ]; $this->childResponse->setCookies($expected); $cookies = $this->childResponse->getCookies(); @@ -141,12 +141,12 @@ function testSetCookies() { function testInvalidateCookie() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->invalidateCookie('foo'); - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'value' => 'expired', 'expireDate' => new \DateTime('1971-01-01') - ) - ); + ] + ]; $cookies = $this->childResponse->getCookies(); @@ -157,30 +157,30 @@ function testInvalidateCookie() { function testInvalidateCookies() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->addCookie('bar', 'foo'); - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'value' => 'bar', 'expireDate' => null - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'foo', 'expireDate' => null - ) - ); + ] + ]; $cookies = $this->childResponse->getCookies(); $this->assertEquals($expected, $cookies); - $this->childResponse->invalidateCookies(array('foo', 'bar')); - $expected = array( - 'foo' => array( + $this->childResponse->invalidateCookies(['foo', 'bar']); + $expected = [ + 'foo' => [ 'value' => 'expired', 'expireDate' => new \DateTime('1971-01-01') - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'expired', 'expireDate' => new \DateTime('1971-01-01') - ) - ); + ] + ]; $cookies = $this->childResponse->getCookies(); $this->assertEquals($expected, $cookies); diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index 6672b4d0c1ec3..af5b428cf869b 100644 --- a/tests/lib/AppFramework/Http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -41,26 +41,26 @@ protected function setUp(): void { public function testSetParamsConstructor(){ - $params = array('hi' => 'yo'); + $params = ['hi' => 'yo']; $this->tpl = new TemplateResponse('app', 'home', $params); - $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams()); + $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } public function testSetRenderAsConstructor(){ $renderAs = 'myrender'; - $this->tpl = new TemplateResponse('app', 'home', array(), $renderAs); + $this->tpl = new TemplateResponse('app', 'home', [], $renderAs); $this->assertEquals($renderAs, $this->tpl->getRenderAs()); } public function testSetParams(){ - $params = array('hi' => 'yo'); + $params = ['hi' => 'yo']; $this->tpl->setParams($params); - $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams()); + $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } @@ -75,12 +75,12 @@ public function testGetRenderAs(){ } public function testChainability() { - $params = array('hi' => 'yo'); + $params = ['hi' => 'yo']; $this->tpl->setParams($params) ->setStatus(Http::STATUS_NOT_FOUND); $this->assertEquals(Http::STATUS_NOT_FOUND, $this->tpl->getStatus()); - $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams()); + $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } } diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 4d184adcdb1e4..95f8996dbdb8e 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -15,9 +15,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRoute() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'GET', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -33,9 +33,9 @@ public function testSimpleOCSRoute() { public function testSimpleRouteWithMissingVerb() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'GET', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -51,9 +51,9 @@ public function testSimpleOCSRouteWithMissingVerb() { public function testSimpleRouteWithLowercaseVerb() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -69,11 +69,11 @@ public function testSimpleOCSRouteWithLowercaseVerb() { public function testSimpleRouteWithRequirements() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => array('something')) - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array('something')); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', ['something']); } public function testSimpleOCSRouteWithRequirements() { @@ -87,11 +87,11 @@ public function testSimpleOCSRouteWithRequirements() { public function testSimpleRouteWithDefaults() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', array(), 'defaults' => array('param' => 'foobar')) - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', [], 'defaults' => ['param' => 'foobar']] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array(), array('param' => 'foobar')); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', [], ['param' => 'foobar']); } @@ -106,11 +106,11 @@ public function testSimpleOCSRouteWithDefaults() { public function testSimpleRouteWithPostfix() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something'] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array(), array(), '_something'); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', [], [], '_something'); } public function testSimpleOCSRouteWithPostfix() { @@ -127,9 +127,9 @@ public function testSimpleRouteWithBrokenName() { $this->expectException(\UnexpectedValueException::class); - $routes = array('routes' => array( - array('name' => 'folders_open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'folders_open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; // router mock $router = $this->getMockBuilder('\OC\Route\Router') @@ -167,9 +167,9 @@ public function testSimpleOCSRouteWithBrokenName() { public function testSimpleRouteWithUnderScoreNames() { - $routes = array('routes' => array( - array('name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; $this->assertSimpleRoute($routes, 'admin_folders.open_current', 'DELETE', '/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent'); } @@ -205,14 +205,14 @@ public function testOCSResourceWithRoot() public function testResource() { - $routes = array('resources' => array('account' => array('url' => '/accounts'))); + $routes = ['resources' => ['account' => ['url' => '/accounts']]]; $this->assertResource($routes, 'account', '/accounts', 'AccountController', 'id'); } public function testResourceWithUnderScoreName() { - $routes = array('resources' => array('admin_accounts' => array('url' => '/admin/accounts'))); + $routes = ['resources' => ['admin_accounts' => ['url' => '/admin/accounts']]]; $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'id'); } @@ -224,7 +224,7 @@ public function testResourceWithUnderScoreName() * @param string $controllerName * @param string $actionName */ - private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=array(), array $defaults=array(), $postfix='') + private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='') { if ($postfix) { $name .= $postfix; @@ -270,8 +270,8 @@ private function assertSimpleOCSRoute($routes, $url, $controllerName, $actionName, - array $requirements=array(), - array $defaults=array(), + array $requirements=[], + array $defaults=[], $postfix='') { if ($postfix) { @@ -437,8 +437,8 @@ private function mockRoute( $verb, $controllerName, $actionName, - array $requirements=array(), - array $defaults=array() + array $requirements=[], + array $defaults=[] ) { $route = $this->getMockBuilder('\OC\Route\Route') ->setMethods(['method', 'action', 'requirements', 'defaults']) diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index fe1fc5bfa1a58..5a3c3f2a00725 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -193,7 +193,7 @@ public function testReflectParameters() { 'arguments' ); - $this->assertEquals(array('arg' => null, 'arg2' => 'hi'), $reader->getParameters()); + $this->assertEquals(['arg' => null, 'arg2' => 'hi'], $reader->getParameters()); } @@ -205,7 +205,7 @@ public function testReflectParameters2() { 'arguments2' ); - $this->assertEquals(array('arg' => null), $reader->getParameters()); + $this->assertEquals(['arg' => null], $reader->getParameters()); } diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index 3ec70d7142afd..75084e7f0f368 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -28,245 +28,245 @@ class AppTest extends \Test\TestCase { const TEST_GROUP2 = 'group2'; public function appVersionsProvider() { - return array( + return [ // exact match - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '6.0', 'requiremax' => '6.0', - ), + ], true - ), + ], // in-between match - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - ), + ], true - ), + ], // app too old - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '5.0', - ), + ], false - ), + ], // app too new - array( + [ '5.0.0.0', - array( + [ 'requiremin' => '6.0', 'requiremax' => '6.0', - ), + ], false - ), + ], // only min specified - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '6.0', - ), + ], true - ), + ], // only min specified fail - array( + [ '5.0.0.0', - array( + [ 'requiremin' => '6.0', - ), + ], false - ), + ], // only min specified legacy - array( + [ '6.0.0.0', - array( + [ 'require' => '6.0', - ), + ], true - ), + ], // only min specified legacy fail - array( + [ '4.0.0.0', - array( + [ 'require' => '6.0', - ), + ], false - ), + ], // only max specified - array( + [ '5.0.0.0', - array( + [ 'requiremax' => '6.0', - ), + ], true - ), + ], // only max specified fail - array( + [ '7.0.0.0', - array( + [ 'requiremax' => '6.0', - ), + ], false - ), + ], // variations of versions // single OC number - array( + [ '4', - array( + [ 'require' => '4.0', - ), + ], true - ), + ], // multiple OC number - array( + [ '4.3.1', - array( + [ 'require' => '4.3', - ), + ], true - ), + ], // single app number - array( + [ '4', - array( + [ 'require' => '4', - ), + ], true - ), + ], // single app number fail - array( + [ '4.3', - array( + [ 'require' => '5', - ), + ], false - ), + ], // complex - array( + [ '5.0.0', - array( + [ 'require' => '4.5.1', - ), + ], true - ), + ], // complex fail - array( + [ '4.3.1', - array( + [ 'require' => '4.3.2', - ), + ], false - ), + ], // two numbers - array( + [ '4.3.1', - array( + [ 'require' => '4.4', - ), + ], false - ), + ], // one number fail - array( + [ '4.3.1', - array( + [ 'require' => '5', - ), + ], false - ), + ], // pre-alpha app - array( + [ '5.0.3', - array( + [ 'require' => '4.93', - ), + ], true - ), + ], // pre-alpha OC - array( + [ '6.90.0.2', - array( + [ 'require' => '6.90', - ), + ], true - ), + ], // pre-alpha OC max - array( + [ '6.90.0.2', - array( + [ 'requiremax' => '7', - ), + ], true - ), + ], // expect same major number match - array( + [ '5.0.3', - array( + [ 'require' => '5', - ), + ], true - ), + ], // expect same major number match - array( + [ '5.0.3', - array( + [ 'requiremax' => '5', - ), + ], true - ), + ], // dependencies versions before require* - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '7.0', 'max-version' => '7.0', - ), - ), - ), - ), + ], + ], + ], + ], false - ), - array( + ], + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '5.0', 'max-version' => '5.0', - ), - ), - ), - ), + ], + ], + ], + ], false - ), - array( + ], + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '5.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '5.0', 'max-version' => '7.0', - ), - ), - ), - ), + ], + ], + ], + ], true - ), + ], [ '9.2.0.0', [ @@ -301,7 +301,7 @@ public function appVersionsProvider() { ], true ], - ); + ]; } /** @@ -329,11 +329,11 @@ public function testGetEnabledAppsIsSorted() { * Providers for the app config values */ public function appConfigValuesProvider() { - return array( + return [ // logged in user1 - array( + [ self::TEST_USER1, - array( + [ 'files', 'app1', 'app3', @@ -349,13 +349,13 @@ public function appConfigValuesProvider() { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // logged in user2 - array( + [ self::TEST_USER2, - array( + [ 'files', 'app1', 'app3', @@ -371,13 +371,13 @@ public function appConfigValuesProvider() { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // logged in user3 - array( + [ self::TEST_USER3, - array( + [ 'files', 'app1', 'app3', @@ -394,13 +394,13 @@ public function appConfigValuesProvider() { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // no user, returns all apps - array( + [ null, - array( + [ 'files', 'app1', 'app3', @@ -417,13 +417,13 @@ public function appConfigValuesProvider() { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false, - ), + ], // user given, but ask for all - array( + [ self::TEST_USER1, - array( + [ 'files', 'app1', 'app3', @@ -440,10 +440,10 @@ public function appConfigValuesProvider() { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], true, - ), - ); + ], + ]; } /** @@ -470,14 +470,14 @@ public function testEnabledApps($user, $expectedApps, $forceAll) { $this->setupAppConfigMock()->expects($this->once()) ->method('getValues') ->willReturn( - array( + [ 'app3' => 'yes', 'app2' => 'no', 'app1' => 'yes', 'appforgroup1' => '["group1"]', 'appforgroup2' => '["group2"]', 'appforgroup12' => '["group2","group1"]', - ) + ] ); @@ -509,19 +509,19 @@ public function testEnabledAppsCache() { $this->setupAppConfigMock()->expects($this->once()) ->method('getValues') ->willReturn( - array( + [ 'app3' => 'yes', 'app2' => 'no', - ) + ] ); $apps = \OC_App::getEnabledApps(); - $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'), $apps); + $this->assertEquals(['files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'], $apps); // mock should not be called again here $apps = \OC_App::getEnabledApps(); - $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'), $apps); + $this->assertEquals(['files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'], $apps); $this->restoreAppConfig(); \OC_User::setUserId(null); diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php index bdfe65d4304b8..8ecedb189ce1b 100644 --- a/tests/lib/Archive/TestBase.php +++ b/tests/lib/Archive/TestBase.php @@ -29,7 +29,7 @@ abstract protected function getNew(); public function testGetFiles() { $this->instance=$this->getExisting(); $allFiles=$this->instance->getFiles(); - $expected=array('lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt'); + $expected=['lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt']; $this->assertEquals(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files'); foreach($expected as $file) { $this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive'); @@ -38,14 +38,14 @@ public function testGetFiles() { $this->assertFalse($this->instance->fileExists('non/existing/file')); $rootContent=$this->instance->getFolder(''); - $expected=array('lorem.txt','logo-wide.png', 'dir/'); + $expected=['lorem.txt','logo-wide.png', 'dir/']; $this->assertEquals(3, count($rootContent)); foreach($expected as $file) { $this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive'); } $dirContent=$this->instance->getFolder('dir/'); - $expected=array('lorem.txt'); + $expected=['lorem.txt']; $this->assertEquals(1, count($dirContent)); foreach($expected as $file) { $this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive'); diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php index fe8ca5aefe25f..4b8de82b36835 100644 --- a/tests/lib/BackgroundJob/DummyJobList.php +++ b/tests/lib/BackgroundJob/DummyJobList.php @@ -18,7 +18,7 @@ class DummyJobList extends \OC\BackgroundJob\JobList { /** * @var IJob[] */ - private $jobs = array(); + private $jobs = []; private $last = 0; diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php index 6e99a71d1e337..3013afdfa1d99 100644 --- a/tests/lib/BackgroundJob/JobListTest.php +++ b/tests/lib/BackgroundJob/JobListTest.php @@ -64,16 +64,16 @@ protected function getAllSorted() { } public function argumentProvider() { - return array( - array(null), - array(false), - array('foobar'), - array(12), - array(array( + return [ + [null], + [false], + ['foobar'], + [12], + [[ 'asd' => 5, 'foo' => 'bar' - )) - ); + ]] + ]; } /** diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index cadeb502b4fb9..df7a72a74916c 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -61,8 +61,8 @@ protected function setUp(): void { //set up temporary storage $this->storage = \OC\Files\Filesystem::getStorage('/'); \OC\Files\Filesystem::clearMounts(); - $storage = new \OC\Files\Storage\Temporary(array()); - \OC\Files\Filesystem::mount($storage,array(),'/'); + $storage = new \OC\Files\Storage\Temporary([]); + \OC\Files\Filesystem::mount($storage,[],'/'); $datadir = str_replace('local::', '', $storage->getId()); $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); @@ -106,7 +106,7 @@ protected function tearDown(): void { // Restore the original mount point \OC\Files\Filesystem::clearMounts(); - \OC\Files\Filesystem::mount($this->storage, array(), '/'); + \OC\Files\Filesystem::mount($this->storage, [], '/'); parent::tearDown(); } @@ -117,7 +117,7 @@ private function setupMockStorage() { ->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]) ->getMock(); - \OC\Files\Filesystem::mount($mockStorage, array(), '/test/cache'); + \OC\Files\Filesystem::mount($mockStorage, [], '/test/cache'); return $mockStorage; } diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 4ac2cc124ee87..59338b74de9af 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -410,20 +410,20 @@ public function dataTestSplitUserRemote() { } public function dataTestSplitUserRemoteError() { - return array( + return [ // Invalid path - array('user@'), + ['user@'], // Invalid user - array('@server'), - array('us/er@server'), - array('us:er@server'), + ['@server'], + ['us/er@server'], + ['us:er@server'], // Invalid splitting - array('user'), - array(''), - array('us/erserver'), - array('us:erserver'), - ); + ['user'], + [''], + ['us/erserver'], + ['us:erserver'], + ]; } } diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index 109f7471e9611..58144b2c26a1b 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -12,7 +12,7 @@ class ConfigTest extends TestCase { const TESTCONTENT = '"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);'; /** @var array */ - private $initialConfig = array('foo' => 'bar', 'beers' => array('Appenzeller', 'Guinness', 'Kölsch'), 'alcohol_free' => false); + private $initialConfig = ['foo' => 'bar', 'beers' => ['Appenzeller', 'Guinness', 'Kölsch'], 'alcohol_free' => false]; /** @var string */ private $configFile; /** @var \OC\Config */ @@ -35,7 +35,7 @@ protected function tearDown(): void { } public function testGetKeys() { - $expectedConfig = array('foo', 'beers', 'alcohol_free'); + $expectedConfig = ['foo', 'beers', 'alcohol_free']; $this->assertSame($expectedConfig, $this->config->getKeys()); } @@ -44,8 +44,8 @@ public function testGetValue() { $this->assertSame(null, $this->config->getValue('bar')); $this->assertSame('moo', $this->config->getValue('bar', 'moo')); $this->assertSame(false, $this->config->getValue('alcohol_free', 'someBogusValue')); - $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers', 'someBogusValue')); - $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers')); + $this->assertSame(['Appenzeller', 'Guinness', 'Kölsch'], $this->config->getValue('beers', 'someBogusValue')); + $this->assertSame(['Appenzeller', 'Guinness', 'Kölsch'], $this->config->getValue('beers')); } public function testGetValueReturnsEnvironmentValueIfSet() { @@ -81,9 +81,9 @@ public function testSetValue() { $this->assertEquals($expected, $content); $this->config->setValue('bar', 'red'); - $this->config->setValue('apps', array('files', 'gallery')); + $this->config->setValue('apps', ['files', 'gallery']); $expectedConfig['bar'] = 'red'; - $expectedConfig['apps'] = array('files', 'gallery'); + $expectedConfig['apps'] = ['files', 'gallery']; $this->assertAttributeEquals($expectedConfig, 'cache', $this->config); $content = file_get_contents($this->configFile); @@ -150,7 +150,7 @@ public function testConfigMerge() { $this->assertEquals(self::TESTCONTENT, file_get_contents($this->configFile)); // Write a new value to the config - $this->config->setValue('CoolWebsites', array('demo.owncloud.org', 'owncloud.org', 'owncloud.com')); + $this->config->setValue('CoolWebsites', ['demo.owncloud.org', 'owncloud.org', 'owncloud.com']); $expected = " 'bar',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " . " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n 'php53' => 'totallyOutdated',\n 'CoolWebsites' => \n array (\n " . " 0 => 'demo.owncloud.org',\n 1 => 'owncloud.org',\n 2 => 'owncloud.com',\n ),\n);\n"; diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index f39d849bb9551..5437ca3fbaf98 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -15,48 +15,48 @@ protected function setUp(): void { } public function searchProvider(){ - $search1 = array( - 0 => array( - 'N' => array(0 => '', 1 => 'Jan', 2 => 'Jansen', 3 => '', 4 => '',), + $search1 = [ + 0 => [ + 'N' => [0 => '', 1 => 'Jan', 2 => 'Jansen', 3 => '', 4 => '',], 'UID' => '04ada7f5-01f9-4309-9c82-6b555b2170ed', 'FN' => 'Jan Jansen', 'id' => '1', 'addressbook-key' => 'simple:1', - ), - 0 => array( - 'N' => array(0 => '', 1 => 'Tom', 2 => 'Peeters', 3 => '', 4 => '',), + ], + 0 => [ + 'N' => [0 => '', 1 => 'Tom', 2 => 'Peeters', 3 => '', 4 => '',], 'UID' => '04ada7f5-01f9-4309-9c82-2345-2345--6b555b2170ed', 'FN' => 'Tom Peeters', 'id' => '2', 'addressbook-key' => 'simple:1', - ), - ); + ], + ]; - $search2 = array( - 0 => array( - 'N' => array(0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',), + $search2 = [ + 0 => [ + 'N' => [0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',], 'UID' => '04ada234h5jh357f5-01f9-4309-9c82-6b555b2170ed', 'FN' => 'Jan Rompuy', 'id' => '1', 'addressbook-key' => 'simple:2', - ), - 0 => array( - 'N' => array(0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',), + ], + 0 => [ + 'N' => [0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',], 'UID' => '04ada7f5-01f9-4309-345kj345j9c82-2345-2345--6b555b2170ed', 'FN' => 'Tim Peeters', 'id' => '2', 'addressbook-key' => 'simple:2', - ), - ); + ], + ]; $expectedResult = array_merge($search1, $search2); - return array( - array( + return [ + [ $search1, $search2, $expectedResult - ) - ); + ] + ]; } /** @@ -164,7 +164,7 @@ public function testCreateOrUpdateHavePermission(){ ->willReturn('returnMe'); $this->cm->registerAddressBook($addressbook); - $result = $this->cm->createOrUpdate(array(), $addressbook->getKey()); + $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, 'returnMe'); } @@ -182,7 +182,7 @@ public function testCreateOrUpdateNoPermission(){ ->method('createOrUpdate'); $this->cm->registerAddressBook($addressbook); - $result = $this->cm->createOrUpdate(array(), $addressbook->getKey()); + $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, null); } @@ -197,7 +197,7 @@ public function testCreateOrUpdateNOAdressbook(){ ->method('createOrUpdate'); $this->cm->registerAddressBook($addressbook); - $result = $this->cm->createOrUpdate(array(), 'noaddressbook'); + $result = $this->cm->createOrUpdate([], 'noaddressbook'); $this->assertEquals($result, null); } diff --git a/tests/lib/DB/LegacyDBTest.php b/tests/lib/DB/LegacyDBTest.php index ce7ef0a3a6303..cd4befdbe52c1 100644 --- a/tests/lib/DB/LegacyDBTest.php +++ b/tests/lib/DB/LegacyDBTest.php @@ -85,15 +85,15 @@ protected function tearDown(): void { public function testQuotes() { $query = OC_DB::prepare('SELECT `fullname` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_1')); + $result = $query->execute(['uri_1']); $this->assertTrue((bool)$result); $row = $result->fetchRow(); $this->assertFalse($row); $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)'); - $result = $query->execute(array('fullname test', 'uri_1')); + $result = $query->execute(['fullname test', 'uri_1']); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_1')); + $result = $query->execute(['uri_1']); $this->assertTrue((bool)$result); $row = $result->fetchRow(); $this->assertArrayHasKey('fullname', $row); @@ -107,29 +107,29 @@ public function testQuotes() { */ public function testNOW() { $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (NOW(),?)'); - $result = $query->execute(array('uri_2')); + $result = $query->execute(['uri_2']); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_2')); + $result = $query->execute(['uri_2']); $this->assertTrue((bool)$result); } public function testUNIX_TIMESTAMP() { $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)'); - $result = $query->execute(array('uri_3')); + $result = $query->execute(['uri_3']); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_3')); + $result = $query->execute(['uri_3']); $this->assertTrue((bool)$result); } public function testLastInsertId() { $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)'); - $result1 = OC_DB::executeAudited($query, array('insertid 1','uri_1')); + $result1 = OC_DB::executeAudited($query, ['insertid 1','uri_1']); $id1 = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*'.$this->table2); // we don't know the id we should expect, so insert another row - $result2 = OC_DB::executeAudited($query, array('insertid 2','uri_2')); + $result2 = OC_DB::executeAudited($query, ['insertid 2','uri_2']); $id2 = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*'.$this->table2); // now we can check if the two ids are in correct order $this->assertGreaterThan($id1, $id2); @@ -140,7 +140,7 @@ public function testUtf8Data() { $expected = "Ћö雙喜\xE2\x80\xA2"; $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $result = $query->execute(array($expected, 'uri_1', 'This is a vCard')); + $result = $query->execute([$expected, 'uri_1', 'This is a vCard']); $this->assertEquals(1, $result); $actual = OC_DB::prepare("SELECT `fullname` FROM `$table`")->execute()->fetchOne(); @@ -156,7 +156,7 @@ public function XtestDecimal($insert, $expect) { $rowname = 'decimaltest'; $query = OC_DB::prepare('INSERT INTO `' . $table . '` (`' . $rowname . '`) VALUES (?)'); - $result = $query->execute(array($insert)); + $result = $query->execute([$insert]); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `' . $rowname . '` FROM `' . $table . '`'); $result = $query->execute(); @@ -205,35 +205,35 @@ public function testUpdateAffectedRowsMultiple() { // updating to. MySQL reports 1 here when the PDO::MYSQL_ATTR_FOUND_ROWS // flag is not specified. $query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ?"); - $this->assertSame(2, $query->execute(array('uri1'))); + $this->assertSame(2, $query->execute(['uri1'])); } protected function insertCardData($fullname, $uri) { $query = OC_DB::prepare("INSERT INTO `*PREFIX*{$this->table2}` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $this->assertSame(1, $query->execute(array($fullname, $uri, $this->getUniqueID()))); + $this->assertSame(1, $query->execute([$fullname, $uri, $this->getUniqueID()])); } protected function updateCardData($fullname, $uri) { $query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ? WHERE `fullname` = ?"); - return $query->execute(array($uri, $fullname)); + return $query->execute([$uri, $fullname]); } public function testILIKE() { $table = "*PREFIX*{$this->table2}"; $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $query->execute(array('fooBAR', 'foo', 'bar')); + $query->execute(['fooBAR', 'foo', 'bar']); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('foobar')); + $result = $query->execute(['foobar']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('foobar')); + $result = $query->execute(['foobar']); $this->assertCount(1, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('foo')); + $result = $query->execute(['foo']); $this->assertCount(0, $result->fetchAll()); } @@ -241,30 +241,30 @@ public function testILIKEWildcard() { $table = "*PREFIX*{$this->table2}"; $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $query->execute(array('FooBAR', 'foo', 'bar')); + $query->execute(['FooBAR', 'foo', 'bar']); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('%bar')); + $result = $query->execute(['%bar']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('foo%')); + $result = $query->execute(['foo%']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('%ba%')); + $result = $query->execute(['%ba%']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('%bar')); + $result = $query->execute(['%bar']); $this->assertCount(1, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('foo%')); + $result = $query->execute(['foo%']); $this->assertCount(1, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('%ba%')); + $result = $query->execute(['%ba%']); $this->assertCount(1, $result->fetchAll()); } @@ -279,7 +279,7 @@ public function testInsertAndSelectData($expected, $throwsOnMysqlWithoutUTF8MB4) if ($throwsOnMysqlWithoutUTF8MB4 && $config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false) === false) { $this->markTestSkipped('MySQL requires UTF8mb4 to store value: ' . $expected); } - $result = $query->execute(array($expected)); + $result = $query->execute([$expected]); $this->assertEquals(1, $result); $actual = OC_DB::prepare("SELECT `textfield` FROM `$table`")->execute()->fetchOne(); diff --git a/tests/lib/DB/MDB2SchemaManagerTest.php b/tests/lib/DB/MDB2SchemaManagerTest.php index 8c9290c56b451..d83131a685f8d 100644 --- a/tests/lib/DB/MDB2SchemaManagerTest.php +++ b/tests/lib/DB/MDB2SchemaManagerTest.php @@ -40,10 +40,10 @@ public function testAutoIncrement() { $manager = new \OC\DB\MDB2SchemaManager($connection); $manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml'); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc')); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc')); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['abc']); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['abc']); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['123']); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['123']); $manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml'); $this->addToAssertionCount(1); diff --git a/tests/lib/DB/MDB2SchemaReaderTest.php b/tests/lib/DB/MDB2SchemaReaderTest.php index 5698ad966f195..2f987adb290e5 100644 --- a/tests/lib/DB/MDB2SchemaReaderTest.php +++ b/tests/lib/DB/MDB2SchemaReaderTest.php @@ -38,10 +38,10 @@ protected function getConfig() { ->getMock(); $config->expects($this->any()) ->method('getSystemValue') - ->willReturnMap(array( - array('dbname', 'owncloud', 'testDB'), - array('dbtableprefix', 'oc_', 'test_') - )); + ->willReturnMap([ + ['dbname', 'owncloud', 'testDB'], + ['dbtableprefix', 'oc_', 'test_'] + ]); return $config; } @@ -85,10 +85,10 @@ public function testRead() { $this->assertEquals(2, $table->getColumn('decimalfield_precision_scale')->getScale()); $this->assertCount(2, $table->getIndexes()); - $this->assertEquals(array('integerfield'), $table->getIndex('primary')->getUnquotedColumns()); + $this->assertEquals(['integerfield'], $table->getIndex('primary')->getUnquotedColumns()); $this->assertTrue($table->getIndex('primary')->isPrimary()); $this->assertTrue($table->getIndex('primary')->isUnique()); - $this->assertEquals(array('booleanfield'), $table->getIndex('index_boolean')->getUnquotedColumns()); + $this->assertEquals(['booleanfield'], $table->getIndex('index_boolean')->getUnquotedColumns()); $this->assertFalse($table->getIndex('index_boolean')->isPrimary()); $this->assertFalse($table->getIndex('index_boolean')->isUnique()); } diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index e5cc28654e444..a438d0189dfc1 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -77,19 +77,19 @@ protected function tearDown(): void { * @return \Doctrine\DBAL\Schema\Schema[] */ private function getDuplicateKeySchemas() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $table->addIndex(array('id'), $this->tableName . '_id'); + $table->addIndex(['id'], $this->tableName . '_id'); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $table->addUniqueIndex(array('id'), $this->tableName . '_id'); + $table->addUniqueIndex(['id'], $this->tableName . '_id'); - return array($startSchema, $endSchema); + return [$startSchema, $endSchema]; } private function getSchemaConfig() { @@ -113,9 +113,9 @@ public function testDuplicateKeyUpgrade() { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $this->fail('checkMigrate should have failed'); @@ -126,9 +126,9 @@ public function testUpgrade() { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); @@ -145,9 +145,9 @@ public function testUpgradeDifferentPrefix() { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); @@ -163,10 +163,10 @@ public function testInsertAfterUpgrade() { $migrator->migrate($endSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); try { - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); $this->fail('Expected duplicate key insert to fail'); } catch (DBALException $e) { $this->addToAssertionCount(1); @@ -174,16 +174,16 @@ public function testInsertAfterUpgrade() { } public function testAddingPrimaryKeyWithAutoIncrement() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); + $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('name', 'string'); - $table->setPrimaryKey(array('id')); + $table->setPrimaryKey(['id']); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); @@ -195,17 +195,17 @@ public function testAddingPrimaryKeyWithAutoIncrement() { } public function testReservedKeywords() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('user', 'string', array('length' => 255)); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['autoincrement' => true]); + $table->addColumn('user', 'string', ['length' => 255]); + $table->setPrimaryKey(['id']); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('user', 'string', array('length' => 64)); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['autoincrement' => true]); + $table->addColumn('user', 'string', ['length' => 64]); + $table->setPrimaryKey(['id']); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); @@ -227,7 +227,7 @@ public function testAddingForeignKey() { $tableFk = $startSchema->createTable($this->tableNameTmp); $tableFk->addColumn('fk_id', 'integer'); $tableFk->addColumn('name', 'string'); - $tableFk->addForeignKeyConstraint($this->tableName, array('fk_id'), array('id'), array(), $fkName); + $tableFk->addForeignKeyConstraint($this->tableName, ['fk_id'], ['id'], [], $fkName); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php index 6cd8b572fcdbe..1470f3b6bf4cf 100644 --- a/tests/lib/DateTimeFormatterTest.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -44,35 +44,35 @@ protected function getTimestampAgo($time, $seconds = 0, $minutes = 0, $hours = 0 public function formatTimeSpanData() { $time = 1416916800; // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo $deL10N = \OC::$server->getL10N('lib', 'de'); - return array( - array('seconds ago', $time, $time), - array('in a few seconds', $time + 5 , $time), - array('1 minute ago', $this->getTimestampAgo($time, 30, 1), $time), - array('15 minutes ago', $this->getTimestampAgo($time, 30, 15), $time), - array('in 15 minutes', $time, $this->getTimestampAgo($time, 30, 15)), - array('1 hour ago', $this->getTimestampAgo($time, 30, 15, 1), $time), - array('3 hours ago', $this->getTimestampAgo($time, 30, 15, 3), $time), - array('in 3 hours', $time, $this->getTimestampAgo($time, 30, 15, 3)), - array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4), $time), - - array('seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('1 minute ago', new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('3 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('59 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('1 hour ago', new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('3 hours ago', new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('2 days ago', new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - - array($deL10N->t('seconds ago'), new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n minute ago', '%n minutes ago', 1), new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n minute ago', '%n minutes ago', 3), new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n hour ago', '%n hours ago', 1), new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n hour ago', '%n hours ago', 3), new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - - ); + return [ + ['seconds ago', $time, $time], + ['in a few seconds', $time + 5 , $time], + ['1 minute ago', $this->getTimestampAgo($time, 30, 1), $time], + ['15 minutes ago', $this->getTimestampAgo($time, 30, 15), $time], + ['in 15 minutes', $time, $this->getTimestampAgo($time, 30, 15)], + ['1 hour ago', $this->getTimestampAgo($time, 30, 15, 1), $time], + ['3 hours ago', $this->getTimestampAgo($time, 30, 15, 3), $time], + ['in 3 hours', $time, $this->getTimestampAgo($time, 30, 15, 3)], + ['4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4), $time], + + ['seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['1 minute ago', new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['3 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['59 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['1 hour ago', new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['3 hours ago', new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['2 days ago', new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + + [$deL10N->t('seconds ago'), new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n minute ago', '%n minutes ago', 1), new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n minute ago', '%n minutes ago', 3), new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n hour ago', '%n hours ago', 1), new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n hour ago', '%n hours ago', 3), new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + + ]; } /** @@ -85,60 +85,60 @@ public function testFormatTimeSpan($expected, $timestamp, $compare, $locale = nu public function formatDateSpanData() { $time = 1416916800; // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo $deL10N = \OC::$server->getL10N('lib', 'de'); - return array( + return [ // Normal testing - array('today', $this->getTimestampAgo($time, 30, 15), $time), - array('yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time), - array('tomorrow', $time, $this->getTimestampAgo($time, 0, 0, 0, 1)), - array('4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time), - array('in 4 days', $time, $this->getTimestampAgo($time, 0, 0, 0, 4)), - array('5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time), - array('next month', $time, $this->getTimestampAgo($time, 0, 0, 0, 32)), - array('in 5 months', $time, $this->getTimestampAgo($time, 0, 0, 0, 155)), - array('2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time), - array('next year', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('in 2 years', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 2)), + ['today', $this->getTimestampAgo($time, 30, 15), $time], + ['yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time], + ['tomorrow', $time, $this->getTimestampAgo($time, 0, 0, 0, 1)], + ['4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time], + ['in 4 days', $time, $this->getTimestampAgo($time, 0, 0, 0, 4)], + ['5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time], + ['next month', $time, $this->getTimestampAgo($time, 0, 0, 0, 32)], + ['in 5 months', $time, $this->getTimestampAgo($time, 0, 0, 0, 155)], + ['2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time], + ['next year', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['in 2 years', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 2)], // Test with compare timestamp - array('today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('2 years ago', $this->getTimestampAgo($time, 30, 15, 3, 35, 3), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), + ['today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['2 years ago', $this->getTimestampAgo($time, 30, 15, 3, 35, 3), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], // Test translations - array($deL10N->t('today'), new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->t('yesterday'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), - array($deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), - array($deL10N->n('%n month ago', '%n months ago', 9), new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), - array($deL10N->n('%n year ago', '%n years ago', 2), new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), + [$deL10N->t('today'), new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->t('yesterday'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N], + [$deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N], + [$deL10N->n('%n month ago', '%n months ago', 9), new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N], + [$deL10N->n('%n year ago', '%n years ago', 2), new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N], // Test time - array('today', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('today', new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('today', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), + ['today', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['today', new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['today', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], // Test some special yesterdays - array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('yesterday', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), - array('yesterday', new \DateTime('Mon, 31 Dec 2012 00:00:00 +0000'), new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000')), + ['yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['yesterday', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')], + ['yesterday', new \DateTime('Mon, 31 Dec 2012 00:00:00 +0000'), new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000')], // Test last month - array('2 days ago', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), - array('last month', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 31 Oct 2013 00:00:00 +0000')), - array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), - array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Thu, 31 Oct 2013 00:00:00 +0000')), + ['2 days ago', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')], + ['last month', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 31 Oct 2013 00:00:00 +0000')], + ['last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')], + ['last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Thu, 31 Oct 2013 00:00:00 +0000')], // Test last year - array('9 months ago', new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('11 months ago', new \DateTime('Thu, 03 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('last year', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('last year', new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('2 years ago', new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - ); + ['9 months ago', new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['11 months ago', new \DateTime('Thu, 03 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['last year', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['last year', new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['2 years ago', new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ]; } /** @@ -149,9 +149,9 @@ public function testFormatDateSpan($expected, $timestamp, $compare = null, $loca } public function formatDateData() { - return array( - array(1102831200, 'December 12, 2004'), - ); + return [ + [1102831200, 'December 12, 2004'], + ]; } /** @@ -162,10 +162,10 @@ public function testFormatDate($timestamp, $expected) { } public function formatDateTimeData() { - return array( - array(1350129205, null, 'October 13, 2012 at 11:53:25 AM GMT+0'), - array(1350129205, new \DateTimeZone('Europe/Berlin'), 'October 13, 2012 at 1:53:25 PM GMT+2'), - ); + return [ + [1350129205, null, 'October 13, 2012 at 11:53:25 AM GMT+0'], + [1350129205, new \DateTimeZone('Europe/Berlin'), 'October 13, 2012 at 1:53:25 PM GMT+2'], + ]; } /** diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index b333729ef87a3..7e21fe881fcf9 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -63,7 +63,7 @@ protected function setUp(): void { public function testSetFileKey() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -143,7 +143,7 @@ public function testGetFileKey($path, $strippedPartialName, $originalKeyExists, public function testSetFileKeySystemWide() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturn(true); @@ -164,7 +164,7 @@ public function testSetFileKeySystemWide() { public function testGetFileKeySystemWide() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -272,7 +272,7 @@ public function testDeleteSystemUserKey() { public function testDeleteFileKeySystemWide() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -296,7 +296,7 @@ public function testDeleteFileKeySystemWide() { public function testDeleteFileKey() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -335,7 +335,7 @@ public function testRenameKeys($source, $target, $systemWideMountSource, $system ->willReturn(true); $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturnCallback(array($this, 'getUidAndFilenameCallback')); + ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { @@ -366,7 +366,7 @@ public function testCopyKeys($source, $target, $systemWideMountSource, $systemWi ->willReturn(true); $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturnCallback(array($this, 'getUidAndFilenameCallback')); + ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { @@ -385,37 +385,37 @@ public function getUidAndFilenameCallback() { $path = $args[0]; $parts = explode('/', $path); - return array($parts[1], '/' . implode('/', array_slice($parts, 2))); + return [$parts[1], '/' . implode('/', array_slice($parts, 2))]; } public function dataProviderCopyRename() { - return array( - array('/user1/files/source.txt', '/user1/files/target.txt', false, false, - '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user1/files/foo/source.txt', '/user1/files/target.txt', false, false, - '/user1/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user1/files/source.txt', '/user1/files/foo/target.txt', false, false, - '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'), - array('/user1/files/source.txt', '/user1/files/foo/target.txt', true, true, - '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'), - array('/user1/files/source.txt', '/user1/files/target.txt', false, true, - '/user1/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'), - array('/user1/files/source.txt', '/user1/files/target.txt', true, false, - '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - - array('/user2/files/source.txt', '/user1/files/target.txt', false, false, - '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user2/files/foo/source.txt', '/user1/files/target.txt', false, false, - '/user2/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user2/files/source.txt', '/user1/files/foo/target.txt', false, false, - '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'), - array('/user2/files/source.txt', '/user1/files/foo/target.txt', true, true, - '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'), - array('/user2/files/source.txt', '/user1/files/target.txt', false, true, - '/user2/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'), - array('/user2/files/source.txt', '/user1/files/target.txt', true, false, - '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - ); + return [ + ['/user1/files/source.txt', '/user1/files/target.txt', false, false, + '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user1/files/foo/source.txt', '/user1/files/target.txt', false, false, + '/user1/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user1/files/source.txt', '/user1/files/foo/target.txt', false, false, + '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'], + ['/user1/files/source.txt', '/user1/files/foo/target.txt', true, true, + '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'], + ['/user1/files/source.txt', '/user1/files/target.txt', false, true, + '/user1/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'], + ['/user1/files/source.txt', '/user1/files/target.txt', true, false, + '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + + ['/user2/files/source.txt', '/user1/files/target.txt', false, false, + '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user2/files/foo/source.txt', '/user1/files/target.txt', false, false, + '/user2/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user2/files/source.txt', '/user1/files/foo/target.txt', false, false, + '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'], + ['/user2/files/source.txt', '/user1/files/foo/target.txt', true, true, + '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'], + ['/user2/files/source.txt', '/user1/files/target.txt', false, true, + '/user2/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'], + ['/user2/files/source.txt', '/user1/files/target.txt', true, false, + '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ]; } /** @@ -432,7 +432,7 @@ public function testGetPathToKeys($path, $systemWideMountPoint, $storageRoot, $e $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturnCallback(array($this, 'getUidAndFilenameCallback')); + ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturn($systemWideMountPoint); @@ -460,15 +460,15 @@ public function testKeySetPreparation() { ->willReturn(false); $this->view->expects($this->any()) ->method('mkdir') - ->willReturnCallback(array($this, 'mkdirCallback')); + ->willReturnCallback([$this, 'mkdirCallback']); - $this->mkdirStack = array( + $this->mkdirStack = [ '/user1/files_encryption/keys/foo', '/user1/files_encryption/keys', '/user1/files_encryption', - '/user1'); + '/user1']; - self::invokePrivate($this->storage, 'keySetPreparation', array('/user1/files_encryption/keys/foo')); + self::invokePrivate($this->storage, 'keySetPreparation', ['/user1/files_encryption/keys/foo']); } public function mkdirCallback() { diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index 28d7ca8116359..6328df3dc30aa 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -121,10 +121,10 @@ public function testUpdate($path, $isDir, $allFiles, $numberOfFiles) { * @return array */ public function dataTestUpdate() { - return array( - array('/user/files/foo', true, ['/user/files/foo/file1.txt', '/user/files/foo/file1.txt'], 2), - array('/user/files/test.txt', false, [], 1), - ); + return [ + ['/user/files/foo', true, ['/user/files/foo/file1.txt', '/user/files/foo/file1.txt'], 2], + ['/user/files/test.txt', false, [], 1], + ]; } /** @@ -168,14 +168,14 @@ public function testPostRename($source, $target, $encryptionEnabled) { * @return array */ public function dataTestPostRename() { - return array( - array('/test.txt', '/testNew.txt', true), - array('/test.txt', '/testNew.txt', false), - array('/folder/test.txt', '/testNew.txt', true), - array('/folder/test.txt', '/testNew.txt', false), - array('/folder/test.txt', '/testNew.txt', true), - array('/test.txt', '/folder/testNew.txt', false), - ); + return [ + ['/test.txt', '/testNew.txt', true], + ['/test.txt', '/testNew.txt', false], + ['/folder/test.txt', '/testNew.txt', true], + ['/folder/test.txt', '/testNew.txt', false], + ['/folder/test.txt', '/testNew.txt', true], + ['/test.txt', '/folder/testNew.txt', false], + ]; } @@ -208,10 +208,10 @@ public function testPostRestore($encryptionEnabled) { * @return array */ public function dataTestPostRestore() { - return array( - array(true), - array(false), - ); + return [ + [true], + [false], + ]; } /** diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index 2c5bd1a80f35b..0ac474faa0f83 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -101,7 +101,7 @@ public function testCreateHeaderFailed() { $this->expectException(\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException::class); - $header = array('header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo'); + $header = ['header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo']; $em = $this->createMock(IEncryptionModule::class); $em->expects($this->any())->method('getId')->willReturn('moduleId'); @@ -120,7 +120,7 @@ public function testIsExcluded($path, $keyStorageRoot, $expected) { $this->userManager ->expects($this->any()) ->method('userExists') - ->willReturnCallback(array($this, 'isExcludedCallback')); + ->willReturnCallback([$this, 'isExcludedCallback']); $this->assertSame($expected, $this->util->isExcluded($path) @@ -128,17 +128,17 @@ public function testIsExcluded($path, $keyStorageRoot, $expected) { } public function providePathsForTestIsExcluded() { - return array( - array('/files_encryption', '', true), - array('files_encryption/foo.txt', '', true), - array('test/foo.txt', '', false), - array('/user1/files_encryption/foo.txt', '', true), - array('/user1/files/foo.txt', '', false), - array('/keyStorage/user1/files/foo.txt', 'keyStorage', true), - array('/keyStorage/files_encryption', '/keyStorage', true), - array('keyStorage/user1/files_encryption', '/keyStorage/', true), + return [ + ['/files_encryption', '', true], + ['files_encryption/foo.txt', '', true], + ['test/foo.txt', '', false], + ['/user1/files_encryption/foo.txt', '', true], + ['/user1/files/foo.txt', '', false], + ['/keyStorage/user1/files/foo.txt', 'keyStorage', true], + ['/keyStorage/files_encryption', '/keyStorage', true], + ['keyStorage/user1/files_encryption', '/keyStorage/', true], - ); + ]; } public function isExcludedCallback() { @@ -160,15 +160,15 @@ public function testIsFile($path, $expected) { } public function dataTestIsFile() { - return array( - array('/user/files/test.txt', true), - array('/user/files', true), - array('/user/files_versions/test.txt', false), - array('/user/foo/files/test.txt', false), - array('/files/foo/files/test.txt', false), - array('/user', false), - array('/user/test.txt', false), - ); + return [ + ['/user/files/test.txt', true], + ['/user/files', true], + ['/user/files_versions/test.txt', false], + ['/user/foo/files/test.txt', false], + ['/files/foo/files/test.txt', false], + ['/user', false], + ['/user/test.txt', false], + ]; } /** @@ -183,12 +183,12 @@ public function testStripPartialFileExtension($path, $expected) { } public function dataTestStripPartialFileExtension() { - return array( - array('/foo/test.txt', '/foo/test.txt'), - array('/foo/test.txt.part', '/foo/test.txt'), - array('/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'), - array('/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'), - ); + return [ + ['/foo/test.txt', '/foo/test.txt'], + ['/foo/test.txt.part', '/foo/test.txt'], + ['/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'], + ['/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'], + ]; } } diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php index aece7f146f600..179b5c1212358 100644 --- a/tests/lib/ErrorHandlerTest.php +++ b/tests/lib/ErrorHandlerTest.php @@ -29,13 +29,13 @@ class ErrorHandlerTest extends \Test\TestCase { * @return array */ function passwordProvider() { - return array( - array('user', 'password'), - array('user@owncloud.org', 'password'), - array('user', 'pass@word'), - array('us:er', 'password'), - array('user', 'pass:word'), - ); + return [ + ['user', 'password'], + ['user@owncloud.org', 'password'], + ['user', 'pass@word'], + ['us:er', 'password'], + ['user', 'pass:word'], + ]; } diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index 247ed9ef9ec65..40d87214aadaf 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -55,8 +55,8 @@ public function testGetNumericId() { public function testSimple() { $file1 = 'foo'; $file2 = 'foo/bar'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $data2 = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $data2 = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $this->assertFalse($this->cache->inCache($file1)); $this->assertEquals($this->cache->get($file1), null); @@ -84,7 +84,7 @@ public function testSimple() { $this->assertEquals($id1, $this->cache->getParentId($file2)); $newSize = 1050; - $newId2 = $this->cache->put($file2, array('size' => $newSize)); + $newId2 = $this->cache->put($file2, ['size' => $newSize]); $cacheData2 = $this->cache->get($file2); $this->assertEquals($newId2, $id2); $this->assertEquals($cacheData2['size'], $newSize); @@ -101,14 +101,14 @@ public function testSimple() { public function testPartial() { $file1 = 'foo'; - $this->cache->put($file1, array('size' => 10)); - $this->assertEquals(array('size' => 10), $this->cache->get($file1)); + $this->cache->put($file1, ['size' => 10]); + $this->assertEquals(['size' => 10], $this->cache->get($file1)); - $this->cache->put($file1, array('mtime' => 15)); - $this->assertEquals(array('size' => 10, 'mtime' => 15), $this->cache->get($file1)); + $this->cache->put($file1, ['mtime' => 15]); + $this->assertEquals(['size' => 10, 'mtime' => 15], $this->cache->get($file1)); - $this->cache->put($file1, array('size' => 12)); - $this->assertEquals(array('size' => 12, 'mtime' => 15), $this->cache->get($file1)); + $this->cache->put($file1, ['size' => 12]); + $this->assertEquals(['size' => 12, 'mtime' => 15], $this->cache->get($file1)); } /** @@ -124,10 +124,10 @@ public function testFolder($folder) { } $file2 = $folder . '/bar'; $file3 = $folder . '/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); - $fileData = array(); - $fileData['bar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; + $fileData = []; + $fileData['bar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($folder, $data1); $this->cache->put($file2, $fileData['bar']); @@ -143,12 +143,12 @@ public function testFolder($folder) { } $file4 = $folder . '/unkownSize'; - $fileData['unkownSize'] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(-1, $this->cache->calculateFolderSize($folder)); - $fileData['unkownSize'] = array('size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(1025, $this->cache->calculateFolderSize($folder)); @@ -164,8 +164,8 @@ public function testFolder($folder) { } public function testRemoveRecursive() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); - $fileData = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'text/plain'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; + $fileData = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'text/plain']; $folders = ['folder', 'folder/subfolder', 'folder/sub2', 'folder/sub2/sub3']; $files = ['folder/foo.txt', 'folder/bar.txt', 'folder/subfolder/asd.txt', 'folder/sub2/qwerty.txt', 'folder/sub2/sub3/foo.txt']; @@ -184,27 +184,27 @@ public function testRemoveRecursive() { public function folderDataProvider() { - return array( - array('folder'), + return [ + ['folder'], // that was too easy, try something harder - array('☺, WHITE SMILING FACE, UTF-8 hex E298BA'), + ['☺, WHITE SMILING FACE, UTF-8 hex E298BA'], // what about 4 byte utf-8 - array('😐, NEUTRAL_FACE, UTF-8 hex F09F9890'), + ['😐, NEUTRAL_FACE, UTF-8 hex F09F9890'], // now the crazy stuff - array(', UNASSIGNED PRIVATE USE, UTF-8 hex EF9890'), + [', UNASSIGNED PRIVATE USE, UTF-8 hex EF9890'], // and my favorite - array('w͢͢͝h͡o͢͡ ̸͢k̵͟n̴͘ǫw̸̛s͘ ̀́w͘͢ḩ̵a҉̡͢t ̧̕h́o̵r͏̵rors̡ ̶͡͠lį̶e͟͟ ̶͝in͢ ͏t̕h̷̡͟e ͟͟d̛a͜r̕͡k̢̨ ͡h̴e͏a̷̢̡rt́͏ ̴̷͠ò̵̶f̸ u̧͘ní̛͜c͢͏o̷͏d̸͢e̡͝') - ); + ['w͢͢͝h͡o͢͡ ̸͢k̵͟n̴͘ǫw̸̛s͘ ̀́w͘͢ḩ̵a҉̡͢t ̧̕h́o̵r͏̵rors̡ ̶͡͠lį̶e͟͟ ̶͝in͢ ͏t̕h̷̡͟e ͟͟d̛a͜r̕͡k̢̨ ͡h̴e͏a̷̢̡rt́͏ ̴̷͠ò̵̶f̸ u̧͘ní̛͜c͢͏o̷͏d̸͢e̡͝'] + ]; } public function testEncryptedFolder() { $file1 = 'folder'; $file2 = 'folder/bar'; $file3 = 'folder/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); - $fileData = array(); - $fileData['bar'] = array('size' => 1000, 'encrypted' => 1, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'encrypted' => 1, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; + $fileData = []; + $fileData['bar'] = ['size' => 1000, 'encrypted' => 1, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'encrypted' => 1, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file1, $data1); $this->cache->put($file2, $fileData['bar']); @@ -217,12 +217,12 @@ public function testEncryptedFolder() { } $file4 = 'folder/unkownSize'; - $fileData['unkownSize'] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(-1, $this->cache->calculateFolderSize($file1)); - $fileData['unkownSize'] = array('size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(1025, $this->cache->calculateFolderSize($file1)); @@ -243,10 +243,10 @@ public function testEncryptedFolder() { public function testRootFolderSizeForNonHomeStorage() { $dir1 = 'knownsize'; $dir2 = 'unknownsize'; - $fileData = array(); - $fileData[''] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir2] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory'); + $fileData = []; + $fileData[''] = ['size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir1] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir2] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory']; $this->cache->put('', $fileData['']); $this->cache->put($dir1, $fileData[$dir1]); @@ -269,11 +269,11 @@ public function testRootFolderSizeForNonHomeStorage() { function testStatus() { $this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->getStatus('foo')); - $this->cache->put('foo', array('size' => -1)); + $this->cache->put('foo', ['size' => -1]); $this->assertEquals(\OC\Files\Cache\Cache::PARTIAL, $this->cache->getStatus('foo')); - $this->cache->put('foo', array('size' => -1, 'mtime' => 20, 'mimetype' => 'foo/file')); + $this->cache->put('foo', ['size' => -1, 'mtime' => 20, 'mimetype' => 'foo/file']); $this->assertEquals(\OC\Files\Cache\Cache::SHALLOW, $this->cache->getStatus('foo')); - $this->cache->put('foo', array('size' => 10)); + $this->cache->put('foo', ['size' => 10]); $this->assertEquals(\OC\Files\Cache\Cache::COMPLETE, $this->cache->getStatus('foo')); } @@ -292,7 +292,7 @@ public function putWithAllKindOfQuotesData() { public function testPutWithAllKindOfQuotes($fileName) { $this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->get($fileName)); - $this->cache->put($fileName, array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName)); + $this->cache->put($fileName, ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName]); $cacheEntry = $this->cache->get($fileName); $this->assertEquals($fileName, $cacheEntry['etag']); @@ -303,10 +303,10 @@ function testSearch() { $file1 = 'folder'; $file2 = 'folder/foobar'; $file3 = 'folder/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $fileData = array(); - $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $fileData = []; + $fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file1, $data1); $this->cache->put($file2, $fileData['foobar']); @@ -339,12 +339,12 @@ function testSearchQueryByTag() { $file3 = 'folder/foo'; $file4 = 'folder/foo2'; $file5 = 'folder/foo3'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $fileData = array(); - $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); - $fileData['foo2'] = array('size' => 25, 'mtime' => 28, 'mimetype' => 'foo/file'); - $fileData['foo3'] = array('size' => 88, 'mtime' => 34, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $fileData = []; + $fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; + $fileData['foo2'] = ['size' => 25, 'mtime' => 28, 'mimetype' => 'foo/file']; + $fileData['foo3'] = ['size' => 88, 'mtime' => 34, 'mimetype' => 'foo/file']; $id1 = $this->cache->put($file1, $data1); $id2 = $this->cache->put($file2, $fileData['foobar']); @@ -387,10 +387,10 @@ function testSearchByQuery() { $file1 = 'folder'; $file2 = 'folder/foobar'; $file3 = 'folder/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $fileData = array(); - $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $fileData = []; + $fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file1, $data1); $this->cache->put($file2, $fileData['foobar']); @@ -430,8 +430,8 @@ function movePathProvider() { * @dataProvider movePathProvider */ function testMove($sourceFolder, $targetFolder, $children) { - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'); - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar']; + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // create folders foreach ([$sourceFolder, $targetFolder] as $current) { @@ -469,7 +469,7 @@ function testGetIncomplete() { $file2 = 'folder2'; $file3 = 'folder3'; $file4 = 'folder4'; - $data = array('size' => 10, 'mtime' => 50, 'mimetype' => 'foo/bar'); + $data = ['size' => 10, 'mtime' => 50, 'mimetype' => 'foo/bar']; $this->cache->put($file1, $data); $data['size'] = -1; @@ -484,44 +484,44 @@ function testGetIncomplete() { function testNonExisting() { $this->assertFalse($this->cache->get('foo.txt')); $this->assertFalse($this->cache->get(-1)); - $this->assertEquals(array(), $this->cache->getFolderContents('foo')); + $this->assertEquals([], $this->cache->getFolderContents('foo')); } function testGetById() { $storageId = $this->storage->getId(); - $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $id = $this->cache->put('foo', $data); if (strlen($storageId) > 64) { $storageId = md5($storageId); } - $this->assertEquals(array($storageId, 'foo'), \OC\Files\Cache\Cache::getById($id)); + $this->assertEquals([$storageId, 'foo'], \OC\Files\Cache\Cache::getById($id)); } function testStorageMTime() { - $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $this->cache->put('foo', $data); $cachedData = $this->cache->get('foo'); $this->assertEquals($data['mtime'], $cachedData['storage_mtime']); //if no storage_mtime is saved, mtime should be used - $this->cache->put('foo', array('storage_mtime' => 30)); //when setting storage_mtime, mtime is also set + $this->cache->put('foo', ['storage_mtime' => 30]); //when setting storage_mtime, mtime is also set $cachedData = $this->cache->get('foo'); $this->assertEquals(30, $cachedData['storage_mtime']); $this->assertEquals(30, $cachedData['mtime']); - $this->cache->put('foo', array('mtime' => 25)); //setting mtime does not change storage_mtime + $this->cache->put('foo', ['mtime' => 25]); //setting mtime does not change storage_mtime $cachedData = $this->cache->get('foo'); $this->assertEquals(30, $cachedData['storage_mtime']); $this->assertEquals(25, $cachedData['mtime']); } function testLongId() { - $storage = new LongId(array()); + $storage = new LongId([]); $cache = $storage->getCache(); $storageId = $storage->getId(); - $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $id = $cache->put('foo', $data); - $this->assertEquals(array(md5($storageId), 'foo'), \OC\Files\Cache\Cache::getById($id)); + $this->assertEquals([md5($storageId), 'foo'], \OC\Files\Cache\Cache::getById($id)); } /** @@ -546,7 +546,7 @@ public function testWithoutNormalizer() { ->method('normalize') ->willReturnArgument(0); - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // put root folder $this->assertFalse($cacheMock->get('folder')); @@ -586,7 +586,7 @@ public function testWithNormalizer() { // folder name "Schön" with U+0308 (un-normalized) $folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e"; - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // put root folder $this->assertFalse($this->cache->get('folder')); @@ -611,12 +611,12 @@ public function testWithNormalizer() { } function bogusPathNamesProvider() { - return array( - array('/bogus.txt', 'bogus.txt'), - array('//bogus.txt', 'bogus.txt'), - array('bogus/', 'bogus'), - array('bogus//', 'bogus'), - ); + return [ + ['/bogus.txt', 'bogus.txt'], + ['//bogus.txt', 'bogus.txt'], + ['bogus/', 'bogus'], + ['bogus//', 'bogus'], + ]; } /** @@ -625,7 +625,7 @@ function bogusPathNamesProvider() { * @dataProvider bogusPathNamesProvider */ public function testBogusPaths($bogusPath, $fixedBogusPath) { - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // put root folder $this->assertFalse($this->cache->get('')); @@ -647,12 +647,12 @@ public function testBogusPaths($bogusPath, $fixedBogusPath) { } public function testNoReuseOfFileId() { - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain']; $this->cache->put('somefile.txt', $data1); $info = $this->cache->get('somefile.txt'); $fileId = $info['fileid']; $this->cache->remove('somefile.txt'); - $data2 = array('size' => 200, 'mtime' => 100, 'mimetype' => 'text/plain'); + $data2 = ['size' => 200, 'mtime' => 100, 'mimetype' => 'text/plain']; $this->cache->put('anotherfile.txt', $data2); $info2 = $this->cache->get('anotherfile.txt'); $fileId2 = $info2['fileid']; @@ -672,7 +672,7 @@ public function escapingProvider() { * @dataProvider escapingProvider */ public function testEscaping($name) { - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain']; $this->cache->put($name, $data); $this->assertTrue($this->cache->inCache($name)); $retrievedData = $this->cache->get($name); @@ -684,7 +684,7 @@ public function testEscaping($name) { $this->assertTrue($this->cache->inCache($name . 'asd')); $this->cache->remove($name . 'asd'); $this->assertFalse($this->cache->inCache($name . 'asd')); - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->cache->put($name, $folderData); $this->cache->put('other', $folderData); $childs = ['asd', 'bar', 'foo', 'sub/folder']; @@ -788,8 +788,8 @@ protected function tearDown(): void { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); - $this->storage2 = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); + $this->storage2 = new \OC\Files\Storage\Temporary([]); $this->cache = new \OC\Files\Cache\Cache($this->storage); $this->cache2 = new \OC\Files\Cache\Cache($this->storage2); } diff --git a/tests/lib/Files/Cache/HomeCacheTest.php b/tests/lib/Files/Cache/HomeCacheTest.php index 51fc2e5bc9bc4..aacb91c675e88 100644 --- a/tests/lib/Files/Cache/HomeCacheTest.php +++ b/tests/lib/Files/Cache/HomeCacheTest.php @@ -70,7 +70,7 @@ protected function setUp(): void { parent::setUp(); $this->user = new DummyUser('foo', \OC::$server->getTempManager()->getTemporaryFolder()); - $this->storage = new \OC\Files\Storage\Home(array('user' => $this->user)); + $this->storage = new \OC\Files\Storage\Home(['user' => $this->user]); $this->cache = $this->storage->getCache(); } @@ -82,11 +82,11 @@ protected function setUp(): void { public function testRootFolderSizeIgnoresUnknownUpdate() { $dir1 = 'files/knownsize'; $dir2 = 'files/unknownsize'; - $fileData = array(); - $fileData[''] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData['files'] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir2] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory'); + $fileData = []; + $fileData[''] = ['size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData['files'] = ['size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir1] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir2] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory']; $this->cache->put('', $fileData['']); $this->cache->put('files', $fileData['files']); @@ -114,10 +114,10 @@ public function testRootFolderSizeIgnoresUnknownUpdate() { public function testRootFolderSizeIsFilesSize() { $dir1 = 'files'; $afile = 'test.txt'; - $fileData = array(); - $fileData[''] = array('size' => 1500, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$afile] = array('size' => 500, 'mtime' => 20); + $fileData = []; + $fileData[''] = ['size' => 1500, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir1] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$afile] = ['size' => 500, 'mtime' => 20]; $this->cache->put('', $fileData['']); $this->cache->put($dir1, $fileData[$dir1]); diff --git a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php index f93b95b5fe739..6e1430d146bdc 100644 --- a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php +++ b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php @@ -23,8 +23,8 @@ class MoveFromCacheTraitTest extends CacheTest { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); - $this->storage2 = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); + $this->storage2 = new \OC\Files\Storage\Temporary([]); $this->cache = new FallBackCrossCacheMoveCache($this->storage); $this->cache2 = new FallBackCrossCacheMoveCache($this->storage2); } diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index 6a025410cc3f6..52f6697cc6df2 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -36,7 +36,7 @@ class ScannerTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); $this->scanner = new \OC\Files\Cache\Scanner($this->storage); $this->cache = new \OC\Files\Cache\Cache($this->storage); } @@ -247,7 +247,7 @@ public function testReuseExisting() { $this->scanner->scan(''); $oldData = $this->cache->get(''); $this->storage->unlink('folder/bar.txt'); - $this->cache->put('folder', array('mtime' => $this->storage->filemtime('folder'), 'storage_mtime' => $this->storage->filemtime('folder'))); + $this->cache->put('folder', ['mtime' => $this->storage->filemtime('folder'), 'storage_mtime' => $this->storage->filemtime('folder')]); $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_SIZE); $newData = $this->cache->get(''); $this->assertIsString($oldData['etag']); @@ -345,7 +345,7 @@ public function testRepairParent() { // delete the folder without removing the childs $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; - \OC_DB::executeAudited($sql, array($oldFolderId)); + \OC_DB::executeAudited($sql, [$oldFolderId]); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); @@ -369,7 +369,7 @@ public function testRepairParentShallow() { // delete the folder without removing the childs $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; - \OC_DB::executeAudited($sql, array($oldFolderId)); + \OC_DB::executeAudited($sql, [$oldFolderId]); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php index a3b1a428c28f9..6366a8eb7eb6a 100644 --- a/tests/lib/Files/Cache/UpdaterLegacyTest.php +++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php @@ -40,7 +40,7 @@ class UpdaterLegacyTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); $textData = "dummy file data\n"; $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); $this->storage->mkdir('folder'); @@ -63,7 +63,7 @@ protected function setUp(): void { Filesystem::init(self::$user, '/' . self::$user . '/files'); Filesystem::clearMounts(); - Filesystem::mount($this->storage, array(), '/' . self::$user . '/files'); + Filesystem::mount($this->storage, [], '/' . self::$user . '/files'); \OC_Hook::clear('OC_Filesystem'); } @@ -85,7 +85,7 @@ protected function tearDown(): void { public function testWrite() { $textSize = strlen("dummy file data\n"); $imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png'); - $this->cache->put('foo.txt', array('mtime' => 100, 'storage_mtime' => 150)); + $this->cache->put('foo.txt', ['mtime' => 100, 'storage_mtime' => 150]); $rootCachedData = $this->cache->get(''); $this->assertEquals(3 * $textSize + $imageSize, $rootCachedData['size']); @@ -118,10 +118,10 @@ public function testWrite() { } public function testWriteWithMountPoints() { - $storage2 = new \OC\Files\Storage\Temporary(array()); + $storage2 = new \OC\Files\Storage\Temporary([]); $storage2->getScanner()->scan(''); //initialize etags $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage'); + Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage'); $view = new View('/' . self::$user . '/files'); $folderCachedData = $view->getFileInfo('folder'); $substorageCachedData = $cache2->get(''); @@ -179,9 +179,9 @@ public function testDelete() { } public function testDeleteWithMountPoints() { - $storage2 = new \OC\Files\Storage\Temporary(array()); + $storage2 = new \OC\Files\Storage\Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage'); + Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage'); Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd'); $view = new View('/' . self::$user . '/files'); $this->assertTrue($cache2->inCache('foo.txt')); @@ -235,9 +235,9 @@ public function testRenameExtension() { } public function testRenameWithMountPoints() { - $storage2 = new \OC\Files\Storage\Temporary(array()); + $storage2 = new \OC\Files\Storage\Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage'); + Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage'); Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd'); $view = new View('/' . self::$user . '/files'); $this->assertTrue($cache2->inCache('foo.txt')); diff --git a/tests/lib/Files/Cache/UpdaterTest.php b/tests/lib/Files/Cache/UpdaterTest.php index 8dc5893007bb3..f8880d0f2a87b 100644 --- a/tests/lib/Files/Cache/UpdaterTest.php +++ b/tests/lib/Files/Cache/UpdaterTest.php @@ -45,7 +45,7 @@ protected function setUp(): void { $this->loginAsUser(); - $this->storage = new Temporary(array()); + $this->storage = new Temporary([]); $this->updater = $this->storage->getUpdater(); $this->cache = $this->storage->getCache(); } @@ -220,9 +220,9 @@ public function testNewFileDisabled() { } public function testMoveCrossStorage() { - $storage2 = new Temporary(array()); + $storage2 = new Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/bar'); + Filesystem::mount($storage2, [], '/bar'); $this->storage->file_put_contents('foo.txt', 'qwerty'); $this->updater->update('foo.txt'); @@ -251,9 +251,9 @@ public function testMoveCrossStorage() { } public function testMoveFolderCrossStorage() { - $storage2 = new Temporary(array()); + $storage2 = new Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/bar'); + Filesystem::mount($storage2, [], '/bar'); $this->storage->mkdir('foo'); $this->storage->mkdir('foo/bar'); $this->storage->file_put_contents('foo/foo.txt', 'qwerty'); diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php index 18f0ebe98a926..2a42a9e603f55 100644 --- a/tests/lib/Files/Cache/WatcherTest.php +++ b/tests/lib/Files/Cache/WatcherTest.php @@ -20,7 +20,7 @@ class WatcherTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage[] $storages */ - private $storages = array(); + private $storages = []; protected function setUp(): void { parent::setUp(); @@ -49,7 +49,7 @@ function testWatcher() { $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); //set the mtime to the past so it can detect an mtime change - $cache->put('', array('storage_mtime' => 10)); + $cache->put('', ['storage_mtime' => 10]); $this->assertTrue($cache->inCache('folder/bar.txt')); $this->assertTrue($cache->inCache('folder/bar2.txt')); @@ -61,7 +61,7 @@ function testWatcher() { $cachedData = $cache->get('bar.test'); $this->assertEquals(3, $cachedData['size']); - $cache->put('bar.test', array('storage_mtime' => 10)); + $cache->put('bar.test', ['storage_mtime' => 10]); $storage->file_put_contents('bar.test', 'test data'); // make sure that PHP can read the new size correctly @@ -71,7 +71,7 @@ function testWatcher() { $cachedData = $cache->get('bar.test'); $this->assertEquals(9, $cachedData['size']); - $cache->put('folder', array('storage_mtime' => 10)); + $cache->put('folder', ['storage_mtime' => 10]); $storage->unlink('folder/bar2.txt'); $updater->checkUpdate('folder'); @@ -90,7 +90,7 @@ public function testFileToFolder() { $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); //set the mtime to the past so it can detect an mtime change - $cache->put('', array('storage_mtime' => 10)); + $cache->put('', ['storage_mtime' => 10]); $storage->unlink('foo.txt'); $storage->rename('folder', 'foo.txt'); @@ -107,7 +107,7 @@ public function testFileToFolder() { $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $storage->unlink('foo.txt'); $storage->rename('folder', 'foo.txt'); @@ -124,14 +124,14 @@ public function testPolicyNever() { $updater = $storage->getWatcher(); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_NEVER); $storage->file_put_contents('foo.txt', 'q'); $this->assertFalse($updater->checkUpdate('foo.txt')); - $cache->put('foo.txt', array('storage_mtime' => 20)); + $cache->put('foo.txt', ['storage_mtime' => 20]); $storage->file_put_contents('foo.txt', 'w'); $this->assertFalse($updater->checkUpdate('foo.txt')); } @@ -142,14 +142,14 @@ public function testPolicyOnce() { $updater = $storage->getWatcher(); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); $storage->file_put_contents('foo.txt', 'q'); $this->assertTrue($updater->checkUpdate('foo.txt')); - $cache->put('foo.txt', array('storage_mtime' => 20)); + $cache->put('foo.txt', ['storage_mtime' => 20]); $storage->file_put_contents('foo.txt', 'w'); $this->assertFalse($updater->checkUpdate('foo.txt')); } @@ -160,14 +160,14 @@ public function testPolicyAlways() { $updater = $storage->getWatcher(); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ALWAYS); $storage->file_put_contents('foo.txt', 'q'); $this->assertTrue($updater->checkUpdate('foo.txt')); - $cache->put('foo.txt', array('storage_mtime' => 20)); + $cache->put('foo.txt', ['storage_mtime' => 20]); $storage->file_put_contents('foo.txt', 'w'); $this->assertTrue($updater->checkUpdate('foo.txt')); } @@ -177,7 +177,7 @@ public function testPolicyAlways() { * @return \OC\Files\Storage\Storage */ private function getTestStorage($scan = true) { - $storage = new \OC\Files\Storage\Temporary(array()); + $storage = new \OC\Files\Storage\Temporary([]); $textData = "dummy file data\n"; $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); $storage->mkdir('folder'); diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index 9c1a8c14101ad..5d7e9f8ec08f1 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -34,7 +34,7 @@ protected function setUp(): void { function testSearchOutsideJail() { $file1 = 'foo/foobar'; $file2 = 'folder/foobar'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; $this->sourceCache->put($file1, $data1); $this->sourceCache->put($file2, $data1); @@ -50,7 +50,7 @@ function testClearKeepEntriesOutsideJail() { $file1 = 'foo/foobar'; $file2 = 'foo/foobar/asd'; $file3 = 'folder/foobar'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('foo', $data1); $this->sourceCache->put($file1, $data1); @@ -64,7 +64,7 @@ function testClearKeepEntriesOutsideJail() { } function testGetById() { - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $id = $this->sourceCache->put('foo/bar', $data1); // path from jailed foo of foo/bar is bar @@ -83,7 +83,7 @@ function testGetIncomplete() { } function testMoveFromJail() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('source', $folderData); $this->sourceCache->put('source/foo', $folderData); @@ -99,7 +99,7 @@ function testMoveFromJail() { } function testMoveToJail() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('source', $folderData); $this->sourceCache->put('source/foo', $folderData); @@ -115,7 +115,7 @@ function testMoveToJail() { } function testMoveBetweenJail() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('source', $folderData); $this->sourceCache->put('source/foo', $folderData); diff --git a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php index 9883fc1da276c..20c20974c0740 100644 --- a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php +++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php @@ -36,12 +36,12 @@ protected function getMaskedCached($mask) { } public function maskProvider() { - return array( - array(Constants::PERMISSION_ALL), - array(Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE), - array(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE), - array(Constants::PERMISSION_READ) - ); + return [ + [Constants::PERMISSION_ALL], + [Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE], + [Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE], + [Constants::PERMISSION_READ] + ]; } /** @@ -50,12 +50,12 @@ public function maskProvider() { */ public function testGetMasked($mask) { $cache = $this->getMaskedCached($mask); - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL]; $this->sourceCache->put('foo', $data); $result = $cache->get('foo'); $this->assertEquals($mask, $result['permissions']); - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE]; $this->sourceCache->put('bar', $data); $result = $cache->get('bar'); $this->assertEquals($mask & ~Constants::PERMISSION_DELETE, $result['permissions']); diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php index d3b372fe13762..8c6dd1964aba8 100644 --- a/tests/lib/Files/EtagTest.php +++ b/tests/lib/Files/EtagTest.php @@ -67,7 +67,7 @@ public function testNewUser() { Filesystem::file_put_contents('/folder/bar.txt', 'fgh'); Filesystem::file_put_contents('/folder/subfolder/qwerty.txt', 'jkl'); - $files = array('/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt'); + $files = ['/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt']; $originalEtags = $this->getEtags($files); $scanner = new \OC\Files\Utils\Scanner($user1, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger()); @@ -84,7 +84,7 @@ public function testNewUser() { * @param string[] $files */ private function getEtags($files) { - $etags = array(); + $etags = []; foreach ($files as $file) { $info = Filesystem::getFileInfo($file); $etags[$file] = $info['etag']; diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index 6d0362772ca69..d98256501b159 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -66,7 +66,7 @@ class FilesystemTest extends \Test\TestCase { /** * @var array tmpDirs */ - private $tmpDirs = array(); + private $tmpDirs = []; /** * @return array @@ -74,7 +74,7 @@ class FilesystemTest extends \Test\TestCase { private function getStorageData() { $dir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->tmpDirs[] = $dir; - return array('datadir' => $dir); + return ['datadir' => $dir]; } protected function setUp(): void { @@ -225,29 +225,29 @@ public function testNormalizePathKeepUnicodeCache() { } public function isValidPathData() { - return array( - array('/', true), - array('/path', true), - array('/foo/bar', true), - array('/foo//bar/', true), - array('/foo////bar', true), - array('/foo//\///bar', true), - array('/foo/bar/.', true), - array('/foo/bar/./', true), - array('/foo/bar/./.', true), - array('/foo/bar/././', true), - array('/foo/bar/././..bar', true), - array('/foo/bar/././..bar/a', true), - array('/foo/bar/././..', false), - array('/foo/bar/././../', false), - array('/foo/bar/.././', false), - array('/foo/bar/../../', false), - array('/foo/bar/../..\\', false), - array('..', false), - array('../', false), - array('../foo/bar', false), - array('..\foo/bar', false), - ); + return [ + ['/', true], + ['/path', true], + ['/foo/bar', true], + ['/foo//bar/', true], + ['/foo////bar', true], + ['/foo//\///bar', true], + ['/foo/bar/.', true], + ['/foo/bar/./', true], + ['/foo/bar/./.', true], + ['/foo/bar/././', true], + ['/foo/bar/././..bar', true], + ['/foo/bar/././..bar/a', true], + ['/foo/bar/././..', false], + ['/foo/bar/././../', false], + ['/foo/bar/.././', false], + ['/foo/bar/../../', false], + ['/foo/bar/../..\\', false], + ['..', false], + ['../', false], + ['../foo/bar', false], + ['..\foo/bar', false], + ]; } /** @@ -258,18 +258,18 @@ public function testIsValidPath($path, $expected) { } public function isFileBlacklistedData() { - return array( - array('/etc/foo/bar/foo.txt', false), - array('\etc\foo/bar\foo.txt', false), - array('.htaccess', true), - array('.htaccess/', true), - array('.htaccess\\', true), - array('/etc/foo\bar/.htaccess\\', true), - array('/etc/foo\bar/.htaccess/', true), - array('/etc/foo\bar/.htaccess/foo', false), - array('//foo//bar/\.htaccess/', true), - array('\foo\bar\.HTAccess', true), - ); + return [ + ['/etc/foo/bar/foo.txt', false], + ['\etc\foo/bar\foo.txt', false], + ['.htaccess', true], + ['.htaccess/', true], + ['.htaccess\\', true], + ['/etc/foo\bar/.htaccess\\', true], + ['/etc/foo\bar/.htaccess/', true], + ['/etc/foo\bar/.htaccess/foo', false], + ['//foo//bar/\.htaccess/', true], + ['\foo\bar\.HTAccess', true], + ]; } /** @@ -304,7 +304,7 @@ public function testHooks() { \OC_Hook::clear('OC_Filesystem'); \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); - \OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', array(), '/'); + \OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', [], '/'); $rootView = new \OC\Files\View(''); $rootView->mkdir('/' . $user); diff --git a/tests/lib/Files/Mount/ManagerTest.php b/tests/lib/Files/Mount/ManagerTest.php index f3cdc4264e4b7..1e80ec17ea118 100644 --- a/tests/lib/Files/Mount/ManagerTest.php +++ b/tests/lib/Files/Mount/ManagerTest.php @@ -30,39 +30,39 @@ protected function setUp(): void { public function testFind() { $this->assertNull($this->manager->find('/')); - $rootMount = new \OC\Files\Mount\MountPoint(new Temporary(array()), '/'); + $rootMount = new \OC\Files\Mount\MountPoint(new Temporary([]), '/'); $this->manager->addMount($rootMount); $this->assertEquals($rootMount, $this->manager->find('/')); $this->assertEquals($rootMount, $this->manager->find('/foo/bar')); - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount1 = new \OC\Files\Mount\MountPoint($storage, '/foo'); $this->manager->addMount($mount1); $this->assertEquals($rootMount, $this->manager->find('/')); $this->assertEquals($mount1, $this->manager->find('/foo/bar')); $this->assertEquals(1, count($this->manager->findIn('/'))); - $mount2 = new \OC\Files\Mount\MountPoint(new Temporary(array()), '/bar'); + $mount2 = new \OC\Files\Mount\MountPoint(new Temporary([]), '/bar'); $this->manager->addMount($mount2); $this->assertEquals(2, count($this->manager->findIn('/'))); $id = $mount1->getStorageId(); - $this->assertEquals(array($mount1), $this->manager->findByStorageId($id)); + $this->assertEquals([$mount1], $this->manager->findByStorageId($id)); $mount3 = new \OC\Files\Mount\MountPoint($storage, '/foo/bar'); $this->manager->addMount($mount3); - $this->assertEquals(array($mount1, $mount3), $this->manager->findByStorageId($id)); + $this->assertEquals([$mount1, $mount3], $this->manager->findByStorageId($id)); } public function testLong() { - $storage = new LongId(array()); + $storage = new LongId([]); $mount = new \OC\Files\Mount\MountPoint($storage, '/foo'); $this->manager->addMount($mount); $id = $mount->getStorageId(); $storageId = $storage->getId(); - $this->assertEquals(array($mount), $this->manager->findByStorageId($id)); - $this->assertEquals(array($mount), $this->manager->findByStorageId($storageId)); - $this->assertEquals(array($mount), $this->manager->findByStorageId(md5($storageId))); + $this->assertEquals([$mount], $this->manager->findByStorageId($id)); + $this->assertEquals([$mount], $this->manager->findByStorageId($storageId)); + $this->assertEquals([$mount], $this->manager->findByStorageId(md5($storageId))); } } diff --git a/tests/lib/Files/Mount/MountTest.php b/tests/lib/Files/Mount/MountTest.php index f21095f2fa52b..160545e784cde 100644 --- a/tests/lib/Files/Mount/MountTest.php +++ b/tests/lib/Files/Mount/MountTest.php @@ -31,7 +31,7 @@ public function testWrapper() { $wrapper = function ($mountPoint, $storage) use (&$test) { $test->assertEquals('/foo/', $mountPoint); $test->assertInstanceOf('\OC\Files\Storage\Storage', $storage); - return new Wrapper(array('storage' => $storage)); + return new Wrapper(['storage' => $storage]); }; $loader = new StorageFactory(); @@ -40,7 +40,7 @@ public function testWrapper() { $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') ->disableOriginalConstructor() ->getMock(); - $mount = new \OC\Files\Mount\MountPoint($storage, '/foo', array(), $loader); + $mount = new \OC\Files\Mount\MountPoint($storage, '/foo', [], $loader); $this->assertInstanceOf('\OC\Files\Storage\Wrapper\Wrapper', $mount->getStorage()); } } diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php index 69d31b28a963d..c6f468b796bbe 100644 --- a/tests/lib/Files/Node/FileTest.php +++ b/tests/lib/Files/Node/FileTest.php @@ -53,7 +53,7 @@ public function testGetContent() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $this->assertEquals('bar', $node->getContent()); @@ -75,7 +75,7 @@ public function testGetContentNotPermitted() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => 0))); + ->willReturn($this->getFileInfo(['permissions' => 0])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->getContent(); @@ -94,7 +94,7 @@ public function testPutContent() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $this->view->expects($this->once()) ->method('file_put_contents') @@ -117,7 +117,7 @@ public function testPutContentNotPermitted() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->putContent('bar'); @@ -132,7 +132,7 @@ public function testGetMimeType() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('mimetype' => 'text/plain'))); + ->willReturn($this->getFileInfo(['mimetype' => 'text/plain'])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $this->assertEquals('text/plain', $node->getMimeType()); @@ -167,7 +167,7 @@ public function testFOpenRead() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $fh = $node->fopen('r'); @@ -202,7 +202,7 @@ public function testFOpenWrite() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $fh = $node->fopen('w'); @@ -232,7 +232,7 @@ public function testFOpenReadNotPermitted() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => 0))); + ->willReturn($this->getFileInfo(['permissions' => 0])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('r'); @@ -257,7 +257,7 @@ public function testFOpenReadWriteNoReadPermissions() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_UPDATE])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('w'); @@ -282,7 +282,7 @@ public function testFOpenReadWriteNoWritePermissions() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('w'); diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index 979c7fd6da631..83ebc478370c1 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -64,10 +64,10 @@ public function testGetDirectoryContent() { $view->expects($this->any()) ->method('getDirectoryContent') ->with('/bar/foo') - ->willReturn(array( + ->willReturn([ new FileInfo('/bar/foo/asd', null, 'foo/asd', ['fileid' => 2, 'path' => '/bar/foo/asd', 'name' => 'asd', 'size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'], null), new FileInfo('/bar/foo/qwerty', null, 'foo/qwerty', ['fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory'], null) - )); + ]); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $children = $node->getDirectoryListing(); @@ -163,7 +163,7 @@ public function testNewFolder() { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $view->expects($this->once()) ->method('mkdir') @@ -195,7 +195,7 @@ public function testNewFolderNotPermitted() { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $node->newFolder('asd'); @@ -217,7 +217,7 @@ public function testNewFile() { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $view->expects($this->once()) ->method('touch') @@ -249,7 +249,7 @@ public function testNewFileNotPermitted() { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $node->newFile('asd'); @@ -308,14 +308,14 @@ public function testSearch() { $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->willReturn(array( - array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - )); + ->willReturn([ + ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->willReturn(array()); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') @@ -361,15 +361,15 @@ public function testSearchInRoot() { $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->willReturn(array( - array('fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'), - array('fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'), - )); + ->willReturn([ + ['fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'], + ['fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'], + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('') - ->willReturn(array()); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') @@ -412,14 +412,14 @@ public function testSearchInStorageRoot() { $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->willReturn(array( - array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - )); + ->willReturn([ + ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar') - ->willReturn(array()); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') @@ -478,21 +478,21 @@ public function testSearchSubStorages() { $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->willReturn(array( - array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - )); + ->willReturn([ + ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $subCache->expects($this->once()) ->method('search') ->with('%qw%') - ->willReturn(array( - array('fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - )); + ->willReturn([ + ['fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->willReturn(array($subMount)); + ->willReturn([$subMount]); $root->expects($this->once()) ->method('getMount') @@ -556,7 +556,7 @@ public function testGetById() { $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->willReturn(array()); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') @@ -659,7 +659,7 @@ public function testGetByIdOutsideFolder() { $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->willReturn(array()); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') @@ -727,7 +727,7 @@ public function testGetByIdMultipleStorages() { $root->expects($this->any()) ->method('getMountsIn') ->with('/bar/foo') - ->willReturn(array($mount2)); + ->willReturn([$mount2]); $root->expects($this->once()) ->method('getMount') diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php index 2a542a1097a1d..26cdf398d94a2 100644 --- a/tests/lib/Files/Node/IntegrationTest.php +++ b/tests/lib/Files/Node/IntegrationTest.php @@ -57,8 +57,8 @@ protected function setUp(): void { $this->createMock(ILogger::class), $this->createMock(IUserManager::class) ); - $storage = new Temporary(array()); - $subStorage = new Temporary(array()); + $storage = new Temporary([]); + $subStorage = new Temporary([]); $this->storages[] = $storage; $this->storages[] = $subStorage; $this->root->mount($storage, '/'); diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index 18cc4d8057480..b963a395560d1 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -203,13 +203,13 @@ public function testStat() { ->method('getUser') ->willReturn($this->user); - $stat = array( + $stat = [ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50, 'permissions' => 0 - ); + ]; $this->view->expects($this->once()) ->method('stat') @@ -225,12 +225,12 @@ public function testGetId() { ->method('getUser') ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') @@ -247,12 +247,12 @@ public function testGetSize() { ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') @@ -268,12 +268,12 @@ public function testGetEtag() { ->method('getUser') ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') @@ -289,12 +289,12 @@ public function testGetMTime() { ->method('getUser') ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') @@ -319,7 +319,7 @@ public function testGetStorage() { $this->view->expects($this->once()) ->method('resolvePath') ->with('/bar/foo') - ->willReturn(array($storage, 'foo')); + ->willReturn([$storage, 'foo']); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); @@ -349,7 +349,7 @@ public function testGetInternalPath() { $this->view->expects($this->once()) ->method('resolvePath') ->with('/bar/foo') - ->willReturn(array($storage, 'foo')); + ->willReturn([$storage, 'foo']); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); @@ -378,7 +378,7 @@ public function testTouchSetMTime() { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $node->touch(100); @@ -425,12 +425,12 @@ public function testTouchHooks() { $this->view->expects($this->any()) ->method('resolvePath') ->with('/bar/foo') - ->willReturn(array(null, 'foo')); + ->willReturn([null, 'foo']); $this->view->expects($this->any()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = $this->createTestNode($root, $this->view, '/bar/foo'); $node->touch(100); @@ -448,7 +448,7 @@ public function testTouchNotPermitted() { $this->view->expects($this->any()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $node->touch(100); diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php index 6c4189bdec7c9..c78bef07627ed 100644 --- a/tests/lib/Files/Node/RootTest.php +++ b/tests/lib/Files/Node/RootTest.php @@ -79,7 +79,7 @@ public function testGet() { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->willReturn($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'))); + ->willReturn($this->getFileInfo(['fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'])); $root->mount($storage, ''); $node = $root->get('/bar/foo'); diff --git a/tests/lib/Files/ObjectStore/NoopScannerTest.php b/tests/lib/Files/ObjectStore/NoopScannerTest.php index 8b879e8ab371e..570fc16ee9895 100644 --- a/tests/lib/Files/ObjectStore/NoopScannerTest.php +++ b/tests/lib/Files/ObjectStore/NoopScannerTest.php @@ -22,7 +22,7 @@ class NoopScannerTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); $this->scanner = new \OC\Files\ObjectStore\NoopScanner($this->storage); } diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index 91b24d8b6150f..b56978f4fee83 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -34,11 +34,11 @@ function writeObject($urn, $stream) { class NonSeekableStream extends Wrapper { public static function wrap($source) { - $context = stream_context_create(array( - 'nonseek' => array( + $context = stream_context_create([ + 'nonseek' => [ 'source' => $source - ) - )); + ] + ]); return Wrapper::wrapSource($source, $context, 'nonseek', self::class); } diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php index 6075e9af2934c..d5feb40840fcf 100644 --- a/tests/lib/Files/Storage/HomeTest.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -73,7 +73,7 @@ protected function setUp(): void { $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->userId = $this->getUniqueID('user_'); $this->user = new DummyUser($this->userId, $this->tmpDir); - $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user)); + $this->instance = new \OC\Files\Storage\Home(['user' => $this->user]); } protected function tearDown(): void { diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index 23738a25c2a33..467848112488c 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -39,7 +39,7 @@ protected function setUp(): void { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $this->instance = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); + $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); } protected function tearDown(): void { diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index a25a3f74f9e43..736cbfff4f0c4 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -80,13 +80,13 @@ public function testDirectories($directory) { $this->assertTrue($this->instance->isUpdatable('/' . $directory)); $dh = $this->instance->opendir('/'); - $content = array(); + $content = []; while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $content[] = $file; } } - $this->assertEquals(array($directory), $content); + $this->assertEquals([$directory], $content); $this->assertFalse($this->instance->mkdir('/' . $directory)); //can't create existing folders $this->assertTrue($this->instance->rmdir('/' . $directory)); @@ -97,13 +97,13 @@ public function testDirectories($directory) { $this->assertFalse($this->instance->rmdir('/' . $directory)); //can't remove non existing folders $dh = $this->instance->opendir('/'); - $content = array(); + $content = []; while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $content[] = $file; } } - $this->assertEquals(array(), $content); + $this->assertEquals([], $content); } public function fileNameProvider() { @@ -130,12 +130,12 @@ public function directoryProvider() { function loremFileProvider() { $root = \OC::$SERVERROOT . '/tests/data/'; - return array( + return [ // small file - array($root . 'lorem.txt'), + [$root . 'lorem.txt'], // bigger file (> 8 KB which is the standard PHP block size) - array($root . 'lorem-big.txt') - ); + [$root . 'lorem-big.txt'] + ]; } /** @@ -413,11 +413,11 @@ public function testRecursiveUnlink() { } public function hashProvider() { - return array( - array('Foobar', 'md5'), - array('Foobar', 'sha1'), - array('Foobar', 'sha256'), - ); + return [ + ['Foobar', 'md5'], + ['Foobar', 'sha1'], + ['Foobar', 'sha256'], + ]; } /** @@ -438,14 +438,14 @@ public function testHashInFileName() { $this->assertEquals('data', $this->instance->file_get_contents('#foo/test.txt')); $dh = $this->instance->opendir('#foo'); - $content = array(); + $content = []; while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $content[] = $file; } } - $this->assertEquals(array('test.txt'), $content); + $this->assertEquals(['test.txt'], $content); } public function testCopyOverWriteFile() { diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index a9d678e76e998..ac3880309c097 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -148,7 +148,7 @@ protected function setUp(): void { $this->logger = $this->createMock(Log::class); - $this->sourceStorage = new Temporary(array()); + $this->sourceStorage = new Temporary([]); $this->keyStore = $this->getMockBuilder('\OC\Encryption\Keys\Storage') ->disableOriginalConstructor()->getMock(); @@ -458,13 +458,13 @@ public function testCopyEncryption() { * @return array */ public function dataTestCopyAndRename() { - return array( - array('source', 'target', true, false, false), - array('source', 'target', true, true, false), - array('source', '/subFolder/target', true, false, false), - array('source', '/subFolder/target', true, true, true), - array('source', '/subFolder/target', false, true, false), - ); + return [ + ['source', 'target', true, false, false], + ['source', 'target', true, true, false], + ['source', '/subFolder/target', true, false, false], + ['source', '/subFolder/target', true, true, true], + ['source', '/subFolder/target', false, true, false], + ]; } public function testIsLocal() { @@ -512,16 +512,16 @@ public function testRmdir($path, $rmdirResult, $isExcluded, $encryptionEnabled) } public function dataTestRmdir() { - return array( - array('/file.txt', true, true, true), - array('/file.txt', false, true, true), - array('/file.txt', true, false, true), - array('/file.txt', false, false, true), - array('/file.txt', true, true, false), - array('/file.txt', false, true, false), - array('/file.txt', true, false, false), - array('/file.txt', false, false, false), - ); + return [ + ['/file.txt', true, true, true], + ['/file.txt', false, true, true], + ['/file.txt', true, false, true], + ['/file.txt', false, false, true], + ['/file.txt', true, true, false], + ['/file.txt', false, true, false], + ['/file.txt', true, false, false], + ['/file.txt', false, false, false], + ]; } /** @@ -547,10 +547,10 @@ public function testCopyKeys($excluded, $expected) { } public function dataTestCopyKeys() { - return array( - array(true, false), - array(false, true), - ); + return [ + [true, false], + [false, true], + ]; } /** @@ -613,13 +613,13 @@ public function testGetHeader($path, $strippedPathExists, $strippedPath) { } public function dataTestGetHeader() { - return array( - array('/foo/bar.txt', false, '/foo/bar.txt'), - array('/foo/bar.txt.part', false, '/foo/bar.txt'), - array('/foo/bar.txt.ocTransferId7437493.part', false, '/foo/bar.txt'), - array('/foo/bar.txt.part', true, '/foo/bar.txt'), - array('/foo/bar.txt.ocTransferId7437493.part', true, '/foo/bar.txt'), - ); + return [ + ['/foo/bar.txt', false, '/foo/bar.txt'], + ['/foo/bar.txt.part', false, '/foo/bar.txt'], + ['/foo/bar.txt.ocTransferId7437493.part', false, '/foo/bar.txt'], + ['/foo/bar.txt.part', true, '/foo/bar.txt'], + ['/foo/bar.txt.ocTransferId7437493.part', true, '/foo/bar.txt'], + ]; } /** diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index cb7003cb7ea3a..6c8905af76561 100644 --- a/tests/lib/Files/Storage/Wrapper/JailTest.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -17,24 +17,24 @@ class JailTest extends \Test\Files\Storage\Storage { protected function setUp(): void { parent::setUp(); - $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); + $this->sourceStorage = new \OC\Files\Storage\Temporary([]); $this->sourceStorage->mkdir('foo'); - $this->instance = new \OC\Files\Storage\Wrapper\Jail(array( + $this->instance = new \OC\Files\Storage\Wrapper\Jail([ 'storage' => $this->sourceStorage, 'root' => 'foo' - )); + ]); } protected function tearDown(): void { // test that nothing outside our jail is touched - $contents = array(); + $contents = []; $dh = $this->sourceStorage->opendir(''); while ($file = readdir($dh)) { if (!\OC\Files\Filesystem::isIgnoredDir($file)) { $contents[] = $file; } } - $this->assertEquals(array('foo'), $contents); + $this->assertEquals(['foo'], $contents); $this->sourceStorage->cleanUp(); parent::tearDown(); } diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index bfdd3d3ddbb84..1e69ee7165efc 100644 --- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -24,7 +24,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { protected function setUp(): void { parent::setUp(); - $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); + $this->sourceStorage = new \OC\Files\Storage\Temporary([]); $this->instance = $this->getMaskedStorage(Constants::PERMISSION_ALL); } @@ -34,10 +34,10 @@ protected function tearDown(): void { } protected function getMaskedStorage($mask) { - return new \OC\Files\Storage\Wrapper\PermissionsMask(array( + return new \OC\Files\Storage\Wrapper\PermissionsMask([ 'storage' => $this->sourceStorage, 'mask' => $mask - )); + ]); } public function testMkdirNoCreate() { @@ -129,10 +129,10 @@ public function testScanNewWrappedFiles() { public function testScanNewFilesNested() { $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE + Constants::PERMISSION_UPDATE); - $nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask(array( + $nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask([ 'storage' => $storage, 'mask' => Constants::PERMISSION_READ + Constants::PERMISSION_CREATE - )); + ]); $wrappedStorage = new Wrapper(['storage' => $nestedStorage]); $wrappedStorage->file_put_contents('foo', 'bar'); $wrappedStorage->getScanner()->scan(''); diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index 164541b670cb0..65cfe30eb1c58 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -31,8 +31,8 @@ protected function setUp(): void { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); - $this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000)); + $storage = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); + $this->instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => 10000000]); } protected function tearDown(): void { @@ -44,10 +44,10 @@ protected function tearDown(): void { * @param integer $limit */ protected function getLimitedStorage($limit) { - $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); + $storage = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); $storage->mkdir('files'); $storage->getScanner()->scan(''); - return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $limit)); + return new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => $limit]); } public function testFilePutContentsNotEnoughSpace() { @@ -70,7 +70,7 @@ public function testFreeSpace() { public function testFreeSpaceWithUsedSpace() { $instance = $this->getLimitedStorage(9); $instance->getCache()->put( - '', array('size' => 3) + '', ['size' => 3] ); $this->assertEquals(6, $instance->free_space('')); } @@ -85,9 +85,9 @@ public function testFreeSpaceWithUnknownDiskSpace() { ->willReturn(-2); $storage->getScanner()->scan(''); - $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9)); + $instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => 9]); $instance->getCache()->put( - '', array('size' => 3) + '', ['size' => 3] ); $this->assertEquals(6, $instance->free_space('')); } @@ -95,7 +95,7 @@ public function testFreeSpaceWithUnknownDiskSpace() { public function testFreeSpaceWithUsedSpaceAndEncryption() { $instance = $this->getLimitedStorage(9); $instance->getCache()->put( - '', array('size' => 7) + '', ['size' => 7] ); $this->assertEquals(2, $instance->free_space('')); } @@ -140,7 +140,7 @@ public function testReturnFalseWhenFopenFailed() { ->method('fopen') ->willReturn(false); - $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $failStorage, 'quota' => 1000)); + $instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $failStorage, 'quota' => 1000]); $this->assertFalse($instance->fopen('failedfopen', 'r')); } @@ -198,7 +198,7 @@ public function testSpaceRoot() { ->with('files') ->willReturn(new CacheEntry(['size' => 50])); - $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files')); + $instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => 1024, 'root' => 'files']); $this->assertEquals(1024 - 50, $instance->free_space('')); } diff --git a/tests/lib/Files/Storage/Wrapper/WrapperTest.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php index 2477b361bc117..b9bb54e09b2db 100644 --- a/tests/lib/Files/Storage/Wrapper/WrapperTest.php +++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php @@ -18,8 +18,8 @@ protected function setUp(): void { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); - $this->instance = new \OC\Files\Storage\Wrapper\Wrapper(array('storage' => $storage)); + $storage = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); + $this->instance = new \OC\Files\Storage\Wrapper\Wrapper(['storage' => $storage]); } protected function tearDown(): void { diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index e55dae98cb671..43114ff70f3ab 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -101,7 +101,7 @@ public function testStreamOpen($isMasterKeyUsed, $fileMock->expects($this->once())->method('getAccessList') ->willReturnCallback(function ($sharePath) use ($expectedSharePath) { $this->assertSame($expectedSharePath, $sharePath); - return array(); + return []; }); } $utilMock = $this->getMockBuilder('\OC\Encryption\Util') @@ -138,7 +138,7 @@ public function testStreamOpen($isMasterKeyUsed, $fullPathP->setAccessible(false); $header = $stream->getProperty('header'); $header->setAccessible(true); - $header->setValue($streamWrapper, array()); + $header->setValue($streamWrapper, []); $header->setAccessible(false); $this->invokePrivate($streamWrapper, 'signed', [true]); diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index 9d82e4ae1e1dc..c5183ac3929e8 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -21,7 +21,7 @@ class TestScanner extends \OC\Files\Utils\Scanner { /** * @var \OC\Files\Mount\MountPoint[] $mounts */ - private $mounts = array(); + private $mounts = []; /** * @param \OC\Files\Mount\MountPoint $mount @@ -63,7 +63,7 @@ protected function tearDown(): void { } public function testReuseExistingRoot() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); @@ -85,7 +85,7 @@ public function testReuseExistingRoot() { } public function testReuseExistingFile() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); @@ -112,7 +112,7 @@ public function testScanSubMount() { $mountProvider = $this->createMock(IMountProvider::class); - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, '/' . $uid . '/files/foo'); $mountProvider->expects($this->any()) @@ -169,7 +169,7 @@ public function testInvalidPathScanning($invalidPath) { } public function testPropagateEtag() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); @@ -213,7 +213,7 @@ public function testSkipLocalShares() { } public function testShallow() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); diff --git a/tests/lib/Group/Backend.php b/tests/lib/Group/Backend.php index f702d94b2b480..541ed78719b3d 100644 --- a/tests/lib/Group/Backend.php +++ b/tests/lib/Group/Backend.php @@ -108,15 +108,15 @@ public function testUser() { $this->assertFalse($this->backend->addToGroup($user1, $group1)); - $this->assertEquals(array($user1), $this->backend->usersInGroup($group1)); - $this->assertEquals(array(), $this->backend->usersInGroup($group2)); + $this->assertEquals([$user1], $this->backend->usersInGroup($group1)); + $this->assertEquals([], $this->backend->usersInGroup($group2)); - $this->assertEquals(array($group1), $this->backend->getUserGroups($user1)); - $this->assertEquals(array(), $this->backend->getUserGroups($user2)); + $this->assertEquals([$group1], $this->backend->getUserGroups($user1)); + $this->assertEquals([], $this->backend->getUserGroups($user2)); $this->backend->deleteGroup($group1); - $this->assertEquals(array(), $this->backend->getUserGroups($user1)); - $this->assertEquals(array(), $this->backend->usersInGroup($group1)); + $this->assertEquals([], $this->backend->getUserGroups($user1)); + $this->assertEquals([], $this->backend->usersInGroup($group1)); $this->assertFalse($this->backend->inGroup($user1, $group1)); } diff --git a/tests/lib/Group/DatabaseTest.php b/tests/lib/Group/DatabaseTest.php index 4af8b1cd4308c..586d77e0ec0b5 100644 --- a/tests/lib/Group/DatabaseTest.php +++ b/tests/lib/Group/DatabaseTest.php @@ -31,7 +31,7 @@ * @group DB */ class DatabaseTest extends Backend { - private $groups = array(); + private $groups = []; /** * get a new unique group name diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php index 554432a2c865b..fe44216887019 100644 --- a/tests/lib/Group/GroupTest.php +++ b/tests/lib/Group/GroupTest.php @@ -56,11 +56,11 @@ protected function getUserManager() { $user3 = $this->newUser('user3', $backend); $userManager->expects($this->any()) ->method('get') - ->willReturnMap(array( - array('user1', $user1), - array('user2', $user2), - array('user3', $user3) - )); + ->willReturnMap([ + ['user1', $user1], + ['user2', $user2], + ['user3', $user3] + ]); return $userManager; } @@ -69,12 +69,12 @@ public function testGetUsersSingleBackend() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('usersInGroup') ->with('group1') - ->willReturn(array('user1', 'user2')); + ->willReturn(['user1', 'user2']); $users = $group->getUsers(); @@ -93,17 +93,17 @@ public function testGetUsersMultipleBackends() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('usersInGroup') ->with('group1') - ->willReturn(array('user1', 'user2')); + ->willReturn(['user1', 'user2']); $backend2->expects($this->once()) ->method('usersInGroup') ->with('group1') - ->willReturn(array('user2', 'user3')); + ->willReturn(['user2', 'user3']); $users = $group->getUsers(); @@ -124,7 +124,7 @@ public function testInGroupSingleBackend() { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') @@ -145,7 +145,7 @@ public function testInGroupMultipleBackends() { $userBackend = $this->getMockBuilder(\OC\User\Backend::class) ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('inGroup') @@ -168,7 +168,7 @@ public function testAddUser() { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') @@ -193,7 +193,7 @@ public function testAddUserAlreadyInGroup() { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') @@ -217,7 +217,7 @@ public function testRemoveUser() { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') @@ -242,7 +242,7 @@ public function testRemoveUserNotInGroup() { $userBackend = $this->getMockBuilder(\OC\User\Backend::class) ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') @@ -269,7 +269,7 @@ public function testRemoveUserMultipleBackends() { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('inGroup') @@ -303,12 +303,12 @@ public function testSearchUsers() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('usersInGroup') ->with('group1', '2') - ->willReturn(array('user2')); + ->willReturn(['user2']); $users = $group->searchUsers('2'); @@ -325,16 +325,16 @@ public function testSearchUsersMultipleBackends() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('usersInGroup') ->with('group1', '2') - ->willReturn(array('user2')); + ->willReturn(['user2']); $backend2->expects($this->once()) ->method('usersInGroup') ->with('group1', '2') - ->willReturn(array('user2')); + ->willReturn(['user2']); $users = $group->searchUsers('2'); @@ -348,12 +348,12 @@ public function testSearchUsersLimitAndOffset() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('usersInGroup') ->with('group1', 'user', 1, 1) - ->willReturn(array('user2')); + ->willReturn(['user2']); $users = $group->searchUsers('user', 1, 1); @@ -370,16 +370,16 @@ public function testSearchUsersMultipleBackendsLimitAndOffset() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('usersInGroup') ->with('group1', 'user', 2, 1) - ->willReturn(array('user2')); + ->willReturn(['user2']); $backend2->expects($this->once()) ->method('usersInGroup') ->with('group1', 'user', 2, 1) - ->willReturn(array('user1')); + ->willReturn(['user1']); $users = $group->searchUsers('user', 2, 1); @@ -395,7 +395,7 @@ public function testCountUsers() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('countUsersInGroup') @@ -419,7 +419,7 @@ public function testCountUsersMultipleBackends() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('countUsersInGroup') @@ -447,7 +447,7 @@ public function testCountUsersNoMethod() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1], $this->dispatcher, $userManager); $backend1->expects($this->never()) ->method('countUsersInGroup'); @@ -465,7 +465,7 @@ public function testDelete() { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('deleteGroup') diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php index 8385c924edfff..73b315ac297b6 100644 --- a/tests/lib/Group/ManagerTest.php +++ b/tests/lib/Group/ManagerTest.php @@ -255,7 +255,7 @@ public function testSearch() { $backend->expects($this->once()) ->method('getGroups') ->with('1') - ->willReturn(array('group1')); + ->willReturn(['group1']); $backend->expects($this->once()) ->method('groupExists') ->with('group1') @@ -278,7 +278,7 @@ public function testSearchMultipleBackends() { $backend1->expects($this->once()) ->method('getGroups') ->with('1') - ->willReturn(array('group1')); + ->willReturn(['group1']); $backend1->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -290,7 +290,7 @@ public function testSearchMultipleBackends() { $backend2->expects($this->once()) ->method('getGroups') ->with('1') - ->willReturn(array('group12', 'group1')); + ->willReturn(['group12', 'group1']); $backend2->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -315,7 +315,7 @@ public function testSearchMultipleBackendsLimitAndOffset() { $backend1->expects($this->once()) ->method('getGroups') ->with('1', 2, 1) - ->willReturn(array('group1')); + ->willReturn(['group1']); $backend1->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -327,7 +327,7 @@ public function testSearchMultipleBackendsLimitAndOffset() { $backend2->expects($this->once()) ->method('getGroups') ->with('1', 2, 1) - ->willReturn(array('group12')); + ->willReturn(['group12']); $backend2->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -374,7 +374,7 @@ public function testGetUserGroups() { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1')); + ->willReturn(['group1']); $backend->expects($this->any()) ->method('groupExists') ->with('group1') @@ -421,7 +421,7 @@ public function testGetUserGroupsWithDeletedGroup() { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1')); + ->willReturn(['group1']); $backend->expects($this->any()) ->method('groupExists') ->with('group1') @@ -448,7 +448,7 @@ public function testInGroup() { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1', 'admin', 'group2')); + ->willReturn(['group1', 'admin', 'group2']); $backend->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -467,7 +467,7 @@ public function testIsAdmin() { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1', 'admin', 'group2')); + ->willReturn(['group1', 'admin', 'group2']); $backend->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -486,7 +486,7 @@ public function testNotAdmin() { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1', 'group2')); + ->willReturn(['group1', 'group2']); $backend->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -505,7 +505,7 @@ public function testGetUserGroupsMultipleBackends() { $backend1->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1')); + ->willReturn(['group1']); $backend1->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -517,7 +517,7 @@ public function testGetUserGroupsMultipleBackends() { $backend2->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->willReturn(array('group1', 'group2')); + ->willReturn(['group1', 'group2']); $backend1->expects($this->any()) ->method('groupExists') ->willReturn(true); @@ -730,7 +730,7 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty() { $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', -1, 0) - ->willReturn(array('user2', 'user33')); + ->willReturn(['user2', 'user33']); $this->userManager->expects($this->any()) ->method('get') @@ -769,7 +769,7 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitS $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', 1, 0) - ->willReturn(array('user2')); + ->willReturn(['user2']); $this->userManager->expects($this->any()) ->method('get') @@ -808,7 +808,7 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitA $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', 1, 1) - ->willReturn(array('user33')); + ->willReturn(['user33']); $this->userManager->expects($this->any()) ->method('get') @@ -857,7 +857,7 @@ public function testGetUserGroupsWithAddUser() { // prime cache $user1 = $this->getTestUser('user1'); $groups = $manager->getUserGroups($user1); - $this->assertEquals(array(), $groups); + $this->assertEquals([], $groups); // add user $group = $manager->get('group1'); @@ -907,7 +907,7 @@ public function testGetUserGroupsWithRemoveUser() { // remove user $group = $manager->get('group1'); $group->removeUser($user1); - $expectedGroups = array(); + $expectedGroups = []; // check result $groups = $manager->getUserGroups($user1); diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index 29250109d0220..606a527f5c9b8 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -46,7 +46,7 @@ protected function tearDown(): void { $this->storageMock = null; } \OC\Files\Filesystem::tearDown(); - \OC\Files\Filesystem::mount($this->storage, array(), '/'); + \OC\Files\Filesystem::mount($this->storage, [], '/'); \OC_User::setUserId(''); $user = \OC::$server->getUserManager()->get($this->user); @@ -80,7 +80,7 @@ private function getStorageMock($freeSpace = 12) { */ function testGetStorageInfo() { $homeStorage = $this->getStorageMock(12); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); $storageInfo = \OC_Helper::getStorageInfo(''); @@ -94,14 +94,14 @@ function testGetStorageInfo() { */ function testGetStorageInfoExcludingExtStorage() { $homeStorage = $this->getStorageMock(12); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); - $extStorage = new \OC\Files\Storage\Temporary(array()); + $extStorage = new \OC\Files\Storage\Temporary([]); $extStorage->file_put_contents('extfile.txt', 'abcdefghijklmnopq'); $extStorage->getScanner()->scan(''); // update root size - \OC\Files\Filesystem::mount($extStorage, array(), '/' . $this->user . '/files/ext'); + \OC\Files\Filesystem::mount($extStorage, [], '/' . $this->user . '/files/ext'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(12, $storageInfo['free']); @@ -113,15 +113,15 @@ function testGetStorageInfoExcludingExtStorage() { * Test getting the storage info, including extra mount points */ function testGetStorageInfoIncludingExtStorage() { - $homeStorage = new \OC\Files\Storage\Temporary(array()); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + $homeStorage = new \OC\Files\Storage\Temporary([]); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); - $extStorage = new \OC\Files\Storage\Temporary(array()); + $extStorage = new \OC\Files\Storage\Temporary([]); $extStorage->file_put_contents('extfile.txt', 'abcdefghijklmnopq'); $extStorage->getScanner()->scan(''); // update root size - \OC\Files\Filesystem::mount($extStorage, array(), '/' . $this->user . '/files/ext'); + \OC\Files\Filesystem::mount($extStorage, [], '/' . $this->user . '/files/ext'); $config = \OC::$server->getConfig(); $oldConfig = $config->getSystemValue('quota_include_external_storage', false); @@ -145,14 +145,14 @@ function testGetStorageInfoIncludingExtStorage() { */ function testGetStorageInfoIncludingExtStorageWithNoUserQuota() { $homeStorage = $this->getStorageMock(12); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); - $extStorage = new \OC\Files\Storage\Temporary(array()); + $extStorage = new \OC\Files\Storage\Temporary([]); $extStorage->file_put_contents('extfile.txt', 'abcdefghijklmnopq'); $extStorage->getScanner()->scan(''); // update root size - \OC\Files\Filesystem::mount($extStorage, array(), '/' . $this->user . '/files/ext'); + \OC\Files\Filesystem::mount($extStorage, [], '/' . $this->user . '/files/ext'); $config = \OC::$server->getConfig(); $oldConfig = $config->getSystemValue('quota_include_external_storage', false); @@ -174,12 +174,12 @@ function testGetStorageInfoWithQuota() { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '01234'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( - array( + [ 'storage' => $homeStorage, 'quota' => 7 - ) + ] ); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(2, $storageInfo['free']); @@ -194,12 +194,12 @@ function testGetStorageInfoWhenSizeExceedsQuota() { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '0123456789'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( - array( + [ 'storage' => $homeStorage, 'quota' => 7 - ) + ] ); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(0, $storageInfo['free']); @@ -216,12 +216,12 @@ function testGetStorageInfoWhenFreeSpaceLessThanQuota() { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '01234'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( - array( + [ 'storage' => $homeStorage, 'quota' => 18 - ) + ] ); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(12, $storageInfo['free']); diff --git a/tests/lib/HookHelper.php b/tests/lib/HookHelper.php index f1cce831477b8..5e040724d90f6 100644 --- a/tests/lib/HookHelper.php +++ b/tests/lib/HookHelper.php @@ -62,45 +62,45 @@ public static function clear() { } public static function createCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_create, 'params' => $params - ); + ]; } public static function updateCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_update, 'params' => $params - ); + ]; } public static function writeCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_write, 'params' => $params - ); + ]; } public static function postCreateCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_create, 'params' => $params - ); + ]; } public static function postUpdateCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_update, 'params' => $params - ); + ]; } public static function postWriteCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_write, 'params' => $params - ); + ]; } /** diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php index 1f88dee103250..01ae4d4f28b03 100644 --- a/tests/lib/Hooks/BasicEmitterTest.php +++ b/tests/lib/Hooks/BasicEmitterTest.php @@ -16,7 +16,7 @@ * @package Test\Hooks */ class DummyEmitter extends \OC\Hooks\BasicEmitter { - public function emitEvent($scope, $method, $arguments = array()) { + public function emitEvent($scope, $method, $arguments = []) { $this->emit($scope, $method, $arguments); } } @@ -64,7 +64,7 @@ public function testAnonymousFunction() { public function testStaticCallback() { $this->expectException(\Test\Hooks\EmittedException::class); - $this->emitter->listen('Test', 'test', array('\Test\Hooks\BasicEmitterTest', 'staticCallBack')); + $this->emitter->listen('Test', 'test', ['\Test\Hooks\BasicEmitterTest', 'staticCallBack']); $this->emitter->emitEvent('Test', 'test'); } @@ -72,7 +72,7 @@ public function testStaticCallback() { public function testNonStaticCallback() { $this->expectException(\Test\Hooks\EmittedException::class); - $this->emitter->listen('Test', 'test', array($this, 'nonStaticCallBack')); + $this->emitter->listen('Test', 'test', [$this, 'nonStaticCallBack']); $this->emitter->emitEvent('Test', 'test'); } @@ -134,7 +134,7 @@ public function testArguments() { throw new EmittedException; } }); - $this->emitter->emitEvent('Test', 'test', array('foo', 'bar')); + $this->emitter->emitEvent('Test', 'test', ['foo', 'bar']); } @@ -146,7 +146,7 @@ public function testNamedArguments() { throw new EmittedException; } }); - $this->emitter->emitEvent('Test', 'test', array('foo' => 'foo', 'bar' => 'bar')); + $this->emitter->emitEvent('Test', 'test', ['foo' => 'foo', 'bar' => 'bar']); } public function testRemoveAllSpecified() { diff --git a/tests/lib/Hooks/ForwardingEmitterTest.php b/tests/lib/Hooks/ForwardingEmitterTest.php index ea8ee5c412130..9b0a51d1bd48c 100644 --- a/tests/lib/Hooks/ForwardingEmitterTest.php +++ b/tests/lib/Hooks/ForwardingEmitterTest.php @@ -10,7 +10,7 @@ use OC\Hooks\PublicEmitter; class DummyForwardingEmitter extends \OC\Hooks\ForwardingEmitter { - public function emitEvent($scope, $method, $arguments = array()) { + public function emitEvent($scope, $method, $arguments = []) { $this->emit($scope, $method, $arguments); } diff --git a/tests/lib/Hooks/LegacyEmitterTest.php b/tests/lib/Hooks/LegacyEmitterTest.php index 32c923d8013a4..3b9eb26ec504b 100644 --- a/tests/lib/Hooks/LegacyEmitterTest.php +++ b/tests/lib/Hooks/LegacyEmitterTest.php @@ -16,7 +16,7 @@ * @package Test\Hooks */ class DummyLegacyEmitter extends \OC\Hooks\LegacyEmitter { - public function emitEvent($scope, $method, $arguments = array()) { + public function emitEvent($scope, $method, $arguments = []) { $this->emit($scope, $method, $arguments); } } @@ -51,7 +51,7 @@ public function testLegacyHook() { public function testLegacyArguments() { \OC_Hook::connect('Test', 'test', '\Test\Hooks\LegacyEmitterTest', 'staticLegacyArgumentsCallBack'); - $this->emitter->emitEvent('Test', 'test', array('foo' => 'foo', 'bar' => 'bar')); + $this->emitter->emitEvent('Test', 'test', ['foo' => 'foo', 'bar' => 'bar']); $this->assertEquals(true, self::$emitted); } } diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 34fcf0e004dc7..3858945d19178 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -345,11 +345,11 @@ public function testScaleDownWhenBigger($filename, $asked, $expected) { } function convertDataProvider() { - return array( - array( 'image/gif'), - array( 'image/jpeg'), - array( 'image/png'), - ); + return [ + [ 'image/gif'], + [ 'image/jpeg'], + [ 'image/png'], + ]; } /** diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 22b026eaae524..7d99316f479f1 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -780,7 +780,7 @@ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() { ->expects($this->once()) ->method('getOnlyDefaultAliases') ->willReturn( - array ( + [ '_comment' => 'Array of mimetype aliases.', '_comment2' => 'Any changes you make here will be overwritten on an update of Nextcloud.', '_comment3' => 'Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud', @@ -881,13 +881,13 @@ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() { 'text/x-shellscript' => 'text/code', 'web' => 'text/code', 'application/internet-shortcut' => 'link', - )); + ]); $this->mimeTypeDetector ->expects($this->once()) ->method('getAllAliases') ->willReturn( - array ( + [ '_comment' => 'Array of mimetype aliases.', '_comment2' => 'Any changes you make here will be overwritten on an update of Nextcloud.', '_comment3' => 'Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud', @@ -989,7 +989,7 @@ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() { 'text/x-shellscript' => 'text/code', 'web' => 'text/code', 'application/internet-shortcut' => 'link', - )); + ]); $this->environmentHelper ->expects($this->any()) diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index dd0fa000b7e3b..b2e7d5ebfc955 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -78,39 +78,39 @@ public function testCzechPluralTranslations() { } public function localizationData() { - return array( + return [ // timestamp as string - array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', '1234567890'), - array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', '1234567890'), - array('February 13, 2009', 'en', 'en_US', 'date', '1234567890'), - array('13. Februar 2009', 'de', 'de_DE', 'date', '1234567890'), - array('11:31:30 PM GMT+0', 'en', 'en_US', 'time', '1234567890'), - array('23:31:30 GMT+0', 'de', 'de_DE', 'time', '1234567890'), + ['February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', '1234567890'], + ['13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', '1234567890'], + ['February 13, 2009', 'en', 'en_US', 'date', '1234567890'], + ['13. Februar 2009', 'de', 'de_DE', 'date', '1234567890'], + ['11:31:30 PM GMT+0', 'en', 'en_US', 'time', '1234567890'], + ['23:31:30 GMT+0', 'de', 'de_DE', 'time', '1234567890'], // timestamp as int - array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', 1234567890), - array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', 1234567890), - array('February 13, 2009', 'en', 'en_US', 'date', 1234567890), - array('13. Februar 2009', 'de', 'de_DE', 'date', 1234567890), - array('11:31:30 PM GMT+0', 'en', 'en_US', 'time', 1234567890), - array('23:31:30 GMT+0', 'de', 'de_DE', 'time', 1234567890), + ['February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', 1234567890], + ['13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', 1234567890], + ['February 13, 2009', 'en', 'en_US', 'date', 1234567890], + ['13. Februar 2009', 'de', 'de_DE', 'date', 1234567890], + ['11:31:30 PM GMT+0', 'en', 'en_US', 'time', 1234567890], + ['23:31:30 GMT+0', 'de', 'de_DE', 'time', 1234567890], // DateTime object - array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', new DateTime('@1234567890')), - array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', new DateTime('@1234567890')), - array('February 13, 2009', 'en', 'en_US', 'date', new DateTime('@1234567890')), - array('13. Februar 2009', 'de', 'de_DE', 'date', new DateTime('@1234567890')), - array('11:31:30 PM GMT+0', 'en', 'en_US', 'time', new DateTime('@1234567890')), - array('23:31:30 GMT+0', 'de', 'de_DE', 'time', new DateTime('@1234567890')), + ['February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', new DateTime('@1234567890')], + ['13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', new DateTime('@1234567890')], + ['February 13, 2009', 'en', 'en_US', 'date', new DateTime('@1234567890')], + ['13. Februar 2009', 'de', 'de_DE', 'date', new DateTime('@1234567890')], + ['11:31:30 PM GMT+0', 'en', 'en_US', 'time', new DateTime('@1234567890')], + ['23:31:30 GMT+0', 'de', 'de_DE', 'time', new DateTime('@1234567890')], // en_GB - array('13 February 2009 at 23:31:30 GMT+0', 'en_GB', 'en_GB', 'datetime', new DateTime('@1234567890')), - array('13 February 2009', 'en_GB', 'en_GB', 'date', new DateTime('@1234567890')), - array('23:31:30 GMT+0', 'en_GB', 'en_GB', 'time', new DateTime('@1234567890')), - array('13 February 2009 at 23:31:30 GMT+0', 'en-GB', 'en_GB', 'datetime', new DateTime('@1234567890')), - array('13 February 2009', 'en-GB', 'en_GB', 'date', new DateTime('@1234567890')), - array('23:31:30 GMT+0', 'en-GB', 'en_GB', 'time', new DateTime('@1234567890')), - ); + ['13 February 2009 at 23:31:30 GMT+0', 'en_GB', 'en_GB', 'datetime', new DateTime('@1234567890')], + ['13 February 2009', 'en_GB', 'en_GB', 'date', new DateTime('@1234567890')], + ['23:31:30 GMT+0', 'en_GB', 'en_GB', 'time', new DateTime('@1234567890')], + ['13 February 2009 at 23:31:30 GMT+0', 'en-GB', 'en_GB', 'datetime', new DateTime('@1234567890')], + ['13 February 2009', 'en-GB', 'en_GB', 'date', new DateTime('@1234567890')], + ['23:31:30 GMT+0', 'en-GB', 'en_GB', 'time', new DateTime('@1234567890')], + ]; } /** @@ -122,10 +122,10 @@ public function testNumericStringLocalization($expectedDate, $lang, $locale, $ty } public function firstDayData() { - return array( - array(1, 'de', 'de_DE'), - array(0, 'en', 'en_US'), - ); + return [ + [1, 'de', 'de_DE'], + [0, 'en', 'en_US'], + ]; } /** @@ -140,10 +140,10 @@ public function testFirstWeekDay($expected, $lang, $locale) { } public function jsDateData() { - return array( - array('dd.MM.yy', 'de', 'de_DE'), - array('M/d/yy', 'en', 'en_US'), - ); + return [ + ['dd.MM.yy', 'de', 'de_DE'], + ['M/d/yy', 'en', 'en_US'], + ]; } /** diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index e023819a08893..f6e85ea188c6b 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -35,15 +35,15 @@ public function testHumanFileSize($expected, $input) public function humanFileSizeProvider() { - return array( - array('0 B', 0), - array('1 KB', 1024), - array('9.5 MB', 10000000), - array('1.3 GB', 1395864371), - array('465.7 GB', 500000000000), - array('454.7 TB', 500000000000000), - array('444.1 PB', 500000000000000000), - ); + return [ + ['0 B', 0], + ['1 KB', 1024], + ['9.5 MB', 10000000], + ['1.3 GB', 1395864371], + ['465.7 GB', 500000000000], + ['454.7 TB', 500000000000000], + ['444.1 PB', 500000000000000000], + ]; } /** @@ -66,36 +66,36 @@ function providesComputerFileSize(){ } function testMb_array_change_key_case() { - $arrayStart = array( + $arrayStart = [ "Foo" => "bar", "Bar" => "foo", - ); - $arrayResult = array( + ]; + $arrayResult = [ "foo" => "bar", "bar" => "foo", - ); + ]; $result = OC_Helper::mb_array_change_key_case($arrayStart); $expected = $arrayResult; $this->assertEquals($result, $expected); - $arrayStart = array( + $arrayStart = [ "foo" => "bar", "bar" => "foo", - ); - $arrayResult = array( + ]; + $arrayResult = [ "FOO" => "bar", "BAR" => "foo", - ); + ]; $result = OC_Helper::mb_array_change_key_case($arrayStart, MB_CASE_UPPER); $expected = $arrayResult; $this->assertEquals($result, $expected); } function testRecursiveArraySearch() { - $haystack = array( + $haystack = [ "Foo" => "own", "Bar" => "Cloud", - ); + ]; $result = OC_Helper::recursiveArraySearch($haystack, "own"); $expected = "Foo"; @@ -192,12 +192,12 @@ public function testStreamCopy($expectedCount, $expectedResult, $source, $target function streamCopyDataProvider() { - return array( - array(0, false, false, false), - array(0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false), - array(filesize(\OC::$SERVERROOT . '/tests/data/lorem.txt'), true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'), - array(3670, true, \OC::$SERVERROOT . '/tests/data/testimage.png', \OC::$SERVERROOT . '/tests/data/testimage-copy.png'), - ); + return [ + [0, false, false, false], + [0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false], + [filesize(\OC::$SERVERROOT . '/tests/data/lorem.txt'), true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'], + [3670, true, \OC::$SERVERROOT . '/tests/data/testimage.png', \OC::$SERVERROOT . '/tests/data/testimage-copy.png'], + ]; } /** @@ -234,7 +234,7 @@ public function testRecursiveFolderDeletion() { * @return mixed * @deprecated Please extend \Test\TestCase and use self::invokePrivate() then */ - public static function invokePrivate($object, $methodName, array $parameters = array()) { + public static function invokePrivate($object, $methodName, array $parameters = []) { return parent::invokePrivate($object, $methodName, $parameters); } } diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index fa4e481ac489c..fd695c8c68ddc 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -37,9 +37,9 @@ protected function setUp(): void { public function testInterpolation() { $logger = $this->logger; - $logger->warning('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + $logger->warning('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']); - $expected = array('2 {Message {nothing} Bob Bar a}'); + $expected = ['2 {Message {nothing} Bob Bar a}']; $this->assertEquals($expected, $this->getLogs()); } diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index 19ab04fd524b2..173d9414cdabd 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -23,22 +23,22 @@ class MessageTest extends TestCase { * @return array */ public function mailAddressProvider() { - return array( - array(array('lukas@owncloud.com' => 'Lukas Reschke'), array('lukas@owncloud.com' => 'Lukas Reschke')), - array(array('lukas@owncloud.com' => 'Lukas Reschke', 'lukas@öwnclöüd.com', 'lukäs@owncloud.örg' => 'Lükäs Réschke'), - array('lukas@owncloud.com' => 'Lukas Reschke', 'lukas@xn--wncld-iuae2c.com', 'lukäs@owncloud.xn--rg-eka' => 'Lükäs Réschke')), - array(array('lukas@öwnclöüd.com'), array('lukas@xn--wncld-iuae2c.com')), - ); + return [ + [['lukas@owncloud.com' => 'Lukas Reschke'], ['lukas@owncloud.com' => 'Lukas Reschke']], + [['lukas@owncloud.com' => 'Lukas Reschke', 'lukas@öwnclöüd.com', 'lukäs@owncloud.örg' => 'Lükäs Réschke'], + ['lukas@owncloud.com' => 'Lukas Reschke', 'lukas@xn--wncld-iuae2c.com', 'lukäs@owncloud.xn--rg-eka' => 'Lükäs Réschke']], + [['lukas@öwnclöüd.com'], ['lukas@xn--wncld-iuae2c.com']], + ]; } /** * @return array */ public function getMailAddressProvider() { - return array( - array(null, array()), - array(array('lukas@owncloud.com' => 'Lukas Reschke'), array('lukas@owncloud.com' => 'Lukas Reschke')), - ); + return [ + [null, []], + [['lukas@owncloud.com' => 'Lukas Reschke'], ['lukas@owncloud.com' => 'Lukas Reschke']], + ]; } protected function setUp(): void { @@ -58,15 +58,15 @@ protected function setUp(): void { * @param string $expected */ public function testConvertAddresses($unconverted, $expected) { - $this->assertSame($expected, self::invokePrivate($this->message, 'convertAddresses', array($unconverted))); + $this->assertSame($expected, self::invokePrivate($this->message, 'convertAddresses', [$unconverted])); } public function testSetFrom() { $this->swiftMessage ->expects($this->once()) ->method('setFrom') - ->with(array('lukas@owncloud.com')); - $this->message->setFrom(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setFrom(['lukas@owncloud.com']); } @@ -106,8 +106,8 @@ public function testSetTo() { $this->swiftMessage ->expects($this->once()) ->method('setTo') - ->with(array('lukas@owncloud.com')); - $this->message->setTo(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setTo(['lukas@owncloud.com']); } /** @@ -126,8 +126,8 @@ public function testSetCc() { $this->swiftMessage ->expects($this->once()) ->method('setCc') - ->with(array('lukas@owncloud.com')); - $this->message->setCc(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setCc(['lukas@owncloud.com']); } /** @@ -146,8 +146,8 @@ public function testSetBcc() { $this->swiftMessage ->expects($this->once()) ->method('setBcc') - ->with(array('lukas@owncloud.com')); - $this->message->setBcc(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setBcc(['lukas@owncloud.com']); } /** diff --git a/tests/lib/NaturalSortTest.php b/tests/lib/NaturalSortTest.php index 50c2d0be9f0ab..1408a64dadd51 100644 --- a/tests/lib/NaturalSortTest.php +++ b/tests/lib/NaturalSortTest.php @@ -20,7 +20,7 @@ public function testNaturalSortCompare($array, $sorted) return; } $comparator = \OC\NaturalSort::getInstance(); - usort($array, array($comparator, 'compare')); + usort($array, [$comparator, 'compare']); $this->assertEquals($sorted, $array); } @@ -30,7 +30,7 @@ public function testNaturalSortCompare($array, $sorted) public function testDefaultCollatorCompare($array, $sorted) { $comparator = new \OC\NaturalSort(new \OC\NaturalSort_DefaultCollator()); - usort($array, array($comparator, 'compare')); + usort($array, [$comparator, 'compare']); $this->assertEquals($sorted, $array); } @@ -41,28 +41,28 @@ public function testDefaultCollatorCompare($array, $sorted) */ public function naturalSortDataProvider() { - return array( + return [ // different casing - array( + [ // unsorted - array( + [ 'aaa', 'bbb', 'BBB', 'AAA' - ), + ], // sorted - array( + [ 'aaa', 'AAA', 'bbb', 'BBB' - ) - ), + ] + ], // numbers - array( + [ // unsorted - array( + [ '124.txt', 'abc1', '123.txt', @@ -85,9 +85,9 @@ public function naturalSortDataProvider() 'zz', '15.txt', '15b.txt', - ), + ], // sorted - array( + [ '15.txt', '15b.txt', '123.txt', @@ -110,12 +110,12 @@ public function naturalSortDataProvider() 'z', 'za', 'zz', - ) - ), + ] + ], // chinese characters - array( + [ // unsorted - array( + [ '十.txt', '一.txt', '二.txt', @@ -134,9 +134,9 @@ public function naturalSortDataProvider() '莫.txt', '啊.txt', '123.txt', - ), + ], // sorted - array( + [ '123.txt', 'abc.txt', '一.txt', @@ -155,12 +155,12 @@ public function naturalSortDataProvider() '波.txt', '破.txt', '莫.txt', - ) - ), + ] + ], // with umlauts - array( + [ // unsorted - array( + [ 'öh.txt', 'Äh.txt', 'oh.txt', @@ -171,9 +171,9 @@ public function naturalSortDataProvider() 'uh.txt', 'üh.txt', 'äh.txt', - ), + ], // sorted - array( + [ 'ah.txt', 'äh.txt', 'Äh.txt', @@ -184,9 +184,9 @@ public function naturalSortDataProvider() 'üh.txt', 'Üh.txt', 'Üh 2.txt', - ) - ), - ); + ] + ], + ]; } /** @@ -196,28 +196,28 @@ public function naturalSortDataProvider() */ public function defaultCollatorDataProvider() { - return array( + return [ // different casing - array( + [ // unsorted - array( + [ 'aaa', 'bbb', 'BBB', 'AAA' - ), + ], // sorted - array( + [ 'aaa', 'AAA', 'bbb', 'BBB' - ) - ), + ] + ], // numbers - array( + [ // unsorted - array( + [ '124.txt', 'abc1', '123.txt', @@ -240,9 +240,9 @@ public function defaultCollatorDataProvider() 'zz', '15.txt', '15b.txt', - ), + ], // sorted - array( + [ '15.txt', '15b.txt', '123.txt', @@ -265,8 +265,8 @@ public function defaultCollatorDataProvider() 'z', 'za', 'zz', - ) - ), - ); + ] + ], + ]; } } diff --git a/tests/lib/Repair/RepairSqliteAutoincrementTest.php b/tests/lib/Repair/RepairSqliteAutoincrementTest.php index c7008179a0dc2..66b30ca033f2f 100644 --- a/tests/lib/Repair/RepairSqliteAutoincrementTest.php +++ b/tests/lib/Repair/RepairSqliteAutoincrementTest.php @@ -65,7 +65,7 @@ protected function tearDown(): void { protected function checkAutoincrement() { $this->connection->executeUpdate('INSERT INTO ' . $this->tableName . ' ("text") VALUES ("test")'); $insertId = $this->connection->lastInsertId(); - $this->connection->executeUpdate('DELETE FROM ' . $this->tableName . ' WHERE "someid" = ?', array($insertId)); + $this->connection->executeUpdate('DELETE FROM ' . $this->tableName . ' WHERE "someid" = ?', [$insertId]); // insert again $this->connection->executeUpdate('INSERT INTO ' . $this->tableName . ' ("text") VALUES ("test2")'); diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php index bc1671d9178f8..00506e5dba7ae 100644 --- a/tests/lib/RepairStepTest.php +++ b/tests/lib/RepairStepTest.php @@ -64,10 +64,10 @@ public function testRunRepairStep() { $this->repair->run(); $this->assertEquals( - array( + [ 'step: Test Name', 'info: Simulated info', - ), + ], $this->outputArray ); } @@ -78,10 +78,10 @@ public function testRunRepairStepThatFail() { $this->repair->run(); $this->assertEquals( - array( + [ 'step: Test Name', 'warning: Simulated warning', - ), + ], $this->outputArray ); } @@ -109,9 +109,9 @@ public function testRunRepairStepsWithException() { $this->assertTrue($thrown); // jump out after exception $this->assertEquals( - array( + [ 'step: Exception Test', - ), + ], $this->outputArray ); } @@ -122,12 +122,12 @@ public function testRunRepairStepsContinueAfterWarning() { $this->repair->run(); $this->assertEquals( - array( + [ 'step: Test Name', 'warning: Simulated warning', 'step: Test Name', 'info: Simulated info', - ), + ], $this->outputArray ); } diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 136c3160413a1..f7196373c0002 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -79,11 +79,11 @@ protected function assertEqualsArrays($expected, $actual) { function testListCertificates() { // Test empty certificate bundle - $this->assertSame(array(), $this->certificateManager->listCertificates()); + $this->assertSame([], $this->certificateManager->listCertificates()); // Add some certificates $this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate'); - $certificateStore = array(); + $certificateStore = []; $certificateStore[] = new \OC\Security\Certificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate'); $this->assertEqualsArrays($certificateStore, $this->certificateManager->listCertificates()); diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php index a2c8055750b00..5e079c8018fe1 100644 --- a/tests/lib/Security/CryptoTest.php +++ b/tests/lib/Security/CryptoTest.php @@ -14,11 +14,11 @@ class CryptoTest extends \Test\TestCase { public function defaultEncryptionProvider() { - return array( - array('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'), - array(''), - array('我看这本书。 我看這本書') - ); + return [ + ['Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'], + [''], + ['我看这本书。 我看這本書'] + ]; } /** @var Crypto */ diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php index 71839115a3cb3..6898c1d8b0f52 100644 --- a/tests/lib/Security/SecureRandomTest.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -13,23 +13,23 @@ class SecureRandomTest extends \Test\TestCase { public function stringGenerationProvider() { - return array( - array(0, 0), - array(1, 1), - array(128, 128), - array(256, 256), - array(1024, 1024), - array(2048, 2048), - array(64000, 64000), - ); + return [ + [0, 0], + [1, 1], + [128, 128], + [256, 256], + [1024, 1024], + [2048, 2048], + [64000, 64000], + ]; } public static function charCombinations() { - return array( - array('CHAR_LOWER', '[a-z]'), - array('CHAR_UPPER', '[A-Z]'), - array('CHAR_DIGITS', '[0-9]'), - ); + return [ + ['CHAR_LOWER', '[a-z]'], + ['CHAR_UPPER', '[A-Z]'], + ['CHAR_DIGITS', '[0-9]'], + ]; } /** @var SecureRandom */ diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php index 13a86bfae30cb..1a443229dffa2 100644 --- a/tests/lib/Share/Backend.php +++ b/tests/lib/Share/Backend.php @@ -49,7 +49,7 @@ public function generateTarget($itemSource, $shareWith, $exclude = null) { $shares = \OC\Share\Share::getItemsSharedWithUser('test', $shareWith); - $knownTargets = array(); + $knownTargets = []; foreach ($shares as $share) { $knownTargets[] = $share['item_target']; } @@ -73,7 +73,7 @@ public function generateTarget($itemSource, $shareWith, $exclude = null) { } public function formatItems($items, $format, $parameters = null) { - $testItems = array(); + $testItems = []; foreach ($items as $item) { if ($format === self::FORMAT_SOURCE) { $testItems[] = $item['item_source']; diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php index dc2d26509e349..2056e6bd1e2f5 100644 --- a/tests/lib/Share/HelperTest.php +++ b/tests/lib/Share/HelperTest.php @@ -28,24 +28,24 @@ class HelperTest extends \Test\TestCase { public function expireDateProvider() { - return array( + return [ // no default expire date, we take the users expire date - array(array('defaultExpireDateSet' => false), 2000000000, 2000010000, 2000010000), + [['defaultExpireDateSet' => false], 2000000000, 2000010000, 2000010000], // no default expire date and no user defined expire date, return false - array(array('defaultExpireDateSet' => false), 2000000000, null, false), + [['defaultExpireDateSet' => false], 2000000000, null, false], // unenforced expire data and no user defined expire date, return false (because the default is not enforced) - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, null, false), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, null, false], // enforced expire date and no user defined expire date, take default expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, null, 2000086400), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, null, 2000086400], // unenforced expire date and user defined date > default expire date, take users expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, 2000100000, 2000100000), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, 2000100000, 2000100000], // unenforced expire date and user expire date < default expire date, take users expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, 2000010000, 2000010000), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, 2000010000, 2000010000], // enforced expire date and user expire date < default expire date, take users expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, 2000010000, 2000010000), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, 2000010000, 2000010000], // enforced expire date and users expire date > default expire date, take default expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, 2000100000, 2000086400), - ); + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, 2000100000, 2000086400], + ]; } /** @@ -101,21 +101,21 @@ public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) { } public function dataTestSplitUserRemoteError() { - return array( + return [ // Invalid path - array('user@'), + ['user@'], // Invalid user - array('@server'), - array('us/er@server'), - array('us:er@server'), + ['@server'], + ['us/er@server'], + ['us:er@server'], // Invalid splitting - array('user'), - array(''), - array('us/erserver'), - array('us:erserver'), - ); + ['user'], + [''], + ['us/erserver'], + ['us:erserver'], + ]; } /** diff --git a/tests/lib/Share/SearchResultSorterTest.php b/tests/lib/Share/SearchResultSorterTest.php index 7feccdd82f569..1786943642894 100644 --- a/tests/lib/Share/SearchResultSorterTest.php +++ b/tests/lib/Share/SearchResultSorterTest.php @@ -26,14 +26,14 @@ public function testSort() { $search = 'lin'; $sorter = new \OC\Share\SearchResultSorter($search, 'foobar'); - $result = array( - array('foobar' => 'woot'), - array('foobar' => 'linux'), - array('foobar' => 'Linus'), - array('foobar' => 'Bicyclerepairwoman'), - ); + $result = [ + ['foobar' => 'woot'], + ['foobar' => 'linux'], + ['foobar' => 'Linus'], + ['foobar' => 'Bicyclerepairwoman'], + ]; - usort($result, array($sorter, 'sort')); + usort($result, [$sorter, 'sort']); $this->assertTrue($result[0]['foobar'] === 'Linus'); $this->assertTrue($result[1]['foobar'] === 'linux'); $this->assertTrue($result[2]['foobar'] === 'Bicyclerepairwoman'); diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php index af05d0c4bdd1a..9b20744edb760 100644 --- a/tests/lib/Share/ShareTest.php +++ b/tests/lib/Share/ShareTest.php @@ -115,7 +115,7 @@ protected function setUp(): void { protected function tearDown(): void { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?'); - $query->execute(array('test')); + $query->execute(['test']); \OC::$server->getConfig()->setAppValue('core', 'shareapi_allow_resharing', $this->resharing); $this->user1->delete(); @@ -141,37 +141,37 @@ public function testGetItemSharedWithUser() { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' .' `item_type`, `item_source`, `item_target`, `share_type`,' .' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)'); - $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2->getUID(), $this->user1->getUID()); + $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2->getUID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4->getUID(), $this->user1->getUID()); + $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4->getUID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user2->getUID()); + $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user2->getUID()]; $query->execute($args); - $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user4->getUID()); + $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user4->getUID()]; $query->execute($args); - $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6->getUID(), $this->user4->getUID()); + $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6->getUID(), $this->user4->getUID()]; $query->execute($args); $result1 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user2->getUID(), $this->user1->getUID()); $this->assertSame(1, count($result1)); - $this->verifyResult($result1, array('target1')); + $this->verifyResult($result1, ['target1']); $result2 = \OCP\Share::getItemSharedWithUser('test', 99, null, $this->user1->getUID()); $this->assertSame(2, count($result2)); - $this->verifyResult($result2, array('target1', 'target2')); + $this->verifyResult($result2, ['target1', 'target2']); $result3 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user3->getUID()); $this->assertSame(2, count($result3)); - $this->verifyResult($result3, array('target3', 'target4')); + $this->verifyResult($result3, ['target3', 'target4']); $result4 = \OCP\Share::getItemSharedWithUser('test', 99, null, null); $this->assertSame(5, count($result4)); // 5 because target4 appears twice - $this->verifyResult($result4, array('target1', 'target2', 'target3', 'target4')); + $this->verifyResult($result4, ['target1', 'target2', 'target3', 'target4']); $result6 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user6->getUID(), null); $this->assertSame(1, count($result6)); - $this->verifyResult($result6, array('target4')); + $this->verifyResult($result6, ['target4']); } public function testGetItemSharedWithUserFromGroupShare() { @@ -181,32 +181,32 @@ public function testGetItemSharedWithUserFromGroupShare() { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' .' `item_type`, `item_source`, `item_target`, `share_type`,' .' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)'); - $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()); + $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()); + $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()); + $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()]; $query->execute($args); - $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()); + $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()]; $query->execute($args); // user2 is in group1 and group2 $result1 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user2->getUID(), $this->user1->getUID()); $this->assertSame(2, count($result1)); - $this->verifyResult($result1, array('target1', 'target2')); + $this->verifyResult($result1, ['target1', 'target2']); $result2 = \OCP\Share::getItemSharedWithUser('test', 99, null, $this->user1->getUID()); $this->assertSame(2, count($result2)); - $this->verifyResult($result2, array('target1', 'target2')); + $this->verifyResult($result2, ['target1', 'target2']); // user3 is in group1 and group2 $result3 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user3->getUID()); $this->assertSame(3, count($result3)); - $this->verifyResult($result3, array('target1', 'target3', 'target4')); + $this->verifyResult($result3, ['target1', 'target3', 'target4']); $result4 = \OCP\Share::getItemSharedWithUser('test', 99, null, null); $this->assertSame(4, count($result4)); - $this->verifyResult($result4, array('target1', 'target2', 'target3', 'target4')); + $this->verifyResult($result4, ['target1', 'target2', 'target3', 'target4']); $result6 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user6->getUID(), null); $this->assertSame(0, count($result6)); @@ -229,16 +229,16 @@ public function verifyResult($result, $expected) { */ function testRemoveProtocolFromUrl($url, $expectedResult) { $share = new \OC\Share\Share(); - $result = self::invokePrivate($share, 'removeProtocolFromUrl', array($url)); + $result = self::invokePrivate($share, 'removeProtocolFromUrl', [$url]); $this->assertSame($expectedResult, $result); } function urls() { - return array( - array('http://owncloud.org', 'owncloud.org'), - array('https://owncloud.org', 'owncloud.org'), - array('owncloud.org', 'owncloud.org'), - ); + return [ + ['http://owncloud.org', 'owncloud.org'], + ['https://owncloud.org', 'owncloud.org'], + ['owncloud.org', 'owncloud.org'], + ]; } /** @@ -265,57 +265,57 @@ function compareArrays($result, $expectedResult) { } function dataProviderTestGroupItems() { - return array( + return [ // one array with one share - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1')), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1'))), + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1']], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1']]], // two shares both point to the same source - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', - 'grouped' => array( - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ) - ), - ) - ), + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', + 'grouped' => [ + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ] + ], + ] + ], // two shares both point to the same source but with different targets - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'), - ), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'), - ) - ), + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'], + ], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'], + ] + ], // three shares two point to the same source - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', - 'grouped' => array( - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ) - ), - array('item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'), - ) - ), - ); + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', + 'grouped' => [ + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ] + ], + ['item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'], + ] + ], + ]; } } diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php index ad41c928dedaf..463ec5809dd7b 100644 --- a/tests/lib/TagsTest.php +++ b/tests/lib/TagsTest.php @@ -84,7 +84,7 @@ public function testTagManagerWithoutUserReturnsNull() { } public function testInstantiateWithDefaults() { - $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $defaultTags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); @@ -92,7 +92,7 @@ public function testInstantiateWithDefaults() { } public function testAddTags() { - $tags = array('Friends', 'Family', 'Work', 'Other'); + $tags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType); @@ -109,7 +109,7 @@ public function testAddTags() { } public function testAddMultiple() { - $tags = array('Friends', 'Family', 'Work', 'Other'); + $tags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType); @@ -169,37 +169,37 @@ public function testIsEmpty() { } public function testGetTagsForObjects() { - $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $defaultTags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $tagger->tagAs(1, 'Friends'); $tagger->tagAs(1, 'Other'); $tagger->tagAs(2, 'Family'); - $tags = $tagger->getTagsForObjects(array(1)); + $tags = $tagger->getTagsForObjects([1]); $this->assertEquals(1, count($tags)); $tags = current($tags); sort($tags); - $this->assertSame(array('Friends', 'Other'), $tags); + $this->assertSame(['Friends', 'Other'], $tags); - $tags = $tagger->getTagsForObjects(array(1, 2)); + $tags = $tagger->getTagsForObjects([1, 2]); $this->assertEquals(2, count($tags)); $tags1 = $tags[1]; sort($tags1); - $this->assertSame(array('Friends', 'Other'), $tags1); - $this->assertSame(array('Family'), $tags[2]); + $this->assertSame(['Friends', 'Other'], $tags1); + $this->assertSame(['Family'], $tags[2]); $this->assertEquals( - array(), - $tagger->getTagsForObjects(array(4)) + [], + $tagger->getTagsForObjects([4]) ); $this->assertEquals( - array(), - $tagger->getTagsForObjects(array(4, 5)) + [], + $tagger->getTagsForObjects([4, 5]) ); } public function testGetTagsForObjectsMassiveResults() { - $defaultTags = array('tag1'); + $defaultTags = ['tag1']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $tagData = $tagger->getTags(); $tagId = $tagData[0]['id']; @@ -213,9 +213,9 @@ public function testGetTagsForObjectsMassiveResults() { ); // insert lots of entries - $idsArray = array(); + $idsArray = []; for($i = 1; $i <= 1500; $i++) { - $statement->execute(array($i, $tagId, $tagType)); + $statement->execute([$i, $tagId, $tagType]); $idsArray[] = $i; } @@ -224,7 +224,7 @@ public function testGetTagsForObjectsMassiveResults() { } public function testDeleteTags() { - $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $defaultTags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $this->assertEquals(4, count($tagger->getTags())); @@ -232,12 +232,12 @@ public function testDeleteTags() { $tagger->delete('family'); $this->assertEquals(3, count($tagger->getTags())); - $tagger->delete(array('Friends', 'Work', 'Other')); + $tagger->delete(['Friends', 'Work', 'Other']); $this->assertEquals(0, count($tagger->getTags())); } public function testRenameTag() { - $defaultTags = array('Friends', 'Family', 'Wrok', 'Other'); + $defaultTags = ['Friends', 'Family', 'Wrok', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $this->assertTrue($tagger->rename('Wrok', 'Work')); @@ -248,7 +248,7 @@ public function testRenameTag() { } public function testTagAs() { - $objids = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + $objids = [1, 2, 3, 4, 5, 6, 7, 8, 9]; $tagger = $this->tagMgr->load($this->objectType); @@ -264,7 +264,7 @@ public function testTagAs() { * @depends testTagAs */ public function testUnTag() { - $objIds = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + $objIds = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // Is this "legal"? $this->testTagAs(); @@ -283,9 +283,9 @@ public function testUnTag() { public function testFavorite() { $tagger = $this->tagMgr->load($this->objectType); $this->assertTrue($tagger->addToFavorites(1)); - $this->assertEquals(array(1), $tagger->getFavorites()); + $this->assertEquals([1], $tagger->getFavorites()); $this->assertTrue($tagger->removeFromFavorites(1)); - $this->assertEquals(array(), $tagger->getFavorites()); + $this->assertEquals([], $tagger->getFavorites()); } public function testShareTags() { @@ -318,7 +318,7 @@ public function testShareTags() { \OC\Share\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ); \OC_User::setUserId($otherUserId); - $otherTagger = $otherTagMgr->load('test', array(), true); // Update tags, load shared ones. + $otherTagger = $otherTagMgr->load('test', [], true); // Update tags, load shared ones. $this->assertTrue($otherTagger->hasTag($testTag)); $this->assertContains(1, $otherTagger->getIdsForTag($testTag)); } diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php index 6262bd5a00a0d..f43573c1e3a87 100644 --- a/tests/lib/TempManagerTest.php +++ b/tests/lib/TempManagerTest.php @@ -17,7 +17,7 @@ public function __construct($logger = null) { //disable original constructor } - public function log(int $level, string $message, array $context = array()) { + public function log(int $level, string $message, array $context = []) { //noop } } diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php index 7c9f3585038b0..7aa1eb177d726 100644 --- a/tests/lib/Template/CSSResourceLocatorTest.php +++ b/tests/lib/Template/CSSResourceLocatorTest.php @@ -85,14 +85,14 @@ private function cssResourceLocator() { return new CSSResourceLocator( $this->logger, 'theme', - array('core'=>'map'), - array('3rd'=>'party'), + ['core'=>'map'], + ['3rd'=>'party'], $scssCacher ); } private function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { $this->rrmdir($directory . '/' . $file); @@ -111,10 +111,10 @@ public function testConstructor() { $locator = $this->cssResourceLocator(); $this->assertAttributeEquals('theme', 'theme', $locator); $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(array('core'=>'map','3rd'=>'party'), 'mapping', $locator); + $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator); $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator); $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals(array(), 'resources', $locator); + $this->assertAttributeEquals([], 'resources', $locator); } public function testFindWithAppPathSymlink() { @@ -136,7 +136,7 @@ public function testFindWithAppPathSymlink() { ]; $locator = $this->cssResourceLocator(); - $locator->find(array('test-css-app/test-file')); + $locator->find(['test-css-app/test-file']); $resources = $locator->getResources(); $this->assertCount(1, $resources); diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php index 8e36426393f3e..f7d7f7b57e51b 100644 --- a/tests/lib/Template/IconsCacherTest.php +++ b/tests/lib/Template/IconsCacherTest.php @@ -90,9 +90,9 @@ public function testGetIconsFromValidCss() { } "; $actual = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); - $expected = array( + $expected = [ 'icon-test' => '/svg/core/actions/add/000?v=1' - ); + ]; $this->assertEquals($expected, $actual); } diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php index 38c5fc0eadd1a..8c8fc99c9619e 100644 --- a/tests/lib/Template/JSResourceLocatorTest.php +++ b/tests/lib/Template/JSResourceLocatorTest.php @@ -64,14 +64,14 @@ private function jsResourceLocator() { return new JSResourceLocator( $this->logger, 'theme', - array('core'=>'map'), - array('3rd'=>'party'), + ['core'=>'map'], + ['3rd'=>'party'], $jsCombiner ); } private function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { $this->rrmdir($directory . '/' . $file); @@ -91,10 +91,10 @@ public function testConstructor() { $locator = $this->jsResourceLocator(); $this->assertAttributeEquals('theme', 'theme', $locator); $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(array('core'=>'map','3rd'=>'party'), 'mapping', $locator); + $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator); $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator); $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals(array(), 'resources', $locator); + $this->assertAttributeEquals([], 'resources', $locator); } public function testFindWithAppPathSymlink() { @@ -116,7 +116,7 @@ public function testFindWithAppPathSymlink() { ]; $locator = $this->jsResourceLocator(); - $locator->find(array('test-js-app/test-file')); + $locator->find(['test-js-app/test-file']); $resources = $locator->getResources(); $this->assertCount(1, $resources); diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php index 90488071b4f09..f0fa8186686a8 100644 --- a/tests/lib/Template/ResourceLocatorTest.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -29,24 +29,24 @@ protected function setUp(): void { */ public function getResourceLocator($theme, $core_map, $party_map, $appsRoots) { return $this->getMockForAbstractClass('OC\Template\ResourceLocator', - array($this->logger, $theme, $core_map, $party_map, $appsRoots ), - '', true, true, true, array()); + [$this->logger, $theme, $core_map, $party_map, $appsRoots ], + '', true, true, true, []); } public function testConstructor() { $locator = $this->getResourceLocator('theme', - array('core'=>'map'), array('3rd'=>'party'), array('foo'=>'bar')); + ['core'=>'map'], ['3rd'=>'party'], ['foo'=>'bar']); $this->assertAttributeEquals('theme', 'theme', $locator); $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(array('core'=>'map','3rd'=>'party'), 'mapping', $locator); + $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator); $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator); $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals(array(), 'resources', $locator); + $this->assertAttributeEquals([], 'resources', $locator); } public function testFind() { $locator = $this->getResourceLocator('theme', - array('core' => 'map'), array('3rd' => 'party'), array('foo' => 'bar')); + ['core' => 'map'], ['3rd' => 'party'], ['foo' => 'bar']); $locator->expects($this->once()) ->method('doFind') ->with('foo'); @@ -54,12 +54,12 @@ public function testFind() { ->method('doFindTheme') ->with('foo'); /** @var \OC\Template\ResourceLocator $locator */ - $locator->find(array('foo')); + $locator->find(['foo']); } public function testFindNotFound() { $locator = $this->getResourceLocator('theme', - array('core'=>'map'), array('3rd'=>'party'), array('foo'=>'bar')); + ['core'=>'map'], ['3rd'=>'party'], ['foo'=>'bar']); $locator->expects($this->once()) ->method('doFind') ->with('foo') @@ -72,25 +72,25 @@ public function testFindNotFound() { ->method('debug') ->with($this->stringContains('map/foo')); /** @var \OC\Template\ResourceLocator $locator */ - $locator->find(array('foo')); + $locator->find(['foo']); } public function testAppendIfExist() { $locator = $this->getResourceLocator('theme', - array(__DIR__=>'map'), array('3rd'=>'party'), array('foo'=>'bar')); + [__DIR__=>'map'], ['3rd'=>'party'], ['foo'=>'bar']); /** @var \OC\Template\ResourceLocator $locator */ $method = new \ReflectionMethod($locator, 'appendIfExist'); $method->setAccessible(true); $method->invoke($locator, __DIR__, basename(__FILE__), 'webroot'); - $resource1 = array(__DIR__, 'webroot', basename(__FILE__)); - $this->assertEquals(array($resource1), $locator->getResources()); + $resource1 = [__DIR__, 'webroot', basename(__FILE__)]; + $this->assertEquals([$resource1], $locator->getResources()); $method->invoke($locator, __DIR__, basename(__FILE__)); - $resource2 = array(__DIR__, 'map', basename(__FILE__)); - $this->assertEquals(array($resource1, $resource2), $locator->getResources()); + $resource2 = [__DIR__, 'map', basename(__FILE__)]; + $this->assertEquals([$resource1, $resource2], $locator->getResources()); $method->invoke($locator, __DIR__, 'does-not-exist'); - $this->assertEquals(array($resource1, $resource2), $locator->getResources()); + $this->assertEquals([$resource1, $resource2], $locator->getResources()); } } diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 9e8c30961fb5a..446821e62f8cf 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -471,7 +471,7 @@ private function randomString() { } private function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { $this->rrmdir($directory . '/' . $file); diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index b76105e9346d5..be4a7ade78733 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -194,7 +194,7 @@ protected function tearDown(): void { * @param array $parameters * @return mixed */ - protected static function invokePrivate($object, $methodName, array $parameters = array()) { + protected static function invokePrivate($object, $methodName, array $parameters = []) { if (is_string($object)) { $className = $object; } else { @@ -297,14 +297,14 @@ static protected function tearDownAfterClassCleanFileCache(IQueryBuilder $queryB * @param string $dataDir */ static protected function tearDownAfterClassCleanStrayDataFiles($dataDir) { - $knownEntries = array( + $knownEntries = [ 'nextcloud.log' => true, 'audit.log' => true, 'owncloud.db' => true, '.ocdata' => true, '..' => true, '.' => true, - ); + ]; if ($dh = opendir($dataDir)) { while (($file = readdir($dh)) !== false) { @@ -479,7 +479,7 @@ protected function assertTemplate($expectedHtml, $template, $vars = []) { $l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = array()) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); }); diff --git a/tests/lib/Traits/EncryptionTrait.php b/tests/lib/Traits/EncryptionTrait.php index ad98ba91212f8..8799ce72fd0b0 100644 --- a/tests/lib/Traits/EncryptionTrait.php +++ b/tests/lib/Traits/EncryptionTrait.php @@ -75,7 +75,7 @@ protected function postLogin() { \OC::$server->getLogger() ); - $this->registerStorageWrapper('oc_encryption', array($encryptionWrapper, 'wrapStorage')); + $this->registerStorageWrapper('oc_encryption', [$encryptionWrapper, 'wrapStorage']); } protected function setUpEncryptionTrait() { diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index 1dc0182a960b6..3d53301b325a2 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -245,7 +245,7 @@ public function testSearchOneBackend() { $backend->expects($this->once()) ->method('getUsers') ->with($this->equalTo('fo')) - ->willReturn(array('foo', 'afoo', 'Afoo1', 'Bfoo')); + ->willReturn(['foo', 'afoo', 'Afoo1', 'Bfoo']); $backend->expects($this->never()) ->method('loginName2UserName'); @@ -268,7 +268,7 @@ public function testSearchTwoBackendLimitOffset() { $backend1->expects($this->once()) ->method('getUsers') ->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1)) - ->willReturn(array('foo1', 'foo2')); + ->willReturn(['foo1', 'foo2']); $backend1->expects($this->never()) ->method('loginName2UserName'); @@ -279,7 +279,7 @@ public function testSearchTwoBackendLimitOffset() { $backend2->expects($this->once()) ->method('getUsers') ->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1)) - ->willReturn(array('foo3')); + ->willReturn(['foo3']); $backend2->expects($this->never()) ->method('loginName2UserName'); diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index c96a07eb9af2d..f7aba189603a0 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -814,10 +814,10 @@ public function testRememberLoginInvalidUser() { } public function testActiveUserAfterSetSession() { - $users = array( + $users = [ 'foo' => new User('foo', null, $this->createMock(EventDispatcherInterface::class)), 'bar' => new User('bar', null, $this->createMock(EventDispatcherInterface::class)) - ); + ]; $manager = $this->getMockBuilder('\OC\User\Manager') ->disableOriginalConstructor() diff --git a/tests/lib/Util/Group/Dummy.php b/tests/lib/Util/Group/Dummy.php index 0681a317c2813..f75aef5737e40 100644 --- a/tests/lib/Util/Group/Dummy.php +++ b/tests/lib/Util/Group/Dummy.php @@ -35,7 +35,7 @@ * dummy group backend, does not keep state, only for testing use */ class Dummy extends Backend { - private $groups=array(); + private $groups=[]; /** * Try to create a new group * @param string $gid The name of the group to create @@ -46,7 +46,7 @@ class Dummy extends Backend { */ public function createGroup($gid) { if(!isset($this->groups[$gid])) { - $this->groups[$gid]=array(); + $this->groups[$gid]=[]; return true; }else{ return false; @@ -136,7 +136,7 @@ public function removeFromGroup($uid, $gid) { * if the user exists at all. */ public function getUserGroups($uid) { - $groups=array(); + $groups=[]; $allGroups=array_keys($this->groups); foreach($allGroups as $group) { if($this->inGroup($uid, $group)) { @@ -157,7 +157,7 @@ public function getGroups($search = '', $limit = -1, $offset = 0) { if(empty($search)) { return array_keys($this->groups); } - $result = array(); + $result = []; foreach(array_keys($this->groups) as $group) { if(stripos($group, $search) !== false) { $result[] = $group; @@ -180,7 +180,7 @@ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { $length = $limit < 0 ? null : $limit; return array_slice($this->groups[$gid], $offset, $length); } - $result = array(); + $result = []; foreach($this->groups[$gid] as $user) { if(stripos($user, $search) !== false) { $result[] = $user; @@ -188,7 +188,7 @@ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { } return $result; }else{ - return array(); + return []; } } diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index 4771983e9bcfa..1d3c2d57b423d 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -33,8 +33,8 @@ * dummy user backend, does not keep state, only for testing use */ class Dummy extends Backend implements \OCP\IUserBackend { - private $users = array(); - private $displayNames = array(); + private $users = []; + private $displayNames = []; /** * Create a new user @@ -127,7 +127,7 @@ public function getUsers($search = '', $limit = null, $offset = null) { if (empty($search)) { return array_keys($this->users); } - $result = array(); + $result = []; foreach (array_keys($this->users) as $user) { if (stripos($user, $search) !== false) { $result[] = $user; diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index 9cba59beb475b..e822c3949305e 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -55,9 +55,9 @@ protected function tearDown(): void { * Test that checkServer() returns no errors in the regular case. */ public function testCheckServer() { - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true - ))); + ])); $this->assertEmpty($result); } @@ -72,9 +72,9 @@ public function testCheckServerSkipDataDirValidityOnSetup() { // even though ".ocdata" is missing, the error isn't // triggered to allow setup to run - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => false - ))); + ])); $this->assertEmpty($result); } @@ -91,14 +91,14 @@ public function testCheckServerSkipDataDirValidityOnUpgrade() { $oldCurrentVersion = $session->get('OC_Version'); // upgrade condition to simulate needUpgrade() === true - $session->set('OC_Version', array(6, 0, 0, 2)); + $session->set('OC_Version', [6, 0, 0, 2]); // even though ".ocdata" is missing, the error isn't // triggered to allow for upgrade - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => '6.0.0.1' - ))); + ])); $this->assertEmpty($result); // restore versions @@ -123,10 +123,10 @@ public function testCheckDataDirValidityWhenFileMissing() { $result = \OC_Util::checkDataDirectoryValidity($this->datadir); $this->assertEquals(1, count($result)); - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); $this->assertCount(1, $result); } @@ -134,10 +134,10 @@ public function testCheckDataDirValidityWhenFileMissing() { * Tests that no error is given when the datadir is writable */ public function testDataDirWritable() { - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); $this->assertEmpty($result); } @@ -148,10 +148,10 @@ public function testDataDirNotWritable() { $this->markTestSkipped('TODO: Disable because fails on drone'); chmod($this->datadir, 0300); - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); $this->assertCount(1, $result); } @@ -160,10 +160,10 @@ public function testDataDirNotWritable() { */ public function testDataDirNotWritableSetup() { chmod($this->datadir, 0300); - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => false, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); chmod($this->datadir, 0700); //needed for cleanup $this->assertEmpty($result); } diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 94ac17ce345b8..4d8432294fb49 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -206,16 +206,16 @@ function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $ex } public function dataProviderForTestIsSharingDisabledForUser() { - return array( + return [ // existing groups, groups the user belong to, groups excluded from sharing, expected result - array(array('g1', 'g2', 'g3'), array(), array('g1'), false), - array(array('g1', 'g2', 'g3'), array(), array(), false), - array(array('g1', 'g2', 'g3'), array('g2'), array('g1'), false), - array(array('g1', 'g2', 'g3'), array('g2'), array(), false), - array(array('g1', 'g2', 'g3'), array('g1', 'g2'), array('g1'), false), - array(array('g1', 'g2', 'g3'), array('g1', 'g2'), array('g1', 'g2'), true), - array(array('g1', 'g2', 'g3'), array('g1', 'g2'), array('g1', 'g2', 'g3'), true), - ); + [['g1', 'g2', 'g3'], [], ['g1'], false], + [['g1', 'g2', 'g3'], [], [], false], + [['g1', 'g2', 'g3'], ['g2'], ['g1'], false], + [['g1', 'g2', 'g3'], ['g2'], [], false], + [['g1', 'g2', 'g3'], ['g1', 'g2'], ['g1'], false], + [['g1', 'g2', 'g3'], ['g1', 'g2'], ['g1', 'g2'], true], + [['g1', 'g2', 'g3'], ['g1', 'g2'], ['g1', 'g2', 'g3'], true], + ]; } /** @@ -250,32 +250,32 @@ function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) { } function defaultAppsProvider() { - return array( + return [ // none specified, default to files - array( + [ '', 'index.php/apps/files/', - array('files'), - ), + ['files'], + ], // unexisting or inaccessible app specified, default to files - array( + [ 'unexist', 'index.php/apps/files/', - array('files'), - ), + ['files'], + ], // non-standard app - array( + [ 'calendar', 'index.php/apps/calendar/', - array('files', 'calendar'), - ), + ['files', 'calendar'], + ], // non-standard app with fallback - array( + [ 'contacts,calendar', 'index.php/apps/calendar/', - array('files', 'calendar'), - ), - ); + ['files', 'calendar'], + ], + ]; } public function testGetDefaultPageUrlWithRedirectUrlWithoutFrontController() { @@ -319,14 +319,14 @@ public function testNeedUpgradeCore() { $this->assertFalse(\OCP\Util::needUpgrade()); $config->setSystemValue('version', '7.0.0.0'); - \OC::$server->getSession()->set('OC_Version', array(7, 0, 0, 1)); - self::invokePrivate(new \OCP\Util, 'needUpgradeCache', array(null)); + \OC::$server->getSession()->set('OC_Version', [7, 0, 0, 1]); + self::invokePrivate(new \OCP\Util, 'needUpgradeCache', [null]); $this->assertTrue(\OCP\Util::needUpgrade()); $config->setSystemValue('version', $oldConfigVersion); \OC::$server->getSession()->set('OC_Version', $oldSessionVersion); - self::invokePrivate(new \OCP\Util, 'needUpgradeCache', array(null)); + self::invokePrivate(new \OCP\Util, 'needUpgradeCache', [null]); $this->assertFalse(\OCP\Util::needUpgrade()); } diff --git a/tests/preseed-config.php b/tests/preseed-config.php index 2d88d9391575c..6831ec66f6ba7 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -21,7 +21,7 @@ if (getenv('OBJECT_STORE') === 's3') { $CONFIG['objectstore'] = [ 'class' => 'OC\\Files\\ObjectStore\\S3', - 'arguments' => array( + 'arguments' => [ 'bucket' => 'nextcloud', 'autocreate' => true, 'key' => 'dummy', @@ -31,7 +31,7 @@ 'use_ssl' => false, // required for some non amazon s3 implementations 'use_path_style' => true - ) + ] ]; } if (getenv('OBJECT_STORE') === 'swift') { @@ -40,7 +40,7 @@ if (getenv('SWIFT-AUTH') === 'v2.0') { $CONFIG['objectstore'] = [ 'class' => 'OC\\Files\\ObjectStore\\Swift', - 'arguments' => array( + 'arguments' => [ 'autocreate' => true, 'username' => 'swift', 'tenantName' => 'service', @@ -49,12 +49,12 @@ 'region' => 'regionOne', 'url' => "http://$swiftHost:5000/v2.0", 'bucket' => 'nextcloud' - ) + ] ]; } else { $CONFIG['objectstore'] = [ 'class' => 'OC\\Files\\ObjectStore\\Swift', - 'arguments' => array( + 'arguments' => [ 'autocreate' => true, 'user' => [ 'name' => 'swift', @@ -76,19 +76,19 @@ 'region' => 'regionOne', 'url' => "http://$swiftHost:5000/v3", 'bucket' => 'nextcloud' - ) + ] ]; } } if (getenv('OBJECT_STORE') === 'azure') { $CONFIG['objectstore'] = [ 'class' => 'OC\\Files\\ObjectStore\\Azure', - 'arguments' => array( + 'arguments' => [ 'container' => 'test', 'account_name' => 'devstoreaccount1', 'account_key' => 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', 'endpoint' => 'http://' . (getenv('DRONE') === 'true' ? 'azurite' : 'localhost') . ':10000/devstoreaccount1', 'autocreate' => true - ) + ] ]; } diff --git a/version.php b/version.php index 002a01605950b..f39ef9497e9f0 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel // when updating major/minor version number. -$OC_Version = array(19, 0, 0, 0); +$OC_Version = [19, 0, 0, 0]; // The human readable string $OC_VersionString = '19.0.0 alpha';