Completed
Pull Request — master (#3972)
by Lukas
14:41
created
apps/files/lib/Controller/ViewController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
apps/files/lib/Controller/ApiController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
apps/files/lib/AppInfo/Application.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(),
Please login to merge, or discard this patch.
apps/files/lib/Helper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
apps/files/lib/Command/TransferOwnership.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
apps/files/lib/BackgroundJob/CleanupFileLocks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
apps/files/lib/BackgroundJob/DeleteOrphanedItems.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,12 +80,12 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
apps/files/lib/Settings/Admin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		$maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size));
56 56
 
57 57
 		$parameters = [
58
-			'uploadChangable'              => (($htaccessWorking and $htaccessWritable) or $userIniWritable ),
58
+			'uploadChangable'              => (($htaccessWorking and $htaccessWritable) or $userIniWritable),
59 59
 			'uploadMaxFilesize'            => $maxUploadFilesize,
60 60
 			// max possible makes only sense on a 32 bit system
61 61
 			'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4,
Please login to merge, or discard this patch.
apps/files/download.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 
30 30
 $filename = $_GET["file"];
31 31
 
32
-if(!\OC\Files\Filesystem::file_exists($filename)) {
32
+if (!\OC\Files\Filesystem::file_exists($filename)) {
33 33
 	header("HTTP/1.0 404 Not Found");
34
-	$tmpl = new OCP\Template( '', '404', 'guest' );
34
+	$tmpl = new OCP\Template('', '404', 'guest');
35 35
 	$tmpl->assign('file', $filename);
36 36
 	$tmpl->printPage();
37 37
 	exit;
38 38
 }
39 39
 
40
-$ftype=\OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType( $filename ));
40
+$ftype = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename));
41 41
 
42 42
 header('Content-Type:'.$ftype);
43 43
 OCP\Response::setContentDispositionHeader(basename($filename), 'attachment');
@@ -45,4 +45,4 @@  discard block
 block discarded – undo
45 45
 OCP\Response::setContentLengthHeader(\OC\Files\Filesystem::filesize($filename));
46 46
 
47 47
 OC_Util::obEnd();
48
-\OC\Files\Filesystem::readfile( $filename );
48
+\OC\Files\Filesystem::readfile($filename);
Please login to merge, or discard this patch.