@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $this->notificationManager = $notificationManager; |
60 | 60 | $this->jobList = $jobList; |
61 | 61 | |
62 | - $this->setInterval(60*60*24*14); |
|
62 | + $this->setInterval(60 * 60 * 24 * 14); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | protected function run($argument) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | $providers = $this->registry->getProviderStates($user); |
75 | - $state2fa = array_reduce($providers, function (bool $carry, bool $state) { |
|
75 | + $state2fa = array_reduce($providers, function(bool $carry, bool $state) { |
|
76 | 76 | return $carry || $state; |
77 | 77 | }, false); |
78 | 78 |
@@ -143,7 +143,7 @@ |
||
143 | 143 | * @return boolean |
144 | 144 | */ |
145 | 145 | public function isActive(IUser $user): bool { |
146 | - $appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function ($appId) { |
|
146 | + $appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function($appId) { |
|
147 | 147 | return $appId !== $this->appName; |
148 | 148 | }); |
149 | 149 | foreach ($appIds as $appId) { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function run($argument) { |
51 | - $this->syncService->syncThemAll(function ($url, $ex) { |
|
51 | + $this->syncService->syncThemAll(function($url, $ex) { |
|
52 | 52 | if ($ex instanceof \Exception) { |
53 | 53 | $this->logger->logException($ex, [ |
54 | 54 | 'message' => "Error while syncing $url.", |
@@ -69,7 +69,7 @@ |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | $dispatcher = $container->getServer()->getEventDispatcher(); |
72 | - $dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function ($event) use ($container) { |
|
72 | + $dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use ($container) { |
|
73 | 73 | if ($event instanceof SabrePluginEvent) { |
74 | 74 | $server = $event->getServer(); |
75 | 75 | if ($server instanceof Server) { |
@@ -60,9 +60,9 @@ |
||
60 | 60 | |
61 | 61 | $progress = new ProgressBar($output); |
62 | 62 | $progress->start(); |
63 | - $this->syncService->syncThemAll(function ($url, $ex) use ($progress, $output) { |
|
63 | + $this->syncService->syncThemAll(function($url, $ex) use ($progress, $output) { |
|
64 | 64 | if ($ex instanceof \Exception) { |
65 | - $output->writeln("Error while syncing $url : " . $ex->getMessage()); |
|
65 | + $output->writeln("Error while syncing $url : ".$ex->getMessage()); |
|
66 | 66 | |
67 | 67 | } else { |
68 | 68 | $progress->advance(); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | <h2><?php p($l->t('No external storage configured or you don\'t have the permission to configure them')); ?></h2> |
97 | 97 | </div> |
98 | 98 | |
99 | -<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
|
99 | +<form data-can-create="<?php echo $canCreateMounts ? 'true' : 'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled'] ? 'true' : 'false'; ?>"> |
|
100 | 100 | <h2 class="inlineblock" data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2> |
101 | - <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a> |
|
101 | + <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation')); ?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a> |
|
102 | 102 | <p class="settings-hint"><?php p($l->t('External storage enables you to mount external storage services and devices as secondary Nextcloud storage devices. You may also allow users to mount their own external storage services.')); ?></p> |
103 | 103 | <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
104 | 104 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | <?php p($l->t('Add storage')); ?> |
135 | 135 | </option> |
136 | 136 | <?php |
137 | - $sortedBackends = array_filter($_['backends'], function ($backend) use ($_) { |
|
137 | + $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
138 | 138 | return $backend->isVisibleFor($_['visibilityType']); |
139 | 139 | }); |
140 | - uasort($sortedBackends, function ($a, $b) { |
|
140 | + uasort($sortedBackends, function($a, $b) { |
|
141 | 141 | return strcasecmp($a->getText(), $b->getText()); |
142 | 142 | }); |
143 | 143 | ?> |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> |
174 | 174 | <?php |
175 | - $userBackends = array_filter($_['backends'], function ($backend) { |
|
175 | + $userBackends = array_filter($_['backends'], function($backend) { |
|
176 | 176 | return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
177 | 177 | }); |
178 | 178 | ?> |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | private function callForRegistrations() { |
113 | 113 | static $eventSent = false; |
114 | - if(!$eventSent) { |
|
114 | + if (!$eventSent) { |
|
115 | 115 | \OC::$server->getEventDispatcher()->dispatch( |
116 | 116 | 'OCA\\Files_External::loadAdditionalBackends', |
117 | 117 | new GenericEvent() |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @return Backend[] |
217 | 217 | */ |
218 | 218 | public function getAvailableBackends() { |
219 | - return array_filter($this->getBackends(), function ($backend) { |
|
219 | + return array_filter($this->getBackends(), function($backend) { |
|
220 | 220 | return !$backend->checkDependencies(); |
221 | 221 | }); |
222 | 222 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return AuthMechanism[] |
256 | 256 | */ |
257 | 257 | public function getAuthMechanismsByScheme(array $schemes) { |
258 | - return array_filter($this->getAuthMechanisms(), function ($authMech) use ($schemes) { |
|
258 | + return array_filter($this->getAuthMechanisms(), function($authMech) use ($schemes) { |
|
259 | 259 | return in_array($authMech->getScheme(), $schemes, true); |
260 | 260 | }); |
261 | 261 | } |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function registerConfigHandler(string $placeholder, callable $configHandlerLoader) { |
324 | 324 | $placeholder = trim(strtolower($placeholder)); |
325 | - if(!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) { |
|
325 | + if (!(bool) \preg_match('/^[a-z0-9]*$/', $placeholder)) { |
|
326 | 326 | throw new \RuntimeException(sprintf( |
327 | 327 | 'Invalid placeholder %s, only [a-z0-9] are allowed', $placeholder |
328 | 328 | )); |
329 | 329 | } |
330 | - if($placeholder === '') { |
|
330 | + if ($placeholder === '') { |
|
331 | 331 | throw new \RuntimeException('Invalid empty placeholder'); |
332 | 332 | } |
333 | - if(isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) { |
|
333 | + if (isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) { |
|
334 | 334 | throw new \RuntimeException(sprintf('A handler is already registered for %s', $placeholder)); |
335 | 335 | } |
336 | 336 | $this->configHandlerLoaders[$placeholder] = $configHandlerLoader; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $newLoaded = false; |
342 | 342 | foreach ($this->configHandlerLoaders as $placeholder => $loader) { |
343 | 343 | $handler = $loader(); |
344 | - if(!$handler instanceof IConfigHandler) { |
|
344 | + if (!$handler instanceof IConfigHandler) { |
|
345 | 345 | throw new \RuntimeException(sprintf( |
346 | 346 | 'Handler for %s is not an instance of IConfigHandler', $placeholder |
347 | 347 | )); |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | $newLoaded = true; |
351 | 351 | } |
352 | 352 | $this->configHandlerLoaders = []; |
353 | - if($newLoaded) { |
|
353 | + if ($newLoaded) { |
|
354 | 354 | // ensure those with longest placeholders come first, |
355 | 355 | // to avoid substring matches |
356 | - uksort($this->configHandlers, function ($phA, $phB) { |
|
356 | + uksort($this->configHandlers, function($phA, $phB) { |
|
357 | 357 | return strlen($phB) <=> strlen($phA); |
358 | 358 | }); |
359 | 359 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $backendService = $container->query(BackendService::class); |
86 | 86 | $backendService->registerBackendProvider($this); |
87 | 87 | $backendService->registerAuthMechanismProvider($this); |
88 | - $backendService->registerConfigHandler('user', function () use ($container) { |
|
88 | + $backendService->registerConfigHandler('user', function() use ($container) { |
|
89 | 89 | return $container->query(UserPlaceholderHandler::class); |
90 | 90 | }); |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | public function registerListeners() { |
98 | 98 | $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
99 | 99 | $dispatcher->addListener( |
100 | - IUser::class . '::postDelete', |
|
101 | - function (GenericEvent $event) { |
|
100 | + IUser::class.'::postDelete', |
|
101 | + function(GenericEvent $event) { |
|
102 | 102 | /** @var IUser $user */ |
103 | 103 | $user = $event->getSubject(); |
104 | 104 | /** @var DBConfigService $config */ |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | } |
108 | 108 | ); |
109 | 109 | $dispatcher->addListener( |
110 | - IGroup::class . '::postDelete', |
|
111 | - function (GenericEvent $event) { |
|
110 | + IGroup::class.'::postDelete', |
|
111 | + function(GenericEvent $event) { |
|
112 | 112 | /** @var IGroup $group */ |
113 | 113 | $group = $event->getSubject(); |
114 | 114 | /** @var DBConfigService $config */ |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | return StorageNotAvailableException::STATUS_SUCCESS; |
248 | 248 | } |
249 | 249 | foreach ($options as $key => &$option) { |
250 | - if($key === 'password') { |
|
250 | + if ($key === 'password') { |
|
251 | 251 | // no replacements in passwords |
252 | 252 | continue; |
253 | 253 | } |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function readData($user = null) { |
286 | 286 | if (isset($user)) { |
287 | - $jsonFile = \OC::$server->getUserManager()->get($user)->getHome() . '/mount.json'; |
|
287 | + $jsonFile = \OC::$server->getUserManager()->get($user)->getHome().'/mount.json'; |
|
288 | 288 | } else { |
289 | 289 | $config = \OC::$server->getConfig(); |
290 | - $datadir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/'); |
|
291 | - $jsonFile = $config->getSystemValue('mount_file', $datadir . '/mount.json'); |
|
290 | + $datadir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data/'); |
|
291 | + $jsonFile = $config->getSystemValue('mount_file', $datadir.'/mount.json'); |
|
292 | 292 | } |
293 | 293 | if (is_file($jsonFile)) { |
294 | 294 | $mountPoints = json_decode(file_get_contents($jsonFile), true); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | foreach ($backends as $backend) { |
315 | 315 | foreach ($backend->checkDependencies() as $dependency) { |
316 | 316 | if ($message = $dependency->getMessage()) { |
317 | - $message .= '<p>' . $message . '</p>'; |
|
317 | + $message .= '<p>'.$message.'</p>'; |
|
318 | 318 | } else { |
319 | 319 | $dependencyGroups[$dependency->getDependency()][] = $backend; |
320 | 320 | } |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | foreach ($dependencyGroups as $module => $dependants) { |
325 | - $backends = implode(', ', array_map(function ($backend) { |
|
326 | - return '"' . $backend->getText() . '"'; |
|
325 | + $backends = implode(', ', array_map(function($backend) { |
|
326 | + return '"'.$backend->getText().'"'; |
|
327 | 327 | }, $dependants)); |
328 | - $message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>'; |
|
328 | + $message .= '<p>'.OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends).'</p>'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $message; |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) { |
343 | 343 | switch (strtolower($module)) { |
344 | 344 | case 'curl': |
345 | - return (string)$l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
345 | + return (string) $l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
346 | 346 | case 'ftp': |
347 | - return (string)$l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
347 | + return (string) $l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
348 | 348 | default: |
349 | - return (string)$l->t('"%1$s" is not installed. Mounting of %2$s is not possible. Please ask your system administrator to install it.', [$module, $backend]); |
|
349 | + return (string) $l->t('"%1$s" is not installed. Mounting of %2$s is not possible. Please ask your system administrator to install it.', [$module, $backend]); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $cipher = self::getCipher(); |
392 | 392 | $iv = \OC::$server->getSecureRandom()->generate(16); |
393 | 393 | $cipher->setIV($iv); |
394 | - return base64_encode($iv . $cipher->encrypt($password)); |
|
394 | + return base64_encode($iv.$cipher->encrypt($password)); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |