@@ -126,6 +126,9 @@ |
||
| 126 | 126 | return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param string $value |
|
| 131 | + */ |
|
| 129 | 132 | private function getServersConfig($value) { |
| 130 | 133 | $regex = '/' . $value . '$/S'; |
| 131 | 134 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $keys = $this->getServersConfig($referenceConfigkey); |
| 100 | 100 | |
| 101 | 101 | $result = array(); |
| 102 | - foreach($keys as $key) { |
|
| 102 | + foreach ($keys as $key) { |
|
| 103 | 103 | $len = strlen($key) - strlen($referenceConfigkey); |
| 104 | 104 | $prefix = substr($key, 0, $len); |
| 105 | 105 | $result[$prefix] = $this->config->getAppValue('user_ldap', $key); |
@@ -116,18 +116,18 @@ discard block |
||
| 116 | 116 | public function getNextServerConfigurationPrefix() { |
| 117 | 117 | $serverConnections = $this->getServerConfigurationPrefixes(); |
| 118 | 118 | |
| 119 | - if(count($serverConnections) === 0) { |
|
| 119 | + if (count($serverConnections) === 0) { |
|
| 120 | 120 | return 's01'; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | sort($serverConnections); |
| 124 | 124 | $lastKey = array_pop($serverConnections); |
| 125 | 125 | $lastNumber = intval(str_replace('s', '', $lastKey)); |
| 126 | - return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
| 126 | + return 's'.str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | private function getServersConfig($value) { |
| 130 | - $regex = '/' . $value . '$/S'; |
|
| 130 | + $regex = '/'.$value.'$/S'; |
|
| 131 | 131 | |
| 132 | 132 | $keys = $this->config->getAppKeys('user_ldap'); |
| 133 | 133 | $result = []; |
@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | * @return bool true on success, false otherwise |
| 147 | 147 | */ |
| 148 | 148 | public function deleteServerConfiguration($prefix) { |
| 149 | - if(!in_array($prefix, self::getServerConfigurationPrefixes())) { |
|
| 149 | + if (!in_array($prefix, self::getServerConfigurationPrefixes())) { |
|
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $saveOtherConfigurations = ''; |
| 154 | - if(empty($prefix)) { |
|
| 154 | + if (empty($prefix)) { |
|
| 155 | 155 | $saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\''; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | '); |
| 166 | 166 | $delRows = $query->execute(array($prefix.'%')); |
| 167 | 167 | |
| 168 | - if(\OCP\DB::isError($delRows)) { |
|
| 168 | + if (\OCP\DB::isError($delRows)) { |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if($delRows === 0) { |
|
| 172 | + if ($delRows === 0) { |
|
| 173 | 173 | return false; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $all = $this->getServerConfigurationPrefixes(false); |
| 186 | 186 | $active = $this->getServerConfigurationPrefixes(true); |
| 187 | 187 | |
| 188 | - if(!is_array($all) || !is_array($active)) { |
|
| 188 | + if (!is_array($all) || !is_array($active)) { |
|
| 189 | 189 | throw new \Exception('Unexpected Return Value'); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getDomainFromURL($url) { |
| 201 | 201 | $uinfo = parse_url($url); |
| 202 | - if(!is_array($uinfo)) { |
|
| 202 | + if (!is_array($uinfo)) { |
|
| 203 | 203 | return false; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $domain = false; |
| 207 | - if(isset($uinfo['host'])) { |
|
| 207 | + if (isset($uinfo['host'])) { |
|
| 208 | 208 | $domain = $uinfo['host']; |
| 209 | - } else if(isset($uinfo['path'])) { |
|
| 209 | + } else if (isset($uinfo['path'])) { |
|
| 210 | 210 | $domain = $uinfo['path']; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function setLDAPProvider() { |
| 222 | 222 | $current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null); |
| 223 | - if(is_null($current)) { |
|
| 223 | + if (is_null($current)) { |
|
| 224 | 224 | \OC::$server->getConfig()->setSystemValue('ldapProviderFactory', '\\OCA\\User_LDAP\\LDAPProviderFactory'); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function sanitizeDN($dn) { |
| 234 | 234 | //treating multiple base DNs |
| 235 | - if(is_array($dn)) { |
|
| 235 | + if (is_array($dn)) { |
|
| 236 | 236 | $result = array(); |
| 237 | - foreach($dn as $singleDN) { |
|
| 237 | + foreach ($dn as $singleDN) { |
|
| 238 | 238 | $result[] = $this->sanitizeDN($singleDN); |
| 239 | 239 | } |
| 240 | 240 | return $result; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @throws \Exception |
| 286 | 286 | */ |
| 287 | 287 | public static function loginName2UserName($param) { |
| 288 | - if(!isset($param['uid'])) { |
|
| 288 | + if (!isset($param['uid'])) { |
|
| 289 | 289 | throw new \Exception('key uid is expected to be set in $param'); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | $userSession = \OC::$server->getUserSession(); |
| 301 | 301 | $userPluginManager = \OC::$server->query('LDAPUserPluginManager'); |
| 302 | 302 | |
| 303 | - $userBackend = new User_Proxy( |
|
| 303 | + $userBackend = new User_Proxy( |
|
| 304 | 304 | $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager |
| 305 | 305 | ); |
| 306 | - $uid = $userBackend->loginName2UserName($param['uid'] ); |
|
| 307 | - if($uid !== false) { |
|
| 306 | + $uid = $userBackend->loginName2UserName($param['uid']); |
|
| 307 | + if ($uid !== false) { |
|
| 308 | 308 | $param['uid'] = $uid; |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->server->on('propPatch', array($this, 'handleUpdateProperties')); |
| 169 | 169 | $this->server->on('afterBind', array($this, 'sendFileIdHeader')); |
| 170 | 170 | $this->server->on('afterWriteContent', array($this, 'sendFileIdHeader')); |
| 171 | - $this->server->on('afterMethod:GET', [$this,'httpGet']); |
|
| 171 | + $this->server->on('afterMethod:GET', [$this, 'httpGet']); |
|
| 172 | 172 | $this->server->on('afterMethod:GET', array($this, 'handleDownloadToken')); |
| 173 | 173 | $this->server->on('afterResponse', function($request, ResponseInterface $response) { |
| 174 | 174 | $body = $response->getBody(); |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | if ($sourceDir !== $destinationDir) { |
| 199 | 199 | $sourceNodeFileInfo = $sourceNode->getFileInfo(); |
| 200 | 200 | if ($sourceNodeFileInfo === null) { |
| 201 | - throw new NotFound($source . ' does not exist'); |
|
| 201 | + throw new NotFound($source.' does not exist'); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if (!$sourceNodeFileInfo->isDeletable()) { |
| 205 | - throw new Forbidden($source . " cannot be deleted"); |
|
| 205 | + throw new Forbidden($source." cannot be deleted"); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -255,10 +255,10 @@ discard block |
||
| 255 | 255 | Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
| 256 | 256 | Request::USER_AGENT_FREEBOX, |
| 257 | 257 | ])) { |
| 258 | - $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
| 258 | + $response->addHeader('Content-Disposition', 'attachment; filename="'.rawurlencode($filename).'"'); |
|
| 259 | 259 | } else { |
| 260 | - $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
| 261 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
| 260 | + $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($filename) |
|
| 261 | + . '; filename="'.rawurlencode($filename).'"'); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
@@ -343,13 +343,13 @@ discard block |
||
| 343 | 343 | return $node->getFileInfo()->isEncrypted() ? '1' : '0'; |
| 344 | 344 | }); |
| 345 | 345 | |
| 346 | - $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
| 346 | + $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function() use ($node) { |
|
| 347 | 347 | return json_encode($this->previewManager->isAvailable($node->getFileInfo())); |
| 348 | 348 | }); |
| 349 | 349 | $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { |
| 350 | 350 | return $node->getSize(); |
| 351 | 351 | }); |
| 352 | - $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) { |
|
| 352 | + $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function() use ($node) { |
|
| 353 | 353 | return $node->getFileInfo()->getMountPoint()->getMountType(); |
| 354 | 354 | }); |
| 355 | 355 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | list($path, $name) = \Sabre\Uri\split($filePath); |
| 438 | 438 | $info = \OC_FileChunking::decodeName($name); |
| 439 | 439 | if (!empty($info)) { |
| 440 | - $filePath = $path . '/' . $info['name']; |
|
| 440 | + $filePath = $path.'/'.$info['name']; |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | public function search($search = '', $itemType = null, $page = 1, $perPage = 200, $shareType = null, $lookup = true) { |
| 121 | 121 | |
| 122 | 122 | // only search for string larger than a given threshold |
| 123 | - $threshold = (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0); |
|
| 123 | + $threshold = (int) $this->config->getSystemValue('sharing.minSearchStringLength', 0); |
|
| 124 | 124 | if (strlen($search) < $threshold) { |
| 125 | 125 | return new DataResponse($this->result); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // never return more than the max. number of results configured in the config.php |
| 129 | - $maxResults = (int)$this->config->getSystemValue('sharing.maxAutocompleteResults', 0); |
|
| 129 | + $maxResults = (int) $this->config->getSystemValue('sharing.maxAutocompleteResults', 0); |
|
| 130 | 130 | if ($maxResults > 0) { |
| 131 | 131 | $perPage = min($perPage, $maxResults); |
| 132 | 132 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset); |
| 182 | 182 | |
| 183 | 183 | // extra treatment for 'exact' subarray, with a single merge expected keys might be lost |
| 184 | - if(isset($result['exact'])) { |
|
| 184 | + if (isset($result['exact'])) { |
|
| 185 | 185 | $result['exact'] = array_merge($this->result['exact'], $result['exact']); |
| 186 | 186 | } |
| 187 | 187 | $this->result = array_merge($this->result, $result); |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | protected function getPaginationLink($page, array $params) { |
| 227 | 227 | if ($this->isV2()) { |
| 228 | - $url = $this->urlGenerator->getAbsoluteURL('/ocs/v2.php/apps/files_sharing/api/v1/sharees') . '?'; |
|
| 228 | + $url = $this->urlGenerator->getAbsoluteURL('/ocs/v2.php/apps/files_sharing/api/v1/sharees').'?'; |
|
| 229 | 229 | } else { |
| 230 | - $url = $this->urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/sharees') . '?'; |
|
| 230 | + $url = $this->urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/sharees').'?'; |
|
| 231 | 231 | } |
| 232 | 232 | $params['page'] = $page + 1; |
| 233 | - return '<' . $url . http_build_query($params) . '>; rel="next"'; |
|
| 233 | + return '<'.$url.http_build_query($params).'>; rel="next"'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | return array(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 94 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 95 | 95 | if (!$this->view->is_dir($path)) { |
| 96 | 96 | return array(); |
| 97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | while (false !== ($file = readdir($handle))) { |
| 104 | 104 | if ($file != '.' && $file != '..') { |
| 105 | 105 | try { |
| 106 | - $result[] = new Certificate($this->view->file_get_contents($path . $file), $file); |
|
| 106 | + $result[] = new Certificate($this->view->file_get_contents($path.$file), $file); |
|
| 107 | 107 | } catch (\Exception $e) { |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -123,20 +123,20 @@ discard block |
||
| 123 | 123 | $this->view->mkdir($path); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 126 | + $defaultCertificates = file_get_contents(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 127 | 127 | if (strlen($defaultCertificates) < 1024) { // sanity check to verify that we have some content for our bundle |
| 128 | 128 | // log as exception so we have a stacktrace |
| 129 | 129 | $this->logger->logException(new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle')); |
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $certPath = $path . 'rootcerts.crt'; |
|
| 134 | - $tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 133 | + $certPath = $path.'rootcerts.crt'; |
|
| 134 | + $tmpPath = $certPath.'.tmp'.$this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 135 | 135 | $fhCerts = $this->view->fopen($tmpPath, 'w'); |
| 136 | 136 | |
| 137 | 137 | // Write user certificates |
| 138 | 138 | foreach ($certs as $cert) { |
| 139 | - $file = $path . '/uploads/' . $cert->getName(); |
|
| 139 | + $file = $path.'/uploads/'.$cert->getName(); |
|
| 140 | 140 | $data = $this->view->file_get_contents($file); |
| 141 | 141 | if (strpos($data, 'BEGIN CERTIFICATE')) { |
| 142 | 142 | fwrite($fhCerts, $data); |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | throw new \Exception('Filename is not valid'); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $dir = $this->getPathToCertificates() . 'uploads/'; |
|
| 175 | + $dir = $this->getPathToCertificates().'uploads/'; |
|
| 176 | 176 | if (!$this->view->file_exists($dir)) { |
| 177 | 177 | $this->view->mkdir($dir); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | try { |
| 181 | - $file = $dir . $name; |
|
| 181 | + $file = $dir.$name; |
|
| 182 | 182 | $certificateObject = new Certificate($certificate, $name); |
| 183 | 183 | $this->view->file_put_contents($file, $certificate); |
| 184 | 184 | $this->createCertificateBundle(); |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | if (!Filesystem::isValidPath($name)) { |
| 200 | 200 | return false; |
| 201 | 201 | } |
| 202 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 203 | - if ($this->view->file_exists($path . $name)) { |
|
| 204 | - $this->view->unlink($path . $name); |
|
| 202 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 203 | + if ($this->view->file_exists($path.$name)) { |
|
| 204 | + $this->view->unlink($path.$name); |
|
| 205 | 205 | $this->createCertificateBundle(); |
| 206 | 206 | } |
| 207 | 207 | return true; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if ($uid === '') { |
| 218 | 218 | $uid = $this->uid; |
| 219 | 219 | } |
| 220 | - return $this->getPathToCertificates($uid) . 'rootcerts.crt'; |
|
| 220 | + return $this->getPathToCertificates($uid).'rootcerts.crt'; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | if ($uid === '') { |
| 250 | 250 | $uid = $this->uid; |
| 251 | 251 | } |
| 252 | - return is_null($uid) ? '/files_external/' : '/' . $uid . '/files_external/'; |
|
| 252 | + return is_null($uid) ? '/files_external/' : '/'.$uid.'/files_external/'; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $sourceMTimes[] = $this->view->filemtime($this->getCertificateBundle(null)); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $sourceMTime = array_reduce($sourceMTimes, function ($max, $mtime) { |
|
| 275 | + $sourceMTime = array_reduce($sourceMTimes, function($max, $mtime) { |
|
| 276 | 276 | return max($max, $mtime); |
| 277 | 277 | }, 0); |
| 278 | 278 | return $sourceMTime > $this->view->filemtime($targetBundle); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @return int |
| 285 | 285 | */ |
| 286 | 286 | protected function getFilemtimeOfCaBundle() { |
| 287 | - return filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 287 | + return filemtime(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * SQL query via Doctrine prepare(), needs to be execute()'d! |
| 56 | 56 | */ |
| 57 | - static public function prepare( $query , $limit = null, $offset = null, $isManipulation = null) { |
|
| 57 | + static public function prepare($query, $limit = null, $offset = null, $isManipulation = null) { |
|
| 58 | 58 | $connection = \OC::$server->getDatabaseConnection(); |
| 59 | 59 | |
| 60 | 60 | if ($isManipulation === null) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | // return the result |
| 66 | 66 | try { |
| 67 | - $result =$connection->prepare($query, $limit, $offset); |
|
| 67 | + $result = $connection->prepare($query, $limit, $offset); |
|
| 68 | 68 | } catch (\Doctrine\DBAL\DBALException $e) { |
| 69 | 69 | throw new \OC\DatabaseException($e->getMessage()); |
| 70 | 70 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param string $sql |
| 81 | 81 | * @return bool |
| 82 | 82 | */ |
| 83 | - static public function isManipulation( $sql ) { |
|
| 83 | + static public function isManipulation($sql) { |
|
| 84 | 84 | $selectOccurrence = stripos($sql, 'SELECT'); |
| 85 | 85 | if ($selectOccurrence !== false && $selectOccurrence < 10) { |
| 86 | 86 | return false; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return OC_DB_StatementWrapper |
| 110 | 110 | * @throws \OC\DatabaseException |
| 111 | 111 | */ |
| 112 | - static public function executeAudited( $stmt, array $parameters = []) { |
|
| 112 | + static public function executeAudited($stmt, array $parameters = []) { |
|
| 113 | 113 | if (is_string($stmt)) { |
| 114 | 114 | // convert to an array with 'sql' |
| 115 | 115 | if (stripos($stmt, 'LIMIT') !== false) { //OFFSET requires LIMIT, so we only need to check for LIMIT |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | if (is_array($stmt)) { |
| 124 | 124 | // convert to prepared statement |
| 125 | - if ( ! array_key_exists('sql', $stmt) ) { |
|
| 125 | + if (!array_key_exists('sql', $stmt)) { |
|
| 126 | 126 | $message = 'statement array must at least contain key \'sql\''; |
| 127 | 127 | throw new \OC\DatabaseException($message); |
| 128 | 128 | } |
| 129 | - if ( ! array_key_exists('limit', $stmt) ) { |
|
| 129 | + if (!array_key_exists('limit', $stmt)) { |
|
| 130 | 130 | $stmt['limit'] = null; |
| 131 | 131 | } |
| 132 | - if ( ! array_key_exists('limit', $stmt) ) { |
|
| 132 | + if (!array_key_exists('limit', $stmt)) { |
|
| 133 | 133 | $stmt['offset'] = null; |
| 134 | 134 | } |
| 135 | 135 | $stmt = self::prepare($stmt['sql'], $stmt['limit'], $stmt['offset']); |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | self::raiseExceptionOnError($result, 'Could not execute statement'); |
| 141 | 141 | } else { |
| 142 | 142 | if (is_object($stmt)) { |
| 143 | - $message = 'Expected a prepared statement or array got ' . get_class($stmt); |
|
| 143 | + $message = 'Expected a prepared statement or array got '.get_class($stmt); |
|
| 144 | 144 | } else { |
| 145 | - $message = 'Expected a prepared statement or array got ' . gettype($stmt); |
|
| 145 | + $message = 'Expected a prepared statement or array got '.gettype($stmt); |
|
| 146 | 146 | } |
| 147 | 147 | throw new \OC\DatabaseException($message); |
| 148 | 148 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * TODO: write more documentation |
| 170 | 170 | */ |
| 171 | - public static function createDbFromStructure( $file ) { |
|
| 171 | + public static function createDbFromStructure($file) { |
|
| 172 | 172 | $schemaManager = self::getMDB2SchemaManager(); |
| 173 | 173 | return $schemaManager->createDbFromStructure($file); |
| 174 | 174 | } |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | * @throws \OC\DatabaseException |
| 209 | 209 | */ |
| 210 | 210 | public static function raiseExceptionOnError($result, $message = null) { |
| 211 | - if($result === false) { |
|
| 211 | + if ($result === false) { |
|
| 212 | 212 | if ($message === null) { |
| 213 | 213 | $message = self::getErrorMessage(); |
| 214 | 214 | } else { |
| 215 | - $message .= ', Root cause:' . self::getErrorMessage(); |
|
| 215 | + $message .= ', Root cause:'.self::getErrorMessage(); |
|
| 216 | 216 | } |
| 217 | 217 | throw new \OC\DatabaseException($message); |
| 218 | 218 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | parent::__construct(); |
| 158 | 158 | $this->webRoot = $webRoot; |
| 159 | 159 | |
| 160 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
| 160 | + $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
| 161 | 161 | return $c; |
| 162 | 162 | }); |
| 163 | 163 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
| 171 | 171 | |
| 172 | 172 | |
| 173 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
| 173 | + $this->registerService(\OCP\IPreview::class, function(Server $c) { |
|
| 174 | 174 | return new PreviewManager( |
| 175 | 175 | $c->getConfig(), |
| 176 | 176 | $c->getRootFolder(), |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | }); |
| 182 | 182 | $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
| 183 | 183 | |
| 184 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
| 184 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
| 185 | 185 | return new \OC\Preview\Watcher( |
| 186 | 186 | $c->getAppDataDir('preview') |
| 187 | 187 | ); |
| 188 | 188 | }); |
| 189 | 189 | |
| 190 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
| 190 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
| 191 | 191 | $view = new View(); |
| 192 | 192 | $util = new Encryption\Util( |
| 193 | 193 | $view, |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | ); |
| 206 | 206 | }); |
| 207 | 207 | |
| 208 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
| 208 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
| 209 | 209 | $util = new Encryption\Util( |
| 210 | 210 | new View(), |
| 211 | 211 | $c->getUserManager(), |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | ); |
| 220 | 220 | }); |
| 221 | 221 | |
| 222 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
| 222 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
| 223 | 223 | $view = new View(); |
| 224 | 224 | $util = new Encryption\Util( |
| 225 | 225 | $view, |
@@ -230,30 +230,30 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | return new Encryption\Keys\Storage($view, $util); |
| 232 | 232 | }); |
| 233 | - $this->registerService('TagMapper', function (Server $c) { |
|
| 233 | + $this->registerService('TagMapper', function(Server $c) { |
|
| 234 | 234 | return new TagMapper($c->getDatabaseConnection()); |
| 235 | 235 | }); |
| 236 | 236 | |
| 237 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
| 237 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
| 238 | 238 | $tagMapper = $c->query('TagMapper'); |
| 239 | 239 | return new TagManager($tagMapper, $c->getUserSession()); |
| 240 | 240 | }); |
| 241 | 241 | $this->registerAlias('TagManager', \OCP\ITagManager::class); |
| 242 | 242 | |
| 243 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
| 243 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
| 244 | 244 | $config = $c->getConfig(); |
| 245 | 245 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
| 246 | 246 | return new $factoryClass($this); |
| 247 | 247 | }); |
| 248 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
| 248 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) { |
|
| 249 | 249 | return $c->query('SystemTagManagerFactory')->getManager(); |
| 250 | 250 | }); |
| 251 | 251 | $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
| 252 | 252 | |
| 253 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
| 253 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) { |
|
| 254 | 254 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
| 255 | 255 | }); |
| 256 | - $this->registerService('RootFolder', function (Server $c) { |
|
| 256 | + $this->registerService('RootFolder', function(Server $c) { |
|
| 257 | 257 | $manager = \OC\Files\Filesystem::getMountManager(null); |
| 258 | 258 | $view = new View(); |
| 259 | 259 | $root = new Root( |
@@ -274,38 +274,38 @@ discard block |
||
| 274 | 274 | }); |
| 275 | 275 | $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
| 276 | 276 | |
| 277 | - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
| 278 | - return new LazyRoot(function () use ($c) { |
|
| 277 | + $this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) { |
|
| 278 | + return new LazyRoot(function() use ($c) { |
|
| 279 | 279 | return $c->query('RootFolder'); |
| 280 | 280 | }); |
| 281 | 281 | }); |
| 282 | 282 | $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
| 283 | 283 | |
| 284 | - $this->registerService(\OC\User\Manager::class, function (Server $c) { |
|
| 284 | + $this->registerService(\OC\User\Manager::class, function(Server $c) { |
|
| 285 | 285 | $config = $c->getConfig(); |
| 286 | 286 | return new \OC\User\Manager($config); |
| 287 | 287 | }); |
| 288 | 288 | $this->registerAlias('UserManager', \OC\User\Manager::class); |
| 289 | 289 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
| 290 | 290 | |
| 291 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
| 291 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
| 292 | 292 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
| 293 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 293 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
| 294 | 294 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
| 295 | 295 | }); |
| 296 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
| 296 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
| 297 | 297 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
| 298 | 298 | }); |
| 299 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 299 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
| 300 | 300 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
| 301 | 301 | }); |
| 302 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 302 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
| 303 | 303 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
| 304 | 304 | }); |
| 305 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 305 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 306 | 306 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
| 307 | 307 | }); |
| 308 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 308 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 309 | 309 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
| 310 | 310 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
| 311 | 311 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | }); |
| 315 | 315 | $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
| 316 | 316 | |
| 317 | - $this->registerService(Store::class, function (Server $c) { |
|
| 317 | + $this->registerService(Store::class, function(Server $c) { |
|
| 318 | 318 | $session = $c->getSession(); |
| 319 | 319 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
| 320 | 320 | $tokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
@@ -325,11 +325,11 @@ discard block |
||
| 325 | 325 | return new Store($session, $logger, $tokenProvider); |
| 326 | 326 | }); |
| 327 | 327 | $this->registerAlias(IStore::class, Store::class); |
| 328 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
| 328 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) { |
|
| 329 | 329 | $dbConnection = $c->getDatabaseConnection(); |
| 330 | 330 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
| 331 | 331 | }); |
| 332 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
| 332 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) { |
|
| 333 | 333 | $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
| 334 | 334 | $crypto = $c->getCrypto(); |
| 335 | 335 | $config = $c->getConfig(); |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | }); |
| 340 | 340 | $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
| 341 | 341 | |
| 342 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
| 342 | + $this->registerService(\OCP\IUserSession::class, function(Server $c) { |
|
| 343 | 343 | $manager = $c->getUserManager(); |
| 344 | 344 | $session = new \OC\Session\Memory(''); |
| 345 | 345 | $timeFactory = new TimeFactory(); |
@@ -363,45 +363,45 @@ discard block |
||
| 363 | 363 | $c->getLockdownManager(), |
| 364 | 364 | $c->getLogger() |
| 365 | 365 | ); |
| 366 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 366 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
| 367 | 367 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
| 368 | 368 | }); |
| 369 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 369 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
| 370 | 370 | /** @var $user \OC\User\User */ |
| 371 | 371 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
| 372 | 372 | }); |
| 373 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) { |
|
| 373 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($dispatcher) { |
|
| 374 | 374 | /** @var $user \OC\User\User */ |
| 375 | 375 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
| 376 | 376 | $dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
| 377 | 377 | }); |
| 378 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 378 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
| 379 | 379 | /** @var $user \OC\User\User */ |
| 380 | 380 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
| 381 | 381 | }); |
| 382 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 382 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
| 383 | 383 | /** @var $user \OC\User\User */ |
| 384 | 384 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
| 385 | 385 | }); |
| 386 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 386 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
| 387 | 387 | /** @var $user \OC\User\User */ |
| 388 | 388 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
| 389 | 389 | }); |
| 390 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 390 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
| 391 | 391 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
| 392 | 392 | }); |
| 393 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
| 393 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
| 394 | 394 | /** @var $user \OC\User\User */ |
| 395 | 395 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
| 396 | 396 | }); |
| 397 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 397 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
| 398 | 398 | /** @var $user \OC\User\User */ |
| 399 | 399 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
| 400 | 400 | }); |
| 401 | - $userSession->listen('\OC\User', 'logout', function () { |
|
| 401 | + $userSession->listen('\OC\User', 'logout', function() { |
|
| 402 | 402 | \OC_Hook::emit('OC_User', 'logout', array()); |
| 403 | 403 | }); |
| 404 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) { |
|
| 404 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) use ($dispatcher) { |
|
| 405 | 405 | /** @var $user \OC\User\User */ |
| 406 | 406 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
| 407 | 407 | $dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value])); |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | }); |
| 411 | 411 | $this->registerAlias('UserSession', \OCP\IUserSession::class); |
| 412 | 412 | |
| 413 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
| 413 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
| 414 | 414 | return new \OC\Authentication\TwoFactorAuth\Manager( |
| 415 | 415 | $c->getAppManager(), |
| 416 | 416 | $c->getSession(), |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
| 427 | 427 | $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
| 428 | 428 | |
| 429 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
| 429 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
| 430 | 430 | return new \OC\AllConfig( |
| 431 | 431 | $c->getSystemConfig() |
| 432 | 432 | ); |
@@ -434,17 +434,17 @@ discard block |
||
| 434 | 434 | $this->registerAlias('AllConfig', \OC\AllConfig::class); |
| 435 | 435 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
| 436 | 436 | |
| 437 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
| 437 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
| 438 | 438 | return new \OC\SystemConfig($config); |
| 439 | 439 | }); |
| 440 | 440 | |
| 441 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
| 441 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
| 442 | 442 | return new \OC\AppConfig($c->getDatabaseConnection()); |
| 443 | 443 | }); |
| 444 | 444 | $this->registerAlias('AppConfig', \OC\AppConfig::class); |
| 445 | 445 | $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
| 446 | 446 | |
| 447 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
| 447 | + $this->registerService(\OCP\L10N\IFactory::class, function(Server $c) { |
|
| 448 | 448 | return new \OC\L10N\Factory( |
| 449 | 449 | $c->getConfig(), |
| 450 | 450 | $c->getRequest(), |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | }); |
| 455 | 455 | $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
| 456 | 456 | |
| 457 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
| 457 | + $this->registerService(\OCP\IURLGenerator::class, function(Server $c) { |
|
| 458 | 458 | $config = $c->getConfig(); |
| 459 | 459 | $cacheFactory = $c->getMemCacheFactory(); |
| 460 | 460 | $request = $c->getRequest(); |
@@ -466,18 +466,18 @@ discard block |
||
| 466 | 466 | }); |
| 467 | 467 | $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class); |
| 468 | 468 | |
| 469 | - $this->registerService('AppHelper', function ($c) { |
|
| 469 | + $this->registerService('AppHelper', function($c) { |
|
| 470 | 470 | return new \OC\AppHelper(); |
| 471 | 471 | }); |
| 472 | 472 | $this->registerAlias('AppFetcher', AppFetcher::class); |
| 473 | 473 | $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
| 474 | 474 | |
| 475 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
| 475 | + $this->registerService(\OCP\ICache::class, function($c) { |
|
| 476 | 476 | return new Cache\File(); |
| 477 | 477 | }); |
| 478 | 478 | $this->registerAlias('UserCache', \OCP\ICache::class); |
| 479 | 479 | |
| 480 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 480 | + $this->registerService(Factory::class, function(Server $c) { |
|
| 481 | 481 | |
| 482 | 482 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
| 483 | 483 | '\\OC\\Memcache\\ArrayCache', |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $version = implode(',', $v); |
| 495 | 495 | $instanceId = \OC_Util::getInstanceId(); |
| 496 | 496 | $path = \OC::$SERVERROOT; |
| 497 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl()); |
|
| 497 | + $prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.$urlGenerator->getBaseUrl()); |
|
| 498 | 498 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
| 499 | 499 | $config->getSystemValue('memcache.local', null), |
| 500 | 500 | $config->getSystemValue('memcache.distributed', null), |
@@ -507,12 +507,12 @@ discard block |
||
| 507 | 507 | $this->registerAlias('MemCacheFactory', Factory::class); |
| 508 | 508 | $this->registerAlias(ICacheFactory::class, Factory::class); |
| 509 | 509 | |
| 510 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 510 | + $this->registerService('RedisFactory', function(Server $c) { |
|
| 511 | 511 | $systemConfig = $c->getSystemConfig(); |
| 512 | 512 | return new RedisFactory($systemConfig); |
| 513 | 513 | }); |
| 514 | 514 | |
| 515 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 515 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
| 516 | 516 | return new \OC\Activity\Manager( |
| 517 | 517 | $c->getRequest(), |
| 518 | 518 | $c->getUserSession(), |
@@ -522,14 +522,14 @@ discard block |
||
| 522 | 522 | }); |
| 523 | 523 | $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
| 524 | 524 | |
| 525 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 525 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
| 526 | 526 | return new \OC\Activity\EventMerger( |
| 527 | 527 | $c->getL10N('lib') |
| 528 | 528 | ); |
| 529 | 529 | }); |
| 530 | 530 | $this->registerAlias(IValidator::class, Validator::class); |
| 531 | 531 | |
| 532 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
| 532 | + $this->registerService(\OCP\IAvatarManager::class, function(Server $c) { |
|
| 533 | 533 | return new AvatarManager( |
| 534 | 534 | $c->query(\OC\User\Manager::class), |
| 535 | 535 | $c->getAppDataDir('avatar'), |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
| 544 | 544 | |
| 545 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
| 545 | + $this->registerService(\OCP\ILogger::class, function(Server $c) { |
|
| 546 | 546 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
| 547 | 547 | $logger = Log::getLogClass($logType); |
| 548 | 548 | call_user_func(array($logger, 'init')); |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | }); |
| 554 | 554 | $this->registerAlias('Logger', \OCP\ILogger::class); |
| 555 | 555 | |
| 556 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
| 556 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) { |
|
| 557 | 557 | $config = $c->getConfig(); |
| 558 | 558 | return new \OC\BackgroundJob\JobList( |
| 559 | 559 | $c->getDatabaseConnection(), |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | }); |
| 564 | 564 | $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
| 565 | 565 | |
| 566 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
| 566 | + $this->registerService(\OCP\Route\IRouter::class, function(Server $c) { |
|
| 567 | 567 | $cacheFactory = $c->getMemCacheFactory(); |
| 568 | 568 | $logger = $c->getLogger(); |
| 569 | 569 | if ($cacheFactory->isAvailableLowLatency()) { |
@@ -575,12 +575,12 @@ discard block |
||
| 575 | 575 | }); |
| 576 | 576 | $this->registerAlias('Router', \OCP\Route\IRouter::class); |
| 577 | 577 | |
| 578 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
| 578 | + $this->registerService(\OCP\ISearch::class, function($c) { |
|
| 579 | 579 | return new Search(); |
| 580 | 580 | }); |
| 581 | 581 | $this->registerAlias('Search', \OCP\ISearch::class); |
| 582 | 582 | |
| 583 | - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) { |
|
| 583 | + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function($c) { |
|
| 584 | 584 | return new \OC\Security\RateLimiting\Limiter( |
| 585 | 585 | $this->getUserSession(), |
| 586 | 586 | $this->getRequest(), |
@@ -588,34 +588,34 @@ discard block |
||
| 588 | 588 | $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
| 589 | 589 | ); |
| 590 | 590 | }); |
| 591 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 591 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
| 592 | 592 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
| 593 | 593 | $this->getMemCacheFactory(), |
| 594 | 594 | new \OC\AppFramework\Utility\TimeFactory() |
| 595 | 595 | ); |
| 596 | 596 | }); |
| 597 | 597 | |
| 598 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
| 598 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
| 599 | 599 | return new SecureRandom(); |
| 600 | 600 | }); |
| 601 | 601 | $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
| 602 | 602 | |
| 603 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
| 603 | + $this->registerService(\OCP\Security\ICrypto::class, function(Server $c) { |
|
| 604 | 604 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
| 605 | 605 | }); |
| 606 | 606 | $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
| 607 | 607 | |
| 608 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
| 608 | + $this->registerService(\OCP\Security\IHasher::class, function(Server $c) { |
|
| 609 | 609 | return new Hasher($c->getConfig()); |
| 610 | 610 | }); |
| 611 | 611 | $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
| 612 | 612 | |
| 613 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
| 613 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) { |
|
| 614 | 614 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
| 615 | 615 | }); |
| 616 | 616 | $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
| 617 | 617 | |
| 618 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
| 618 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
| 619 | 619 | $systemConfig = $c->getSystemConfig(); |
| 620 | 620 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
| 621 | 621 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | }); |
| 630 | 630 | $this->registerAlias('DatabaseConnection', IDBConnection::class); |
| 631 | 631 | |
| 632 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
| 632 | + $this->registerService('HTTPHelper', function(Server $c) { |
|
| 633 | 633 | $config = $c->getConfig(); |
| 634 | 634 | return new HTTPHelper( |
| 635 | 635 | $config, |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | ); |
| 638 | 638 | }); |
| 639 | 639 | |
| 640 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
| 640 | + $this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) { |
|
| 641 | 641 | $user = \OC_User::getUser(); |
| 642 | 642 | $uid = $user ? $user : null; |
| 643 | 643 | return new ClientService( |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | ); |
| 653 | 653 | }); |
| 654 | 654 | $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
| 655 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
| 655 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) { |
|
| 656 | 656 | $eventLogger = new EventLogger(); |
| 657 | 657 | if ($c->getSystemConfig()->getValue('debug', false)) { |
| 658 | 658 | // In debug mode, module is being activated by default |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | }); |
| 663 | 663 | $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
| 664 | 664 | |
| 665 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
| 665 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) { |
|
| 666 | 666 | $queryLogger = new QueryLogger(); |
| 667 | 667 | if ($c->getSystemConfig()->getValue('debug', false)) { |
| 668 | 668 | // In debug mode, module is being activated by default |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | }); |
| 673 | 673 | $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
| 674 | 674 | |
| 675 | - $this->registerService(TempManager::class, function (Server $c) { |
|
| 675 | + $this->registerService(TempManager::class, function(Server $c) { |
|
| 676 | 676 | return new TempManager( |
| 677 | 677 | $c->getLogger(), |
| 678 | 678 | $c->getConfig() |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $this->registerAlias('TempManager', TempManager::class); |
| 682 | 682 | $this->registerAlias(ITempManager::class, TempManager::class); |
| 683 | 683 | |
| 684 | - $this->registerService(AppManager::class, function (Server $c) { |
|
| 684 | + $this->registerService(AppManager::class, function(Server $c) { |
|
| 685 | 685 | return new \OC\App\AppManager( |
| 686 | 686 | $c->getUserSession(), |
| 687 | 687 | $c->query(\OC\AppConfig::class), |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | $this->registerAlias('AppManager', AppManager::class); |
| 694 | 694 | $this->registerAlias(IAppManager::class, AppManager::class); |
| 695 | 695 | |
| 696 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
| 696 | + $this->registerService(\OCP\IDateTimeZone::class, function(Server $c) { |
|
| 697 | 697 | return new DateTimeZone( |
| 698 | 698 | $c->getConfig(), |
| 699 | 699 | $c->getSession() |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | }); |
| 702 | 702 | $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
| 703 | 703 | |
| 704 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
| 704 | + $this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) { |
|
| 705 | 705 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
| 706 | 706 | |
| 707 | 707 | return new DateTimeFormatter( |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | }); |
| 712 | 712 | $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
| 713 | 713 | |
| 714 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
| 714 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) { |
|
| 715 | 715 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
| 716 | 716 | $listener = new UserMountCacheListener($mountCache); |
| 717 | 717 | $listener->listen($c->getUserManager()); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | }); |
| 720 | 720 | $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
| 721 | 721 | |
| 722 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
| 722 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) { |
|
| 723 | 723 | $loader = \OC\Files\Filesystem::getLoader(); |
| 724 | 724 | $mountCache = $c->query('UserMountCache'); |
| 725 | 725 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -735,10 +735,10 @@ discard block |
||
| 735 | 735 | }); |
| 736 | 736 | $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
| 737 | 737 | |
| 738 | - $this->registerService('IniWrapper', function ($c) { |
|
| 738 | + $this->registerService('IniWrapper', function($c) { |
|
| 739 | 739 | return new IniGetWrapper(); |
| 740 | 740 | }); |
| 741 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
| 741 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
| 742 | 742 | $busClass = $c->getConfig()->getSystemValue('commandbus'); |
| 743 | 743 | if ($busClass) { |
| 744 | 744 | list($app, $class) = explode('::', $busClass, 2); |
@@ -753,10 +753,10 @@ discard block |
||
| 753 | 753 | return new CronBus($jobList); |
| 754 | 754 | } |
| 755 | 755 | }); |
| 756 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
| 756 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
| 757 | 757 | return new TrustedDomainHelper($this->getConfig()); |
| 758 | 758 | }); |
| 759 | - $this->registerService('Throttler', function (Server $c) { |
|
| 759 | + $this->registerService('Throttler', function(Server $c) { |
|
| 760 | 760 | return new Throttler( |
| 761 | 761 | $c->getDatabaseConnection(), |
| 762 | 762 | new TimeFactory(), |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | $c->getConfig() |
| 765 | 765 | ); |
| 766 | 766 | }); |
| 767 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
| 767 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
| 768 | 768 | // IConfig and IAppManager requires a working database. This code |
| 769 | 769 | // might however be called when ownCloud is not yet setup. |
| 770 | 770 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | $c->getTempManager() |
| 786 | 786 | ); |
| 787 | 787 | }); |
| 788 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
| 788 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
| 789 | 789 | if (isset($this['urlParams'])) { |
| 790 | 790 | $urlParams = $this['urlParams']; |
| 791 | 791 | } else { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | }); |
| 822 | 822 | $this->registerAlias('Request', \OCP\IRequest::class); |
| 823 | 823 | |
| 824 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
| 824 | + $this->registerService(\OCP\Mail\IMailer::class, function(Server $c) { |
|
| 825 | 825 | return new Mailer( |
| 826 | 826 | $c->getConfig(), |
| 827 | 827 | $c->getLogger(), |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | }); |
| 833 | 833 | $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
| 834 | 834 | |
| 835 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
| 835 | + $this->registerService('LDAPProvider', function(Server $c) { |
|
| 836 | 836 | $config = $c->getConfig(); |
| 837 | 837 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
| 838 | 838 | if (is_null($factoryClass)) { |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | $factory = new $factoryClass($this); |
| 843 | 843 | return $factory->getLDAPProvider(); |
| 844 | 844 | }); |
| 845 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
| 845 | + $this->registerService(ILockingProvider::class, function(Server $c) { |
|
| 846 | 846 | $ini = $c->getIniWrapper(); |
| 847 | 847 | $config = $c->getConfig(); |
| 848 | 848 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -859,49 +859,49 @@ discard block |
||
| 859 | 859 | }); |
| 860 | 860 | $this->registerAlias('LockingProvider', ILockingProvider::class); |
| 861 | 861 | |
| 862 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
| 862 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function() { |
|
| 863 | 863 | return new \OC\Files\Mount\Manager(); |
| 864 | 864 | }); |
| 865 | 865 | $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
| 866 | 866 | |
| 867 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
| 867 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) { |
|
| 868 | 868 | return new \OC\Files\Type\Detection( |
| 869 | 869 | $c->getURLGenerator(), |
| 870 | 870 | \OC::$configDir, |
| 871 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 871 | + \OC::$SERVERROOT.'/resources/config/' |
|
| 872 | 872 | ); |
| 873 | 873 | }); |
| 874 | 874 | $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
| 875 | 875 | |
| 876 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
| 876 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) { |
|
| 877 | 877 | return new \OC\Files\Type\Loader( |
| 878 | 878 | $c->getDatabaseConnection() |
| 879 | 879 | ); |
| 880 | 880 | }); |
| 881 | 881 | $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
| 882 | - $this->registerService(BundleFetcher::class, function () { |
|
| 882 | + $this->registerService(BundleFetcher::class, function() { |
|
| 883 | 883 | return new BundleFetcher($this->getL10N('lib')); |
| 884 | 884 | }); |
| 885 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
| 885 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
| 886 | 886 | return new Manager( |
| 887 | 887 | $c->query(IValidator::class) |
| 888 | 888 | ); |
| 889 | 889 | }); |
| 890 | 890 | $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
| 891 | 891 | |
| 892 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
| 892 | + $this->registerService(\OC\CapabilitiesManager::class, function(Server $c) { |
|
| 893 | 893 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
| 894 | - $manager->registerCapability(function () use ($c) { |
|
| 894 | + $manager->registerCapability(function() use ($c) { |
|
| 895 | 895 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
| 896 | 896 | }); |
| 897 | - $manager->registerCapability(function () use ($c) { |
|
| 897 | + $manager->registerCapability(function() use ($c) { |
|
| 898 | 898 | return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
| 899 | 899 | }); |
| 900 | 900 | return $manager; |
| 901 | 901 | }); |
| 902 | 902 | $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
| 903 | 903 | |
| 904 | - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
| 904 | + $this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) { |
|
| 905 | 905 | $config = $c->getConfig(); |
| 906 | 906 | $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); |
| 907 | 907 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
| 912 | 912 | $manager = $c->getUserManager(); |
| 913 | 913 | $user = $manager->get($id); |
| 914 | - if(is_null($user)) { |
|
| 914 | + if (is_null($user)) { |
|
| 915 | 915 | $l = $c->getL10N('core'); |
| 916 | 916 | $displayName = $l->t('Unknown user'); |
| 917 | 917 | } else { |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | }); |
| 925 | 925 | $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
| 926 | 926 | |
| 927 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 927 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
| 928 | 928 | /* |
| 929 | 929 | * Dark magic for autoloader. |
| 930 | 930 | * If we do a class_exists it will try to load the class which will |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | } |
| 952 | 952 | return new \OC_Defaults(); |
| 953 | 953 | }); |
| 954 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
| 954 | + $this->registerService(SCSSCacher::class, function(Server $c) { |
|
| 955 | 955 | /** @var Factory $cacheFactory */ |
| 956 | 956 | $cacheFactory = $c->query(Factory::class); |
| 957 | 957 | return new SCSSCacher( |
@@ -964,13 +964,13 @@ discard block |
||
| 964 | 964 | $cacheFactory->createDistributed('SCSS') |
| 965 | 965 | ); |
| 966 | 966 | }); |
| 967 | - $this->registerService(EventDispatcher::class, function () { |
|
| 967 | + $this->registerService(EventDispatcher::class, function() { |
|
| 968 | 968 | return new EventDispatcher(); |
| 969 | 969 | }); |
| 970 | 970 | $this->registerAlias('EventDispatcher', EventDispatcher::class); |
| 971 | 971 | $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
| 972 | 972 | |
| 973 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
| 973 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
| 974 | 974 | // FIXME: Instantiiated here due to cyclic dependency |
| 975 | 975 | $request = new Request( |
| 976 | 976 | [ |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | $request |
| 996 | 996 | ); |
| 997 | 997 | }); |
| 998 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
| 998 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
| 999 | 999 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
| 1000 | 1000 | |
| 1001 | 1001 | return new CsrfTokenManager( |
@@ -1003,22 +1003,22 @@ discard block |
||
| 1003 | 1003 | $c->query(SessionStorage::class) |
| 1004 | 1004 | ); |
| 1005 | 1005 | }); |
| 1006 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
| 1006 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
| 1007 | 1007 | return new SessionStorage($c->getSession()); |
| 1008 | 1008 | }); |
| 1009 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
| 1009 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) { |
|
| 1010 | 1010 | return new ContentSecurityPolicyManager(); |
| 1011 | 1011 | }); |
| 1012 | 1012 | $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
| 1013 | 1013 | |
| 1014 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
| 1014 | + $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
| 1015 | 1015 | return new ContentSecurityPolicyNonceManager( |
| 1016 | 1016 | $c->getCsrfTokenManager(), |
| 1017 | 1017 | $c->getRequest() |
| 1018 | 1018 | ); |
| 1019 | 1019 | }); |
| 1020 | 1020 | |
| 1021 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
| 1021 | + $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
| 1022 | 1022 | $config = $c->getConfig(); |
| 1023 | 1023 | $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); |
| 1024 | 1024 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | |
| 1062 | 1062 | $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
| 1063 | 1063 | |
| 1064 | - $this->registerService('SettingsManager', function (Server $c) { |
|
| 1064 | + $this->registerService('SettingsManager', function(Server $c) { |
|
| 1065 | 1065 | $manager = new \OC\Settings\Manager( |
| 1066 | 1066 | $c->getLogger(), |
| 1067 | 1067 | $c->getDatabaseConnection(), |
@@ -1081,24 +1081,24 @@ discard block |
||
| 1081 | 1081 | ); |
| 1082 | 1082 | return $manager; |
| 1083 | 1083 | }); |
| 1084 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
| 1084 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
| 1085 | 1085 | return new \OC\Files\AppData\Factory( |
| 1086 | 1086 | $c->getRootFolder(), |
| 1087 | 1087 | $c->getSystemConfig() |
| 1088 | 1088 | ); |
| 1089 | 1089 | }); |
| 1090 | 1090 | |
| 1091 | - $this->registerService('LockdownManager', function (Server $c) { |
|
| 1092 | - return new LockdownManager(function () use ($c) { |
|
| 1091 | + $this->registerService('LockdownManager', function(Server $c) { |
|
| 1092 | + return new LockdownManager(function() use ($c) { |
|
| 1093 | 1093 | return $c->getSession(); |
| 1094 | 1094 | }); |
| 1095 | 1095 | }); |
| 1096 | 1096 | |
| 1097 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
| 1097 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
| 1098 | 1098 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
| 1099 | 1099 | }); |
| 1100 | 1100 | |
| 1101 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
| 1101 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
| 1102 | 1102 | return new CloudIdManager(); |
| 1103 | 1103 | }); |
| 1104 | 1104 | |
@@ -1108,18 +1108,18 @@ discard block |
||
| 1108 | 1108 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
| 1109 | 1109 | $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
| 1110 | 1110 | |
| 1111 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1111 | + $this->registerService(Defaults::class, function(Server $c) { |
|
| 1112 | 1112 | return new Defaults( |
| 1113 | 1113 | $c->getThemingDefaults() |
| 1114 | 1114 | ); |
| 1115 | 1115 | }); |
| 1116 | 1116 | $this->registerAlias('Defaults', \OCP\Defaults::class); |
| 1117 | 1117 | |
| 1118 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
| 1118 | + $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
| 1119 | 1119 | return $c->query(\OCP\IUserSession::class)->getSession(); |
| 1120 | 1120 | }); |
| 1121 | 1121 | |
| 1122 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
| 1122 | + $this->registerService(IShareHelper::class, function(Server $c) { |
|
| 1123 | 1123 | return new ShareHelper( |
| 1124 | 1124 | $c->query(\OCP\Share\IManager::class) |
| 1125 | 1125 | ); |
@@ -1181,11 +1181,11 @@ discard block |
||
| 1181 | 1181 | // no avatar to remove |
| 1182 | 1182 | } catch (\Exception $e) { |
| 1183 | 1183 | // Ignore exceptions |
| 1184 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
| 1184 | + $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | }); |
| 1187 | 1187 | |
| 1188 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
| 1188 | + $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
| 1189 | 1189 | $manager = $this->getAvatarManager(); |
| 1190 | 1190 | /** @var IUser $user */ |
| 1191 | 1191 | $user = $e->getSubject(); |
@@ -1336,7 +1336,7 @@ discard block |
||
| 1336 | 1336 | * @deprecated since 9.2.0 use IAppData |
| 1337 | 1337 | */ |
| 1338 | 1338 | public function getAppFolder() { |
| 1339 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
| 1339 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
| 1340 | 1340 | $root = $this->getRootFolder(); |
| 1341 | 1341 | if (!$root->nodeExists($dir)) { |
| 1342 | 1342 | $folder = $root->newFolder($dir); |
@@ -1920,7 +1920,7 @@ discard block |
||
| 1920 | 1920 | /** |
| 1921 | 1921 | * @return \OCP\Collaboration\AutoComplete\IManager |
| 1922 | 1922 | */ |
| 1923 | - public function getAutoCompleteManager(){ |
|
| 1923 | + public function getAutoCompleteManager() { |
|
| 1924 | 1924 | return $this->query(IManager::class); |
| 1925 | 1925 | } |
| 1926 | 1926 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | $path = '/'; |
| 127 | 127 | } |
| 128 | 128 | if ($path[0] !== '/') { |
| 129 | - $path = '/' . $path; |
|
| 129 | + $path = '/'.$path; |
|
| 130 | 130 | } |
| 131 | - return $this->fakeRoot . $path; |
|
| 131 | + return $this->fakeRoot.$path; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function chroot($fakeRoot) { |
| 141 | 141 | if (!$fakeRoot == '') { |
| 142 | 142 | if ($fakeRoot[0] !== '/') { |
| 143 | - $fakeRoot = '/' . $fakeRoot; |
|
| 143 | + $fakeRoot = '/'.$fakeRoot; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | $this->fakeRoot = $fakeRoot; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // missing slashes can cause wrong matches! |
| 175 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
| 175 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
| 176 | 176 | |
| 177 | 177 | if (strpos($path, $root) !== 0) { |
| 178 | 178 | return null; |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if ($mount instanceof MoveableMount) { |
| 279 | 279 | // cut of /user/files to get the relative path to data/user/files |
| 280 | 280 | $pathParts = explode('/', $path, 4); |
| 281 | - $relPath = '/' . $pathParts[3]; |
|
| 281 | + $relPath = '/'.$pathParts[3]; |
|
| 282 | 282 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
| 283 | 283 | \OC_Hook::emit( |
| 284 | 284 | Filesystem::CLASSNAME, "umount", |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | } |
| 699 | 699 | $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; |
| 700 | 700 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
| 701 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
| 701 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
| 702 | 702 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
| 703 | 703 | return $this->removeMount($mount, $absolutePath); |
| 704 | 704 | } |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
| 819 | 819 | } |
| 820 | 820 | } |
| 821 | - } catch(\Exception $e) { |
|
| 821 | + } catch (\Exception $e) { |
|
| 822 | 822 | throw $e; |
| 823 | 823 | } finally { |
| 824 | 824 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | } |
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | - } catch(\Exception $e) { |
|
| 845 | + } catch (\Exception $e) { |
|
| 846 | 846 | throw $e; |
| 847 | 847 | } finally { |
| 848 | 848 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | $hooks[] = 'write'; |
| 976 | 976 | break; |
| 977 | 977 | default: |
| 978 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR); |
|
| 978 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, \OCP\Util::ERROR); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
| 1080 | 1080 | ); |
| 1081 | 1081 | } |
| 1082 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1082 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1083 | 1083 | if ($storage) { |
| 1084 | 1084 | return $storage->hash($type, $internalPath, $raw); |
| 1085 | 1085 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | |
| 1134 | 1134 | $run = $this->runHooks($hooks, $path); |
| 1135 | 1135 | /** @var \OC\Files\Storage\Storage $storage */ |
| 1136 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1136 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1137 | 1137 | if ($run and $storage) { |
| 1138 | 1138 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
| 1139 | 1139 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | $unlockLater = true; |
| 1173 | 1173 | // make sure our unlocking callback will still be called if connection is aborted |
| 1174 | 1174 | ignore_user_abort(true); |
| 1175 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1175 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1176 | 1176 | if (in_array('write', $hooks)) { |
| 1177 | 1177 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1178 | 1178 | } else if (in_array('read', $hooks)) { |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | return true; |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1236 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | /** |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | if ($hook != 'read') { |
| 1253 | 1253 | \OC_Hook::emit( |
| 1254 | 1254 | Filesystem::CLASSNAME, |
| 1255 | - $prefix . $hook, |
|
| 1255 | + $prefix.$hook, |
|
| 1256 | 1256 | array( |
| 1257 | 1257 | Filesystem::signal_param_run => &$run, |
| 1258 | 1258 | Filesystem::signal_param_path => $path |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | } elseif (!$post) { |
| 1262 | 1262 | \OC_Hook::emit( |
| 1263 | 1263 | Filesystem::CLASSNAME, |
| 1264 | - $prefix . $hook, |
|
| 1264 | + $prefix.$hook, |
|
| 1265 | 1265 | array( |
| 1266 | 1266 | Filesystem::signal_param_path => $path |
| 1267 | 1267 | ) |
@@ -1356,7 +1356,7 @@ discard block |
||
| 1356 | 1356 | return $this->getPartFileInfo($path); |
| 1357 | 1357 | } |
| 1358 | 1358 | $relativePath = $path; |
| 1359 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1359 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1360 | 1360 | |
| 1361 | 1361 | $mount = Filesystem::getMountManager()->find($path); |
| 1362 | 1362 | if (!$mount) { |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | //add the sizes of other mount points to the folder |
| 1384 | 1384 | $extOnly = ($includeMountPoints === 'ext'); |
| 1385 | 1385 | $mounts = Filesystem::getMountManager()->findIn($path); |
| 1386 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1386 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1387 | 1387 | $subStorage = $mount->getStorage(); |
| 1388 | 1388 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1389 | 1389 | })); |
@@ -1433,12 +1433,12 @@ discard block |
||
| 1433 | 1433 | /** |
| 1434 | 1434 | * @var \OC\Files\FileInfo[] $files |
| 1435 | 1435 | */ |
| 1436 | - $files = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1436 | + $files = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1437 | 1437 | if ($sharingDisabled) { |
| 1438 | 1438 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1439 | 1439 | } |
| 1440 | 1440 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1441 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1441 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1442 | 1442 | }, $contents); |
| 1443 | 1443 | |
| 1444 | 1444 | //add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | } catch (\Exception $e) { |
| 1463 | 1463 | // sometimes when the storage is not available it can be any exception |
| 1464 | 1464 | \OC::$server->getLogger()->logException($e, [ |
| 1465 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
| 1465 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
| 1466 | 1466 | 'level' => \OCP\Util::ERROR, |
| 1467 | 1467 | 'app' => 'lib', |
| 1468 | 1468 | ]); |
@@ -1500,7 +1500,7 @@ discard block |
||
| 1500 | 1500 | break; |
| 1501 | 1501 | } |
| 1502 | 1502 | } |
| 1503 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1503 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1504 | 1504 | |
| 1505 | 1505 | // if sharing was disabled for the user we remove the share permissions |
| 1506 | 1506 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1508,14 +1508,14 @@ discard block |
||
| 1508 | 1508 | } |
| 1509 | 1509 | |
| 1510 | 1510 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1511 | - $files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1511 | + $files[] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1512 | 1512 | } |
| 1513 | 1513 | } |
| 1514 | 1514 | } |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | if ($mimetype_filter) { |
| 1518 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1518 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1519 | 1519 | if (strpos($mimetype_filter, '/')) { |
| 1520 | 1520 | return $file->getMimetype() === $mimetype_filter; |
| 1521 | 1521 | } else { |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | if ($data instanceof FileInfo) { |
| 1545 | 1545 | $data = $data->getData(); |
| 1546 | 1546 | } |
| 1547 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1547 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1548 | 1548 | /** |
| 1549 | 1549 | * @var \OC\Files\Storage\Storage $storage |
| 1550 | 1550 | * @var string $internalPath |
@@ -1571,7 +1571,7 @@ discard block |
||
| 1571 | 1571 | * @return FileInfo[] |
| 1572 | 1572 | */ |
| 1573 | 1573 | public function search($query) { |
| 1574 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 1574 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | /** |
@@ -1622,10 +1622,10 @@ discard block |
||
| 1622 | 1622 | |
| 1623 | 1623 | $results = call_user_func_array(array($cache, $method), $args); |
| 1624 | 1624 | foreach ($results as $result) { |
| 1625 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1625 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1626 | 1626 | $internalPath = $result['path']; |
| 1627 | - $path = $mountPoint . $result['path']; |
|
| 1628 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1627 | + $path = $mountPoint.$result['path']; |
|
| 1628 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1629 | 1629 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1630 | 1630 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1631 | 1631 | } |
@@ -1643,8 +1643,8 @@ discard block |
||
| 1643 | 1643 | if ($results) { |
| 1644 | 1644 | foreach ($results as $result) { |
| 1645 | 1645 | $internalPath = $result['path']; |
| 1646 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1647 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1646 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1647 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1648 | 1648 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
| 1649 | 1649 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1650 | 1650 | } |
@@ -1665,7 +1665,7 @@ discard block |
||
| 1665 | 1665 | public function getOwner($path) { |
| 1666 | 1666 | $info = $this->getFileInfo($path); |
| 1667 | 1667 | if (!$info) { |
| 1668 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1668 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1669 | 1669 | } |
| 1670 | 1670 | return $info->getOwner()->getUID(); |
| 1671 | 1671 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
| 1699 | 1699 | * @return string |
| 1700 | 1700 | */ |
| 1701 | 1701 | public function getPath($id) { |
| 1702 | - $id = (int)$id; |
|
| 1702 | + $id = (int) $id; |
|
| 1703 | 1703 | $manager = Filesystem::getMountManager(); |
| 1704 | 1704 | $mounts = $manager->findIn($this->fakeRoot); |
| 1705 | 1705 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1714,7 +1714,7 @@ discard block |
||
| 1714 | 1714 | $cache = $mount->getStorage()->getCache(); |
| 1715 | 1715 | $internalPath = $cache->getPathById($id); |
| 1716 | 1716 | if (is_string($internalPath)) { |
| 1717 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1717 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1718 | 1718 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1719 | 1719 | return $path; |
| 1720 | 1720 | } |
@@ -1757,10 +1757,10 @@ discard block |
||
| 1757 | 1757 | } |
| 1758 | 1758 | |
| 1759 | 1759 | // note: cannot use the view because the target is already locked |
| 1760 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1760 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1761 | 1761 | if ($fileId === -1) { |
| 1762 | 1762 | // target might not exist, need to check parent instead |
| 1763 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1763 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1764 | 1764 | } |
| 1765 | 1765 | |
| 1766 | 1766 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | $resultPath = ''; |
| 1861 | 1861 | foreach ($parts as $part) { |
| 1862 | 1862 | if ($part) { |
| 1863 | - $resultPath .= '/' . $part; |
|
| 1863 | + $resultPath .= '/'.$part; |
|
| 1864 | 1864 | $result[] = $resultPath; |
| 1865 | 1865 | } |
| 1866 | 1866 | } |
@@ -2123,16 +2123,16 @@ discard block |
||
| 2123 | 2123 | public function getUidAndFilename($filename) { |
| 2124 | 2124 | $info = $this->getFileInfo($filename); |
| 2125 | 2125 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2126 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2126 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2127 | 2127 | } |
| 2128 | 2128 | $uid = $info->getOwner()->getUID(); |
| 2129 | 2129 | if ($uid != \OCP\User::getUser()) { |
| 2130 | 2130 | Filesystem::initMountPoints($uid); |
| 2131 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2131 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2132 | 2132 | try { |
| 2133 | 2133 | $filename = $ownerView->getPath($info['fileid']); |
| 2134 | 2134 | } catch (NotFoundException $e) { |
| 2135 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2135 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2136 | 2136 | } |
| 2137 | 2137 | } |
| 2138 | 2138 | return [$uid, $filename]; |
@@ -2149,7 +2149,7 @@ discard block |
||
| 2149 | 2149 | $directoryParts = array_filter($directoryParts); |
| 2150 | 2150 | foreach ($directoryParts as $key => $part) { |
| 2151 | 2151 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2152 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2152 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2153 | 2153 | if ($this->is_file($currentPath)) { |
| 2154 | 2154 | return false; |
| 2155 | 2155 | } |