@@ -64,7 +64,7 @@ |
||
64 | 64 | if (!empty($nodes)) { |
65 | 65 | /** @var \OCP\Files\Node $node */ |
66 | 66 | $node = array_shift($nodes); |
67 | - $path = substr($node->getPath(), strlen($user . '/files/')); |
|
67 | + $path = substr($node->getPath(), strlen($user.'/files/')); |
|
68 | 68 | |
69 | 69 | $items[] = $path; |
70 | 70 | if ($node instanceof Folder) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | protected function renderScript($appName, $scriptName) { |
110 | 110 | $content = ''; |
111 | 111 | $appPath = \OC_App::getAppPath($appName); |
112 | - $scriptPath = $appPath . '/' . $scriptName; |
|
112 | + $scriptPath = $appPath.'/'.$scriptName; |
|
113 | 113 | if (file_exists($scriptPath)) { |
114 | 114 | // TODO: sanitize path / script name ? |
115 | 115 | ob_start(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); |
227 | 227 | |
228 | 228 | $params = []; |
229 | - $params['usedSpacePercent'] = (int)$storageInfo['relative']; |
|
229 | + $params['usedSpacePercent'] = (int) $storageInfo['relative']; |
|
230 | 230 | $params['owner'] = $storageInfo['owner']; |
231 | 231 | $params['ownerDisplayName'] = $storageInfo['ownerDisplayName']; |
232 | 232 | $params['isPublic'] = false; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $params = []; |
267 | 267 | |
268 | 268 | if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) { |
269 | - $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/'); |
|
269 | + $baseFolder = $this->rootFolder->get($uid.'/files_trashbin/files/'); |
|
270 | 270 | $files = $baseFolder->getById($fileId); |
271 | 271 | $params['view'] = 'trashbin'; |
272 | 272 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @return DataResponse|FileDisplayResponse |
107 | 107 | */ |
108 | 108 | public function getThumbnail($x, $y, $file) { |
109 | - if($x < 1 || $y < 1) { |
|
109 | + if ($x < 1 || $y < 1) { |
|
110 | 110 | return new DataResponse(['message' => 'Requested size must be numeric and a positive value.'], Http::STATUS_BAD_REQUEST); |
111 | 111 | } |
112 | 112 | |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | * @return array |
168 | 168 | */ |
169 | 169 | private function formatNodes(array $nodes) { |
170 | - return array_values(array_map(function (Node $node) { |
|
170 | + return array_values(array_map(function(Node $node) { |
|
171 | 171 | /** @var \OC\Files\Node\Node $shareTypes */ |
172 | 172 | $shareTypes = $this->getShareTypes($node); |
173 | 173 | $file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo()); |
174 | 174 | $parts = explode('/', dirname($node->getPath()), 4); |
175 | 175 | if (isset($parts[3])) { |
176 | - $file['path'] = '/' . $parts[3]; |
|
176 | + $file['path'] = '/'.$parts[3]; |
|
177 | 177 | } else { |
178 | 178 | $file['path'] = '/'; |
179 | 179 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | use OCA\Files\Controller\ViewController; |
32 | 32 | |
33 | 33 | class Application extends App { |
34 | - public function __construct(array $urlParams=array()) { |
|
34 | + public function __construct(array $urlParams = array()) { |
|
35 | 35 | parent::__construct('files', $urlParams); |
36 | 36 | $container = $this->getContainer(); |
37 | 37 | $server = $container->getServer(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * Controllers |
41 | 41 | */ |
42 | - $container->registerService('APIController', function (IContainer $c) use ($server) { |
|
42 | + $container->registerService('APIController', function(IContainer $c) use ($server) { |
|
43 | 43 | return new ApiController( |
44 | 44 | $c->query('AppName'), |
45 | 45 | $c->query('Request'), |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ); |
53 | 53 | }); |
54 | 54 | |
55 | - $container->registerService('ViewController', function (IContainer $c) use ($server) { |
|
55 | + $container->registerService('ViewController', function(IContainer $c) use ($server) { |
|
56 | 56 | return new ViewController( |
57 | 57 | $c->query('AppName'), |
58 | 58 | $c->query('Request'), |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * Services |
78 | 78 | */ |
79 | - $container->registerService('Tagger', function(IContainer $c) { |
|
79 | + $container->registerService('Tagger', function(IContainer $c) { |
|
80 | 80 | return $c->query('ServerContainer')->getTagManager()->load('files'); |
81 | 81 | }); |
82 | - $container->registerService('TagService', function(IContainer $c) { |
|
82 | + $container->registerService('TagService', function(IContainer $c) { |
|
83 | 83 | $homeFolder = $c->query('ServerContainer')->getUserFolder(); |
84 | 84 | return new TagService( |
85 | 85 | $c->query('ServerContainer')->getUserSession(), |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'uploadMaxFilesize' => $maxUploadFileSize, |
55 | 55 | 'maxHumanFilesize' => $maxHumanFileSize, |
56 | 56 | 'freeSpace' => $storageInfo['free'], |
57 | - 'usedSpacePercent' => (int)$storageInfo['relative'], |
|
57 | + 'usedSpacePercent' => (int) $storageInfo['relative'], |
|
58 | 58 | 'owner' => $storageInfo['owner'], |
59 | 59 | 'ownerDisplayName' => $storageInfo['ownerDisplayName'], |
60 | 60 | ]; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return string icon URL |
68 | 68 | */ |
69 | 69 | public static function determineIcon($file) { |
70 | - if($file['type'] === 'dir') { |
|
70 | + if ($file['type'] === 'dir') { |
|
71 | 71 | $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir'); |
72 | 72 | // TODO: move this part to the client side, using mountType |
73 | 73 | if ($file->isShared()) { |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | } elseif ($file->isMounted()) { |
76 | 76 | $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external'); |
77 | 77 | } |
78 | - }else{ |
|
78 | + } else { |
|
79 | 79 | $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype()); |
80 | 80 | } |
81 | 81 | |
82 | - return substr($icon, 0, -3) . 'svg'; |
|
82 | + return substr($icon, 0, -3).'svg'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $progress->start(); |
157 | 157 | $self = $this; |
158 | 158 | $this->walkFiles($view, "$this->sourceUser/files", |
159 | - function (FileInfo $fileInfo) use ($progress, $self) { |
|
159 | + function(FileInfo $fileInfo) use ($progress, $self) { |
|
160 | 160 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
161 | 161 | // only analyze into folders from main storage, |
162 | 162 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | // no file is allowed to be encrypted |
178 | 178 | if (!empty($this->encryptedFiles)) { |
179 | 179 | $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
180 | - foreach($this->encryptedFiles as $encryptedFile) { |
|
180 | + foreach ($this->encryptedFiles as $encryptedFile) { |
|
181 | 181 | /** @var FileInfo $encryptedFile */ |
182 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
182 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
183 | 183 | } |
184 | 184 | throw new \Exception('Execution terminated.'); |
185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $output->writeln("Collecting all share information for files and folder of $this->sourceUser ..."); |
194 | 194 | |
195 | 195 | $progress = new ProgressBar($output, count($this->shares)); |
196 | - foreach([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
196 | + foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
197 | 197 | $offset = 0; |
198 | 198 | while (true) { |
199 | 199 | $sharePage = $this->shareManager->getSharesBy($this->sourceUser, $shareType, null, true, 50, $offset); |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | $output->writeln("Restoring shares ..."); |
229 | 229 | $progress = new ProgressBar($output, count($this->shares)); |
230 | 230 | |
231 | - foreach($this->shares as $share) { |
|
231 | + foreach ($this->shares as $share) { |
|
232 | 232 | try { |
233 | 233 | if ($share->getSharedWith() === $this->destinationUser) { |
234 | 234 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
235 | - $shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget()); |
|
235 | + $shareMountPoint = $this->mountManager->find('/'.$this->destinationUser.'/files'.$share->getTarget()); |
|
236 | 236 | if ($shareMountPoint) { |
237 | 237 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
238 | 238 | } |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | $this->shareManager->updateShare($share); |
249 | 249 | } |
250 | 250 | } catch (\OCP\Files\NotFoundException $e) { |
251 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
251 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
252 | 252 | } catch (\Exception $e) { |
253 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
253 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
254 | 254 | } |
255 | 255 | $progress->advance(); |
256 | 256 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $path = basename($fullPath); |
104 | 104 | |
105 | 105 | if ($normalizedPath !== $path) { |
106 | - $output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>'); |
|
106 | + $output->writeln("\t<error>Entry \"".$fullPath.'" will not be accessible due to incompatible encoding</error>'); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -113,32 +113,32 @@ discard block |
||
113 | 113 | # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception |
114 | 114 | # printout and count |
115 | 115 | if ($verbose) { |
116 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { |
|
116 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { |
|
117 | 117 | $output->writeln("\tFile <info>$path</info>"); |
118 | 118 | $this->filesCounter += 1; |
119 | 119 | if ($this->hasBeenInterrupted()) { |
120 | 120 | throw new \Exception('ctrl-c'); |
121 | 121 | } |
122 | 122 | }); |
123 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { |
|
123 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) { |
|
124 | 124 | $output->writeln("\tFolder <info>$path</info>"); |
125 | 125 | $this->foldersCounter += 1; |
126 | 126 | if ($this->hasBeenInterrupted()) { |
127 | 127 | throw new \Exception('ctrl-c'); |
128 | 128 | } |
129 | 129 | }); |
130 | - $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { |
|
131 | - $output->writeln("Error while scanning, storage not available (" . $e->getMessage() . ")"); |
|
130 | + $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function(StorageNotAvailableException $e) use ($output) { |
|
131 | + $output->writeln("Error while scanning, storage not available (".$e->getMessage().")"); |
|
132 | 132 | }); |
133 | 133 | # count only |
134 | 134 | } else { |
135 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) { |
|
135 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function() use ($output) { |
|
136 | 136 | $this->filesCounter += 1; |
137 | 137 | if ($this->hasBeenInterrupted()) { |
138 | 138 | throw new \Exception('ctrl-c'); |
139 | 139 | } |
140 | 140 | }); |
141 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) { |
|
141 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function() use ($output) { |
|
142 | 142 | $this->foldersCounter += 1; |
143 | 143 | if ($this->hasBeenInterrupted()) { |
144 | 144 | throw new \Exception('ctrl-c'); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | try { |
156 | 156 | if ($backgroundScan) { |
157 | 157 | $scanner->backgroundScan($path); |
158 | - }else { |
|
158 | + } else { |
|
159 | 159 | $scanner->scan($path); |
160 | 160 | } |
161 | 161 | } catch (ForbiddenException $e) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $output->writeln("Make sure you're running the scan command only as the user the web server runs as"); |
164 | 164 | } catch (\Exception $e) { |
165 | 165 | if ($e->getMessage() !== 'ctrl-c') { |
166 | - $output->writeln('<error>Exception while scanning: ' . $e->getMessage() . "\n" . $e->getTraceAsString() . '</error>'); |
|
166 | + $output->writeln('<error>Exception while scanning: '.$e->getMessage()."\n".$e->getTraceAsString().'</error>'); |
|
167 | 167 | } |
168 | 168 | return; |
169 | 169 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | protected function execute(InputInterface $input, OutputInterface $output) { |
174 | 174 | $inputPath = $input->getOption('path'); |
175 | 175 | if ($inputPath) { |
176 | - $inputPath = '/' . trim($inputPath, '/'); |
|
176 | + $inputPath = '/'.trim($inputPath, '/'); |
|
177 | 177 | list (, $user,) = explode('/', $inputPath, 3); |
178 | 178 | $users = array($user); |
179 | 179 | } else if ($input->getOption('all')) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $verbose = $input->getOption('verbose'); |
193 | 193 | $quiet = $input->getOption('quiet'); |
194 | 194 | # restrict the verbosity level to VERBOSITY_VERBOSE |
195 | - if ($output->getVerbosity()>OutputInterface::VERBOSITY_VERBOSE) { |
|
195 | + if ($output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) { |
|
196 | 196 | $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); |
197 | 197 | } |
198 | 198 | if ($quiet) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | if (is_object($user)) { |
218 | 218 | $user = $user->getUID(); |
219 | 219 | } |
220 | - $path = $inputPath ? $inputPath : '/' . $user; |
|
220 | + $path = $inputPath ? $inputPath : '/'.$user; |
|
221 | 221 | $user_count += 1; |
222 | 222 | if ($this->userManager->userExists($user)) { |
223 | 223 | # add an extra line when verbose is set to optical separate users |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function run($argument) { |
53 | 53 | $lockingProvider = \OC::$server->getLockingProvider(); |
54 | - if($lockingProvider instanceof DBLockingProvider) { |
|
54 | + if ($lockingProvider instanceof DBLockingProvider) { |
|
55 | 55 | $lockingProvider->cleanExpiredLocks(); |
56 | 56 | } |
57 | 57 | } |
@@ -80,12 +80,12 @@ |
||
80 | 80 | $deletedEntries = 0; |
81 | 81 | |
82 | 82 | $query = $this->connection->getQueryBuilder(); |
83 | - $query->select('t1.' . $idCol) |
|
83 | + $query->select('t1.'.$idCol) |
|
84 | 84 | ->from($table, 't1') |
85 | 85 | ->where($query->expr()->eq($typeCol, $query->expr()->literal('files'))) |
86 | 86 | ->andWhere($query->expr()->isNull('t2.fileid')) |
87 | - ->leftJoin('t1', 'filecache', 't2', $query->expr()->eq($query->expr()->castColumn('t1.' . $idCol, IQueryBuilder::PARAM_INT), 't2.fileid')) |
|
88 | - ->groupBy('t1.' . $idCol) |
|
87 | + ->leftJoin('t1', 'filecache', 't2', $query->expr()->eq($query->expr()->castColumn('t1.'.$idCol, IQueryBuilder::PARAM_INT), 't2.fileid')) |
|
88 | + ->groupBy('t1.'.$idCol) |
|
89 | 89 | ->setMaxResults(self::CHUNK_SIZE); |
90 | 90 | |
91 | 91 | $deleteQuery = $this->connection->getQueryBuilder(); |