@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | |
67 | 67 | $nodes = $this->nodes; |
68 | 68 | // http://stackoverflow.com/a/10985500 |
69 | - @usort($nodes, function (IFile $a, IFile $b) { |
|
69 | + @usort($nodes, function(IFile $a, IFile $b) { |
|
70 | 70 | return strnatcmp($a->getName(), $b->getName()); |
71 | 71 | }); |
72 | 72 | $this->nodes = array_values($nodes); |
73 | 73 | if (count($this->nodes) > 0) { |
74 | 74 | $this->currentStream = $this->getStream($this->nodes[0]); |
75 | 75 | } |
76 | - $this->size = array_reduce($this->nodes, function ($size, IFile $file) { |
|
76 | + $this->size = array_reduce($this->nodes, function($size, IFile $file) { |
|
77 | 77 | return $size + $file->getSize(); |
78 | 78 | }, 0); |
79 | 79 | return true; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | if (isset($context[$name])) { |
203 | 203 | $context = $context[$name]; |
204 | 204 | } else { |
205 | - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); |
|
205 | + throw new \BadMethodCallException('Invalid context, "'.$name.'" options not set'); |
|
206 | 206 | } |
207 | 207 | if (isset($context['nodes']) and is_array($context['nodes'])) { |
208 | 208 | $this->nodes = $context['nodes']; |
@@ -66,7 +66,7 @@ |
||
66 | 66 | try { |
67 | 67 | $ldapWrapper->read($connection->getConnectionResource(), '', 'objectClass=*', array('dn')); |
68 | 68 | } catch (\Exception $e) { |
69 | - if($e->getCode() === 1) { |
|
69 | + if ($e->getCode() === 1) { |
|
70 | 70 | OCP\JSON::error(array('message' => $l->t('Invalid configuration: Anonymous binding is not allowed.'))); |
71 | 71 | exit; |
72 | 72 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap, GroupPluginManager $groupPluginManager) { |
38 | 38 | parent::__construct($ldap); |
39 | - foreach($serverConfigPrefixes as $configPrefix) { |
|
39 | + foreach ($serverConfigPrefixes as $configPrefix) { |
|
40 | 40 | $this->backends[$configPrefix] = |
41 | 41 | new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix), $groupPluginManager); |
42 | - if(is_null($this->refBackend)) { |
|
42 | + if (is_null($this->refBackend)) { |
|
43 | 43 | $this->refBackend = &$this->backends[$configPrefix]; |
44 | 44 | } |
45 | 45 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function walkBackends($gid, $method, $parameters) { |
56 | 56 | $cacheKey = $this->getGroupCacheKey($gid); |
57 | - foreach($this->backends as $configPrefix => $backend) { |
|
58 | - if($result = call_user_func_array(array($backend, $method), $parameters)) { |
|
57 | + foreach ($this->backends as $configPrefix => $backend) { |
|
58 | + if ($result = call_user_func_array(array($backend, $method), $parameters)) { |
|
59 | 59 | $this->writeToCache($cacheKey, $configPrefix); |
60 | 60 | return $result; |
61 | 61 | } |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | * @return mixed, the result of the method or false |
73 | 73 | */ |
74 | 74 | protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) { |
75 | - $cacheKey = $this->getGroupCacheKey($gid);; |
|
75 | + $cacheKey = $this->getGroupCacheKey($gid); ; |
|
76 | 76 | $prefix = $this->getFromCache($cacheKey); |
77 | 77 | //in case the uid has been found in the past, try this stored connection first |
78 | - if(!is_null($prefix)) { |
|
79 | - if(isset($this->backends[$prefix])) { |
|
78 | + if (!is_null($prefix)) { |
|
79 | + if (isset($this->backends[$prefix])) { |
|
80 | 80 | $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters); |
81 | - if($result === $passOnWhen) { |
|
81 | + if ($result === $passOnWhen) { |
|
82 | 82 | //not found here, reset cache to null if group vanished |
83 | 83 | //because sometimes methods return false with a reason |
84 | 84 | $groupExists = call_user_func_array( |
85 | 85 | array($this->backends[$prefix], 'groupExists'), |
86 | 86 | array($gid) |
87 | 87 | ); |
88 | - if(!$groupExists) { |
|
88 | + if (!$groupExists) { |
|
89 | 89 | $this->writeToCache($cacheKey, null); |
90 | 90 | } |
91 | 91 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function getUserGroups($uid) { |
119 | 119 | $groups = array(); |
120 | 120 | |
121 | - foreach($this->backends as $backend) { |
|
121 | + foreach ($this->backends as $backend) { |
|
122 | 122 | $backendGroups = $backend->getUserGroups($uid); |
123 | 123 | if (is_array($backendGroups)) { |
124 | 124 | $groups = array_merge($groups, $backendGroups); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { |
136 | 136 | $users = array(); |
137 | 137 | |
138 | - foreach($this->backends as $backend) { |
|
138 | + foreach ($this->backends as $backend) { |
|
139 | 139 | $backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset); |
140 | 140 | if (is_array($backendUsers)) { |
141 | 141 | $users = array_merge($users, $backendUsers); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public function getGroups($search = '', $limit = -1, $offset = 0) { |
221 | 221 | $groups = array(); |
222 | 222 | |
223 | - foreach($this->backends as $backend) { |
|
223 | + foreach ($this->backends as $backend) { |
|
224 | 224 | $backendGroups = $backend->getGroups($search, $limit, $offset); |
225 | 225 | if (is_array($backendGroups)) { |
226 | 226 | $groups = array_merge($groups, $backendGroups); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $appName = $input->getArgument('app'); |
107 | 107 | $version = $input->getArgument('version'); |
108 | 108 | |
109 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
109 | + if (!preg_match('/^\d{1,16}$/', $version)) { |
|
110 | 110 | $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
111 | 111 | return 1; |
112 | 112 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
115 | 115 | |
116 | 116 | $date = date('YmdHis'); |
117 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date); |
|
117 | + $path = $this->generateMigration($ms, 'Version'.$version.'Date'.$date); |
|
118 | 118 | |
119 | 119 | $output->writeln("New migration class has been generated to <info>$path</info>"); |
120 | 120 | return 0; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function generateMigration(MigrationService $ms, $className, $schemaBody = '') { |
130 | 130 | if ($schemaBody === '') { |
131 | - $schemaBody = "\t\t" . 'return null;'; |
|
131 | + $schemaBody = "\t\t".'return null;'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $dir = $ms->getMigrationsDirectory(); |
147 | 147 | |
148 | 148 | $this->ensureMigrationDirExists($dir); |
149 | - $path = $dir . '/' . $className . '.php'; |
|
149 | + $path = $dir.'/'.$className.'.php'; |
|
150 | 150 | |
151 | 151 | if (file_put_contents($path, $code) === false) { |
152 | 152 | throw new RuntimeException('Failed to generate new migration step.'); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->createDatabase($connection); |
51 | 51 | |
52 | 52 | //fill the database if needed |
53 | - $query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; |
|
53 | + $query = 'select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; |
|
54 | 54 | $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); |
55 | 55 | } |
56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param \OC\DB\Connection $connection |
59 | 59 | */ |
60 | 60 | private function createDatabase($connection) { |
61 | - try{ |
|
61 | + try { |
|
62 | 62 | $name = $this->dbName; |
63 | 63 | $user = $this->dbUser; |
64 | 64 | //we can't use OC_DB functions here because we need to connect as the administrative user. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | try { |
77 | 77 | //this query will fail if there aren't the right permissions, ignore the error |
78 | - $query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'"; |
|
78 | + $query = "GRANT ALL PRIVILEGES ON `$name` . * TO '$user'"; |
|
79 | 79 | $connection->executeUpdate($query); |
80 | 80 | } catch (\Exception $ex) { |
81 | 81 | $this->logger->debug('Could not automatically grant privileges, this can be ignored if database user already had privileges: {error}', [ |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @throws \OC\DatabaseSetupException |
91 | 91 | */ |
92 | 92 | private function createDBUser($connection) { |
93 | - try{ |
|
93 | + try { |
|
94 | 94 | $name = $this->dbUser; |
95 | 95 | $password = $this->dbPassword; |
96 | 96 | // we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one, |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; |
101 | 101 | $connection->executeUpdate($query); |
102 | 102 | } |
103 | - catch (\Exception $ex){ |
|
103 | + catch (\Exception $ex) { |
|
104 | 104 | $this->logger->error('Database User creation failed: {error}', [ |
105 | 105 | 'app' => 'mysql.setup', |
106 | 106 | 'error' => $ex->getMessage() |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | //we don't have a dbuser specified in config |
122 | 122 | if ($this->dbUser !== $oldUser) { |
123 | 123 | //add prefix to the admin username to prevent collisions |
124 | - $adminUser = substr('oc_' . $username, 0, 16); |
|
124 | + $adminUser = substr('oc_'.$username, 0, 16); |
|
125 | 125 | |
126 | 126 | $i = 1; |
127 | 127 | while (true) { |
@@ -138,15 +138,15 @@ discard block |
||
138 | 138 | $this->dbUser = $adminUser; |
139 | 139 | |
140 | 140 | //create a random password so we don't need to store the admin password in the config file |
141 | - $this->dbPassword = $this->random->generate(30); |
|
141 | + $this->dbPassword = $this->random->generate(30); |
|
142 | 142 | |
143 | 143 | $this->createDBUser($connection); |
144 | 144 | |
145 | 145 | break; |
146 | 146 | } else { |
147 | 147 | //repeat with different username |
148 | - $length = strlen((string)$i); |
|
149 | - $adminUser = substr('oc_' . $username, 0, 16 - $length) . $i; |
|
148 | + $length = strlen((string) $i); |
|
149 | + $adminUser = substr('oc_'.$username, 0, 16 - $length).$i; |
|
150 | 150 | $i++; |
151 | 151 | } |
152 | 152 | } else { |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | $appName = $input->getArgument('app'); |
61 | 61 | $version = $input->getArgument('version'); |
62 | 62 | |
63 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
63 | + if (!preg_match('/^\d{1,16}$/', $version)) { |
|
64 | 64 | $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
65 | 65 | return 1; |
66 | 66 | } |
67 | 67 | |
68 | - $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
68 | + $schemaFile = $this->appManager->getAppPath($appName).'/appinfo/database.xml'; |
|
69 | 69 | if (!file_exists($schemaFile)) { |
70 | - $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
70 | + $output->writeln('<error>App '.$appName.' does not have a database.xml file</error>'); |
|
71 | 71 | return 2; |
72 | 72 | } |
73 | 73 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
81 | 81 | |
82 | 82 | $date = date('YmdHis'); |
83 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
83 | + $path = $this->generateMigration($ms, 'Version'.$version.'Date'.$date, $schemaBody); |
|
84 | 84 | |
85 | 85 | $output->writeln("New migration class has been generated to <info>$path</info>"); |
86 | 86 | return 0; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // default responders |
79 | 79 | $this->responders = array( |
80 | - 'json' => function ($data) { |
|
80 | + 'json' => function($data) { |
|
81 | 81 | if ($data instanceof DataResponse) { |
82 | 82 | $response = new JSONResponse( |
83 | 83 | $data->getData(), |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @since 7.0.0 |
107 | 107 | * @since 9.1.0 Added default parameter |
108 | 108 | */ |
109 | - public function getResponderByHTTPHeader($acceptHeader, $default='json') { |
|
109 | + public function getResponderByHTTPHeader($acceptHeader, $default = 'json') { |
|
110 | 110 | $headers = explode(',', $acceptHeader); |
111 | 111 | |
112 | 112 | // return the first matching responder |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | * @return Response |
146 | 146 | * @since 7.0.0 |
147 | 147 | */ |
148 | - public function buildResponse($response, $format='json') { |
|
149 | - if(array_key_exists($format, $this->responders)) { |
|
148 | + public function buildResponse($response, $format = 'json') { |
|
149 | + if (array_key_exists($format, $this->responders)) { |
|
150 | 150 | |
151 | 151 | $responder = $this->responders[$format]; |
152 | 152 | |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | |
155 | 155 | } |
156 | 156 | throw new \DomainException('No responder registered for format '. |
157 | - $format . '!'); |
|
157 | + $format.'!'); |
|
158 | 158 | } |
159 | 159 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $linkCheckPlugin = new \OCA\DAV\Files\Sharing\PublicLinkCheckPlugin(); |
61 | 61 | $filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin(); |
62 | 62 | |
63 | -$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) { |
|
63 | +$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function(\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) { |
|
64 | 64 | $isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'); |
65 | 65 | $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application(); |
66 | 66 | $federatedShareProvider = $federatedSharingApp->getFederatedShareProvider(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | // FIXME: should not add storage wrappers outside of preSetup, need to find a better way |
78 | 78 | $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); |
79 | - \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) { |
|
79 | + \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function($mountPoint, $storage) use ($share) { |
|
80 | 80 | return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE)); |
81 | 81 | }); |
82 | 82 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | OC_Util::tearDownFS(); |
86 | 86 | OC_Util::setupFS($owner); |
87 | - $ownerView = new \OC\Files\View('/'. $owner . '/files'); |
|
87 | + $ownerView = new \OC\Files\View('/'.$owner.'/files'); |
|
88 | 88 | $path = $ownerView->getPath($fileId); |
89 | 89 | $fileInfo = $ownerView->getFileInfo($path); |
90 | 90 | $linkCheckPlugin->setFileInfo($fileInfo); |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | $params = []; |
192 | 192 | foreach ($this->getParameters() as $placeholder => $value) { |
193 | 193 | if (is_array($value)) { |
194 | - $params[] = $placeholder . ' => (\'' . implode('\', \'', $value) . '\')'; |
|
194 | + $params[] = $placeholder.' => (\''.implode('\', \'', $value).'\')'; |
|
195 | 195 | } else { |
196 | - $params[] = $placeholder . ' => \'' . $value . '\''; |
|
196 | + $params[] = $placeholder.' => \''.$value.'\''; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | if (empty($params)) { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | public function selectAlias($select, $alias) { |
411 | 411 | |
412 | 412 | $this->queryBuilder->addSelect( |
413 | - $this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias) |
|
413 | + $this->helper->quoteColumnName($select).' AS '.$this->helper->quoteColumnName($alias) |
|
414 | 414 | ); |
415 | 415 | |
416 | 416 | return $this; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | public function selectDistinct($select) { |
433 | 433 | |
434 | 434 | $this->queryBuilder->addSelect( |
435 | - 'DISTINCT ' . $this->helper->quoteColumnName($select) |
|
435 | + 'DISTINCT '.$this->helper->quoteColumnName($select) |
|
436 | 436 | ); |
437 | 437 | |
438 | 438 | return $this; |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | * @return IParameter |
1110 | 1110 | */ |
1111 | 1111 | public function createParameter($name) { |
1112 | - return new Parameter(':' . $name); |
|
1112 | + return new Parameter(':'.$name); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | /** |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | return $table; |
1177 | 1177 | } |
1178 | 1178 | |
1179 | - return '*PREFIX*' . $table; |
|
1179 | + return '*PREFIX*'.$table; |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | /** |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | $tableAlias .= '.'; |
1192 | 1192 | } |
1193 | 1193 | |
1194 | - return $this->helper->quoteColumnName($tableAlias . $column); |
|
1194 | + return $this->helper->quoteColumnName($tableAlias.$column); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | /** |