@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getMountsForUser(IUser $user) { |
80 | 80 | $loader = $this->loader; |
81 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
81 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
82 | 82 | return $provider->getMountsForUser($user, $loader); |
83 | 83 | }, $this->providers); |
84 | - $mounts = array_filter($mounts, function ($result) { |
|
84 | + $mounts = array_filter($mounts, function($result) { |
|
85 | 85 | return is_array($result); |
86 | 86 | }); |
87 | - $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
87 | + $mounts = array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
88 | 88 | return array_merge($mounts, $providerMounts); |
89 | 89 | }, []); |
90 | 90 | return $this->filterMounts($user, $mounts); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | // shared mount provider gets to go last since it needs to know existing files |
95 | 95 | // to check for name collisions |
96 | 96 | $firstMounts = []; |
97 | - $firstProviders = array_filter($this->providers, function (IMountProvider $provider) { |
|
97 | + $firstProviders = array_filter($this->providers, function(IMountProvider $provider) { |
|
98 | 98 | return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); |
99 | 99 | }); |
100 | - $lastProviders = array_filter($this->providers, function (IMountProvider $provider) { |
|
100 | + $lastProviders = array_filter($this->providers, function(IMountProvider $provider) { |
|
101 | 101 | return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); |
102 | 102 | }); |
103 | 103 | foreach ($firstProviders as $provider) { |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
136 | 136 | foreach ($providers as $homeProvider) { |
137 | 137 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
138 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
138 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
139 | 139 | return $mount; |
140 | 140 | } |
141 | 141 | } |
142 | - throw new \Exception('No home storage configured for user ' . $user); |
|
142 | + throw new \Exception('No home storage configured for user '.$user); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | private function filterMounts(IUser $user, array $mountPoints) { |
161 | - return array_filter($mountPoints, function (IMountPoint $mountPoint) use ($user) { |
|
161 | + return array_filter($mountPoints, function(IMountPoint $mountPoint) use ($user) { |
|
162 | 162 | foreach ($this->mountFilters as $filter) { |
163 | 163 | if ($filter($mountPoint, $user) === false) { |
164 | 164 | return false; |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | throw new \Exception("Access Key, Secret and Bucket have to be configured."); |
55 | 55 | } |
56 | 56 | |
57 | - $this->id = 'amazon::' . $params['bucket']; |
|
57 | + $this->id = 'amazon::'.$params['bucket']; |
|
58 | 58 | |
59 | 59 | $this->test = isset($params['test']); |
60 | 60 | $this->bucket = $params['bucket']; |
61 | 61 | $this->timeout = !isset($params['timeout']) ? 15 : $params['timeout']; |
62 | 62 | $params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region']; |
63 | - $params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname']; |
|
63 | + $params['hostname'] = empty($params['hostname']) ? 's3.'.$params['region'].'.amazonaws.com' : $params['hostname']; |
|
64 | 64 | if (!isset($params['port']) || $params['port'] === '') { |
65 | 65 | $params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443; |
66 | 66 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $scheme = (isset($this->params['use_ssl']) && $this->params['use_ssl'] === false) ? 'http' : 'https'; |
86 | - $base_url = $scheme . '://' . $this->params['hostname'] . ':' . $this->params['port'] . '/'; |
|
86 | + $base_url = $scheme.'://'.$this->params['hostname'].':'.$this->params['port'].'/'; |
|
87 | 87 | |
88 | 88 | $options = [ |
89 | 89 | 'version' => isset($this->params['version']) ? $this->params['version'] : 'latest', |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | |
107 | 107 | if (!$this->connection->isBucketDnsCompatible($this->bucket)) { |
108 | 108 | $logger = \OC::$server->getLogger(); |
109 | - $logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.', |
|
109 | + $logger->debug('Bucket "'.$this->bucket.'" This bucket name is not dns compatible, it may contain invalid characters.', |
|
110 | 110 | ['app' => 'objectstore']); |
111 | 111 | } |
112 | 112 | |
113 | 113 | if (!$this->connection->doesBucketExist($this->bucket)) { |
114 | 114 | $logger = \OC::$server->getLogger(); |
115 | 115 | try { |
116 | - $logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']); |
|
116 | + $logger->info('Bucket "'.$this->bucket.'" does not exist - creating it.', ['app' => 'objectstore']); |
|
117 | 117 | if (!$this->connection->isBucketDnsCompatible($this->bucket)) { |
118 | - throw new \Exception("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket); |
|
118 | + throw new \Exception("The bucket will not be created because the name is not dns compatible, please correct it: ".$this->bucket); |
|
119 | 119 | } |
120 | 120 | $this->connection->createBucket(['Bucket' => $this->bucket]); |
121 | 121 | $this->testTimeout(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | 'level' => ILogger::DEBUG, |
126 | 126 | 'app' => 'objectstore', |
127 | 127 | ]); |
128 | - throw new \Exception('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage()); |
|
128 | + throw new \Exception('Creation of bucket "'.$this->bucket.'" failed. '.$e->getMessage()); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | $rootView = new View(); |
56 | 56 | $user = \OC::$server->getUserSession()->getUser(); |
57 | 57 | Filesystem::initMountPoints($user->getUID()); |
58 | - if (!$rootView->file_exists('/' . $user->getUID() . '/cache')) { |
|
59 | - $rootView->mkdir('/' . $user->getUID() . '/cache'); |
|
58 | + if (!$rootView->file_exists('/'.$user->getUID().'/cache')) { |
|
59 | + $rootView->mkdir('/'.$user->getUID().'/cache'); |
|
60 | 60 | } |
61 | - $this->storage = new View('/' . $user->getUID() . '/cache'); |
|
61 | + $this->storage = new View('/'.$user->getUID().'/cache'); |
|
62 | 62 | return $this->storage; |
63 | 63 | } else { |
64 | 64 | \OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', ILogger::ERROR); |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | // unique id to avoid chunk collision, just in case |
109 | 109 | $uniqueId = \OC::$server->getSecureRandom()->generate( |
110 | 110 | 16, |
111 | - ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER |
|
111 | + ISecureRandom::CHAR_DIGITS.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER |
|
112 | 112 | ); |
113 | 113 | |
114 | 114 | // use part file to prevent hasKey() to find the key |
115 | 115 | // while it is being written |
116 | - $keyPart = $key . '.' . $uniqueId . '.part'; |
|
116 | + $keyPart = $key.'.'.$uniqueId.'.part'; |
|
117 | 117 | if ($storage and $storage->file_put_contents($keyPart, $value)) { |
118 | 118 | if ($ttl === 0) { |
119 | 119 | $ttl = 86400; // 60*60*24 |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | if (is_resource($dh)) { |
163 | 163 | while (($file = readdir($dh)) !== false) { |
164 | 164 | if ($file != '.' and $file != '..' and ($prefix === '' || strpos($file, $prefix) === 0)) { |
165 | - $storage->unlink('/' . $file); |
|
165 | + $storage->unlink('/'.$file); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | while (($file = readdir($dh)) !== false) { |
188 | 188 | if ($file != '.' and $file != '..') { |
189 | 189 | try { |
190 | - $mtime = $storage->filemtime('/' . $file); |
|
190 | + $mtime = $storage->filemtime('/'.$file); |
|
191 | 191 | if ($mtime < $now) { |
192 | - $storage->unlink('/' . $file); |
|
192 | + $storage->unlink('/'.$file); |
|
193 | 193 | } |
194 | 194 | } catch (\OCP\Lock\LockedException $e) { |
195 | 195 | // ignore locked chunks |
196 | - \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', ['app' => 'core']); |
|
196 | + \OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', ['app' => 'core']); |
|
197 | 197 | } catch (\OCP\Files\ForbiddenException $e) { |
198 | - \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "' . $file . '"', ['app' => 'core']); |
|
198 | + \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "'.$file.'"', ['app' => 'core']); |
|
199 | 199 | } catch (\OCP\Files\LockNotAcquiredException $e) { |
200 | - \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', ['app' => 'core']); |
|
200 | + \OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', ['app' => 'core']); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function generate($name, $parameters = [], $absolute = false) { |
53 | 53 | asort($parameters); |
54 | - $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute; |
|
54 | + $key = $this->context->getHost().'#'.$this->context->getBaseUrl().$name.sha1(json_encode($parameters)).(int) $absolute; |
|
55 | 55 | $cachedKey = $this->cache->get($key); |
56 | 56 | if ($cachedKey) { |
57 | 57 | return $cachedKey; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | private function updateMimetypes($updatedMimetypes) { |
92 | 92 | if (empty($this->folderMimeTypeId)) { |
93 | 93 | $result = \OC_DB::executeAudited(self::getIdStmt(), ['httpd/unix-directory']); |
94 | - $this->folderMimeTypeId = (int)$result->fetchOne(); |
|
94 | + $this->folderMimeTypeId = (int) $result->fetchOne(); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $count = 0; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $mimetypeId = $result->fetchOne(); |
110 | 110 | |
111 | 111 | // change mimetype for files with x extension |
112 | - $count += \OC_DB::executeAudited(self::updateByNameStmt(), [$mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.' . $extension]); |
|
112 | + $count += \OC_DB::executeAudited(self::updateByNameStmt(), [$mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.'.$extension]); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $count; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $tables = $this->getAllNonUTF8BinTables($this->connection); |
79 | 79 | foreach ($tables as $table) { |
80 | 80 | $output->info("Change row format for $table ..."); |
81 | - $query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT = DYNAMIC;'); |
|
81 | + $query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT = DYNAMIC;'); |
|
82 | 82 | try { |
83 | 83 | $query->execute(); |
84 | 84 | } catch (DriverException $e) { |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | $output->info("Change collation for $table ..."); |
93 | 93 | if ($characterSet === 'utf8mb4') { |
94 | 94 | // need to set row compression first |
95 | - $query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT=COMPRESSED;'); |
|
95 | + $query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT=COMPRESSED;'); |
|
96 | 96 | $query->execute(); |
97 | 97 | } |
98 | - $query = $this->connection->prepare('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET ' . $characterSet . ' COLLATE ' . $characterSet . '_bin;'); |
|
98 | + $query = $this->connection->prepare('ALTER TABLE `'.$table.'` CONVERT TO CHARACTER SET '.$characterSet.' COLLATE '.$characterSet.'_bin;'); |
|
99 | 99 | try { |
100 | 100 | $query->execute(); |
101 | 101 | } catch (DriverException $e) { |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | |
122 | 122 | // fetch tables by columns |
123 | 123 | $statement = $connection->executeQuery( |
124 | - "SELECT DISTINCT(TABLE_NAME) AS `table`" . |
|
125 | - " FROM INFORMATION_SCHEMA . COLUMNS" . |
|
126 | - " WHERE TABLE_SCHEMA = ?" . |
|
127 | - " AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" . |
|
124 | + "SELECT DISTINCT(TABLE_NAME) AS `table`". |
|
125 | + " FROM INFORMATION_SCHEMA . COLUMNS". |
|
126 | + " WHERE TABLE_SCHEMA = ?". |
|
127 | + " AND (COLLATION_NAME <> '".$characterSet."_bin' OR CHARACTER_SET_NAME <> '".$characterSet."')". |
|
128 | 128 | " AND TABLE_NAME LIKE '*PREFIX*%'", |
129 | 129 | [$dbName] |
130 | 130 | ); |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | |
137 | 137 | // fetch tables by collation |
138 | 138 | $statement = $connection->executeQuery( |
139 | - "SELECT DISTINCT(TABLE_NAME) AS `table`" . |
|
140 | - " FROM INFORMATION_SCHEMA . TABLES" . |
|
141 | - " WHERE TABLE_SCHEMA = ?" . |
|
142 | - " AND TABLE_COLLATION <> '" . $characterSet . "_bin'" . |
|
139 | + "SELECT DISTINCT(TABLE_NAME) AS `table`". |
|
140 | + " FROM INFORMATION_SCHEMA . TABLES". |
|
141 | + " WHERE TABLE_SCHEMA = ?". |
|
142 | + " AND TABLE_COLLATION <> '".$characterSet."_bin'". |
|
143 | 143 | " AND TABLE_NAME LIKE '*PREFIX*%'", |
144 | 144 | [$dbName] |
145 | 145 | ); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | $params = []; |
94 | 94 | if (count($ids) == 1 && isset($uidOwner)) { |
95 | 95 | // FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach |
96 | - $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' . |
|
97 | - '`item_target`, `file_target`, `parent` ' . |
|
98 | - 'FROM `*PREFIX*share` ' . |
|
96 | + $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '. |
|
97 | + '`item_target`, `file_target`, `parent` '. |
|
98 | + 'FROM `*PREFIX*share` '. |
|
99 | 99 | 'WHERE `parent` IN ('.$parents.') AND `uid_owner` = ? '; |
100 | 100 | $params[] = $uidOwner; |
101 | 101 | } else { |
102 | - $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' . |
|
103 | - '`item_target`, `file_target`, `parent`, `uid_owner` ' . |
|
102 | + $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '. |
|
103 | + '`item_target`, `file_target`, `parent`, `uid_owner` '. |
|
104 | 104 | 'FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') '; |
105 | 105 | } |
106 | 106 | if ($excludeGroupChildren) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'shareWith' => $item['share_with'], |
118 | 118 | 'itemTarget' => $item['item_target'], |
119 | 119 | 'itemType' => $item['item_type'], |
120 | - 'shareType' => (int)$item['share_type'], |
|
120 | + 'shareType' => (int) $item['share_type'], |
|
121 | 121 | ]; |
122 | 122 | if (isset($item['file_target'])) { |
123 | 123 | $tmpItem['fileTarget'] = $item['file_target']; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | if ($defaultExpireDate === 'yes') { |
169 | 169 | $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); |
170 | 170 | $defaultExpireSettings['defaultExpireDateSet'] = true; |
171 | - $defaultExpireSettings['expireAfterDays'] = (int)$config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
171 | + $defaultExpireSettings['expireAfterDays'] = (int) $config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
172 | 172 | $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes'; |
173 | 173 | } |
174 | 174 |
@@ -91,20 +91,20 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function addFolder($path) { |
93 | 93 | $tmpBase = \OC::$server->getTempManager()->getTemporaryFolder(); |
94 | - $path = rtrim($path, '/') . '/'; |
|
94 | + $path = rtrim($path, '/').'/'; |
|
95 | 95 | if ($this->fileExists($path)) { |
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | $parts = explode('/', $path); |
99 | 99 | $folder = $tmpBase; |
100 | 100 | foreach ($parts as $part) { |
101 | - $folder .= '/' . $part; |
|
101 | + $folder .= '/'.$part; |
|
102 | 102 | if (!is_dir($folder)) { |
103 | 103 | mkdir($folder); |
104 | 104 | } |
105 | 105 | } |
106 | - $result = $this->tar->addModify([$tmpBase . $path], '', $tmpBase); |
|
107 | - rmdir($tmpBase . $path); |
|
106 | + $result = $this->tar->addModify([$tmpBase.$path], '', $tmpBase); |
|
107 | + rmdir($tmpBase.$path); |
|
108 | 108 | $this->fileList = false; |
109 | 109 | $this->cachedHeaders = false; |
110 | 110 | return $result; |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | //no proper way to delete, rename entire archive, rename file and remake archive |
142 | 142 | $tmp = \OC::$server->getTempManager()->getTemporaryFolder(); |
143 | 143 | $this->tar->extract($tmp); |
144 | - rename($tmp . $source, $tmp . $dest); |
|
144 | + rename($tmp.$source, $tmp.$dest); |
|
145 | 145 | $this->tar = null; |
146 | 146 | unlink($this->path); |
147 | 147 | $types = [null, 'gz', 'bz']; |
148 | 148 | $this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]); |
149 | - $this->tar->createModify([$tmp], '', $tmp . '/'); |
|
149 | + $this->tar->createModify([$tmp], '', $tmp.'/'); |
|
150 | 150 | $this->fileList = false; |
151 | 151 | $this->cachedHeaders = false; |
152 | 152 | return true; |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | } |
162 | 162 | foreach ($this->cachedHeaders as $header) { |
163 | 163 | if ($file == $header['filename'] |
164 | - or $file . '/' == $header['filename'] |
|
165 | - or '/' . $file . '/' == $header['filename'] |
|
166 | - or '/' . $file == $header['filename'] |
|
164 | + or $file.'/' == $header['filename'] |
|
165 | + or '/'.$file.'/' == $header['filename'] |
|
166 | + or '/'.$file == $header['filename'] |
|
167 | 167 | ) { |
168 | 168 | return $header; |
169 | 169 | } |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | if (!$this->fileExists($path)) { |
263 | 263 | return false; |
264 | 264 | } |
265 | - if ($this->fileExists('/' . $path)) { |
|
266 | - $success = $this->tar->extractList(['/' . $path], $tmp); |
|
265 | + if ($this->fileExists('/'.$path)) { |
|
266 | + $success = $this->tar->extractList(['/'.$path], $tmp); |
|
267 | 267 | } else { |
268 | 268 | $success = $this->tar->extractList([$path], $tmp); |
269 | 269 | } |
270 | 270 | if ($success) { |
271 | - rename($tmp . $path, $dest); |
|
271 | + rename($tmp.$path, $dest); |
|
272 | 272 | } |
273 | 273 | \OCP\Files::rmdirr($tmp); |
274 | 274 | return $success; |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function fileExists($path) { |
294 | 294 | $files = $this->getFiles(); |
295 | - if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) { |
|
295 | + if ((array_search($path, $files) !== false) or (array_search($path.'/', $files) !== false)) { |
|
296 | 296 | return true; |
297 | 297 | } else { |
298 | - $folderPath = rtrim($path, '/') . '/'; |
|
298 | + $folderPath = rtrim($path, '/').'/'; |
|
299 | 299 | $pathLength = strlen($folderPath); |
300 | 300 | foreach ($files as $file) { |
301 | 301 | if (strlen($file) > $pathLength and substr($file, 0, $pathLength) == $folderPath) { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | } |
306 | 306 | if ($path[0] != '/') { //not all programs agree on the use of a leading / |
307 | - return $this->fileExists('/' . $path); |
|
307 | + return $this->fileExists('/'.$path); |
|
308 | 308 | } else { |
309 | 309 | return false; |
310 | 310 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | //no proper way to delete, extract entire archive, delete file and remake archive |
326 | 326 | $tmp = \OC::$server->getTempManager()->getTemporaryFolder(); |
327 | 327 | $this->tar->extract($tmp); |
328 | - \OCP\Files::rmdirr($tmp . $path); |
|
328 | + \OCP\Files::rmdirr($tmp.$path); |
|
329 | 329 | $this->tar = null; |
330 | 330 | unlink($this->path); |
331 | 331 | $this->reopen(); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | return fopen($tmpFile, $mode); |
357 | 357 | } else { |
358 | 358 | $handle = fopen($tmpFile, $mode); |
359 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
359 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
360 | 360 | $this->writeBack($tmpFile, $path); |
361 | 361 | }); |
362 | 362 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | return []; |
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 []; |
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 | } |