@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | $this->logAllEvents(); |
105 | 105 | |
106 | 106 | $logLevel = $this->config->getSystemValue('loglevel', ILogger::WARN); |
107 | - $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
107 | + $this->emit('\OC\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
108 | 108 | $this->config->setSystemValue('loglevel', ILogger::DEBUG); |
109 | 109 | |
110 | 110 | $wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance'); |
111 | 111 | |
112 | - if(!$wasMaintenanceModeEnabled) { |
|
112 | + if (!$wasMaintenanceModeEnabled) { |
|
113 | 113 | $this->config->setSystemValue('maintenance', true); |
114 | 114 | $this->emit('\OC\Updater', 'maintenanceEnabled'); |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Clear CAN_INSTALL file if not on git |
118 | 118 | if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) { |
119 | - if (!unlink(\OC::$configDir . '/CAN_INSTALL')) { |
|
119 | + if (!unlink(\OC::$configDir.'/CAN_INSTALL')) { |
|
120 | 120 | $this->log->error('Could not cleanup CAN_INSTALL from your config folder. Please remove this file manually.'); |
121 | 121 | } |
122 | 122 | } |
@@ -124,31 +124,31 @@ discard block |
||
124 | 124 | $installedVersion = $this->config->getSystemValue('version', '0.0.0'); |
125 | 125 | $currentVersion = implode('.', \OCP\Util::getVersion()); |
126 | 126 | |
127 | - $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, ['app' => 'core']); |
|
127 | + $this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, ['app' => 'core']); |
|
128 | 128 | |
129 | 129 | $success = true; |
130 | 130 | try { |
131 | 131 | $this->doUpgrade($currentVersion, $installedVersion); |
132 | 132 | } catch (HintException $exception) { |
133 | 133 | $this->log->logException($exception, ['app' => 'core']); |
134 | - $this->emit('\OC\Updater', 'failure', [$exception->getMessage() . ': ' .$exception->getHint()]); |
|
134 | + $this->emit('\OC\Updater', 'failure', [$exception->getMessage().': '.$exception->getHint()]); |
|
135 | 135 | $success = false; |
136 | 136 | } catch (\Exception $exception) { |
137 | 137 | $this->log->logException($exception, ['app' => 'core']); |
138 | - $this->emit('\OC\Updater', 'failure', [get_class($exception) . ': ' .$exception->getMessage()]); |
|
138 | + $this->emit('\OC\Updater', 'failure', [get_class($exception).': '.$exception->getMessage()]); |
|
139 | 139 | $success = false; |
140 | 140 | } |
141 | 141 | |
142 | 142 | $this->emit('\OC\Updater', 'updateEnd', [$success]); |
143 | 143 | |
144 | - if(!$wasMaintenanceModeEnabled && $success) { |
|
144 | + if (!$wasMaintenanceModeEnabled && $success) { |
|
145 | 145 | $this->config->setSystemValue('maintenance', false); |
146 | 146 | $this->emit('\OC\Updater', 'maintenanceDisabled'); |
147 | 147 | } else { |
148 | 148 | $this->emit('\OC\Updater', 'maintenanceActive'); |
149 | 149 | } |
150 | 150 | |
151 | - $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
151 | + $this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
152 | 152 | $this->config->setSystemValue('loglevel', $logLevel); |
153 | 153 | $this->config->setSystemValue('installed', true); |
154 | 154 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | private function getAllowedPreviousVersions() { |
164 | 164 | // this should really be a JSON file |
165 | - require \OC::$SERVERROOT . '/version.php'; |
|
165 | + require \OC::$SERVERROOT.'/version.php'; |
|
166 | 166 | /** @var array $OC_VersionCanBeUpgradedFrom */ |
167 | 167 | return $OC_VersionCanBeUpgradedFrom; |
168 | 168 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | private function getVendor() { |
176 | 176 | // this should really be a JSON file |
177 | - require \OC::$SERVERROOT . '/version.php'; |
|
177 | + require \OC::$SERVERROOT.'/version.php'; |
|
178 | 178 | /** @var string $vendor */ |
179 | 179 | return (string) $vendor; |
180 | 180 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) { |
190 | 190 | $version = explode('.', $oldVersion); |
191 | - $majorMinor = $version[0] . '.' . $version[1]; |
|
191 | + $majorMinor = $version[0].'.'.$version[1]; |
|
192 | 192 | |
193 | 193 | $currentVendor = $this->config->getAppValue('core', 'vendor', ''); |
194 | 194 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | // create empty file in data dir, so we can later find |
236 | 236 | // out that this is indeed an ownCloud data directory |
237 | 237 | // (in case it didn't exist before) |
238 | - file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); |
|
238 | + file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); |
|
239 | 239 | |
240 | 240 | // pre-upgrade repairs |
241 | 241 | $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | foreach ($errors as $appId => $exception) { |
269 | 269 | /** @var \Exception $exception */ |
270 | 270 | $this->log->logException($exception, ['app' => $appId]); |
271 | - $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]); |
|
271 | + $this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | // post-upgrade repairs |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $this->config->setAppValue('core', 'lastupdatedat', 0); |
280 | 280 | |
281 | 281 | // Check for code integrity if not disabled |
282 | - if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
282 | + if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
283 | 283 | $this->emit('\OC\Updater', 'startCheckCodeIntegrity'); |
284 | 284 | $this->checker->runInstanceVerification(); |
285 | 285 | $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity'); |
@@ -320,12 +320,12 @@ discard block |
||
320 | 320 | * @link https://github.com/owncloud/core/issues/10980 |
321 | 321 | * @see \OC_App::updateApp |
322 | 322 | */ |
323 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) { |
|
323 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) { |
|
324 | 324 | $this->includePreUpdate($appId); |
325 | 325 | } |
326 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) { |
|
326 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) { |
|
327 | 327 | $this->emit('\OC\Updater', 'appSimulateUpdate', [$appId]); |
328 | - \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml'); |
|
328 | + \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml'); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @param string $appId |
339 | 339 | */ |
340 | 340 | private function includePreUpdate($appId) { |
341 | - include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; |
|
341 | + include \OC_App::getAppPath($appId).'/appinfo/preupdate.php'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | foreach ($apps as $appId) { |
357 | 357 | $priorityType = false; |
358 | 358 | foreach ($priorityTypes as $type) { |
359 | - if(!isset($stacks[$type])) { |
|
359 | + if (!isset($stacks[$type])) { |
|
360 | 360 | $stacks[$type] = []; |
361 | 361 | } |
362 | 362 | if (\OC_App::isType($appId, [$type])) { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | \OC_App::updateApp($appId); |
377 | 377 | $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]); |
378 | 378 | } |
379 | - if($type !== $pseudoOtherType) { |
|
379 | + if ($type !== $pseudoOtherType) { |
|
380 | 380 | // load authentication, filesystem and logging apps after |
381 | 381 | // upgrading them. Other apps my need to rely on modifying |
382 | 382 | // user and/or filesystem aspects. |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | foreach ($apps as $app) { |
405 | 405 | // check if the app is compatible with this version of ownCloud |
406 | 406 | $info = OC_App::getAppInfo($app); |
407 | - if($info === null || !OC_App::isAppCompatible($version, $info)) { |
|
407 | + if ($info === null || !OC_App::isAppCompatible($version, $info)) { |
|
408 | 408 | if ($appManager->isShipped($app)) { |
409 | - throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update'); |
|
409 | + throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update'); |
|
410 | 410 | } |
411 | 411 | \OC::$server->getAppManager()->disableApp($app, true); |
412 | 412 | $this->emit('\OC\Updater', 'incompatibleAppDisabled', [$app]); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @throws \Exception |
446 | 446 | */ |
447 | 447 | private function upgradeAppStoreApps(array $disabledApps, $reenable = false) { |
448 | - foreach($disabledApps as $app) { |
|
448 | + foreach ($disabledApps as $app) { |
|
449 | 449 | try { |
450 | 450 | $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); |
451 | 451 | if ($this->installer->isUpdateAvailable($app)) { |
@@ -469,22 +469,22 @@ discard block |
||
469 | 469 | */ |
470 | 470 | private function emitRepairEvents() { |
471 | 471 | $dispatcher = \OC::$server->getEventDispatcher(); |
472 | - $dispatcher->addListener('\OC\Repair::warning', function ($event) { |
|
472 | + $dispatcher->addListener('\OC\Repair::warning', function($event) { |
|
473 | 473 | if ($event instanceof GenericEvent) { |
474 | 474 | $this->emit('\OC\Updater', 'repairWarning', $event->getArguments()); |
475 | 475 | } |
476 | 476 | }); |
477 | - $dispatcher->addListener('\OC\Repair::error', function ($event) { |
|
477 | + $dispatcher->addListener('\OC\Repair::error', function($event) { |
|
478 | 478 | if ($event instanceof GenericEvent) { |
479 | 479 | $this->emit('\OC\Updater', 'repairError', $event->getArguments()); |
480 | 480 | } |
481 | 481 | }); |
482 | - $dispatcher->addListener('\OC\Repair::info', function ($event) { |
|
482 | + $dispatcher->addListener('\OC\Repair::info', function($event) { |
|
483 | 483 | if ($event instanceof GenericEvent) { |
484 | 484 | $this->emit('\OC\Updater', 'repairInfo', $event->getArguments()); |
485 | 485 | } |
486 | 486 | }); |
487 | - $dispatcher->addListener('\OC\Repair::step', function ($event) { |
|
487 | + $dispatcher->addListener('\OC\Repair::step', function($event) { |
|
488 | 488 | if ($event instanceof GenericEvent) { |
489 | 489 | $this->emit('\OC\Updater', 'repairStep', $event->getArguments()); |
490 | 490 | } |
@@ -499,13 +499,13 @@ discard block |
||
499 | 499 | if (!$event instanceof GenericEvent) { |
500 | 500 | return; |
501 | 501 | } |
502 | - $log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
502 | + $log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
503 | 503 | }); |
504 | 504 | $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) { |
505 | 505 | if (!$event instanceof GenericEvent) { |
506 | 506 | return; |
507 | 507 | } |
508 | - $log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
508 | + $log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
509 | 509 | }); |
510 | 510 | |
511 | 511 | $repairListener = function($event) use ($log) { |
@@ -514,30 +514,30 @@ discard block |
||
514 | 514 | } |
515 | 515 | switch ($event->getSubject()) { |
516 | 516 | case '\OC\Repair::startProgress': |
517 | - $log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
517 | + $log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
518 | 518 | break; |
519 | 519 | case '\OC\Repair::advance': |
520 | 520 | $desc = $event->getArgument(1); |
521 | 521 | if (empty($desc)) { |
522 | 522 | $desc = ''; |
523 | 523 | } |
524 | - $log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
524 | + $log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
525 | 525 | |
526 | 526 | break; |
527 | 527 | case '\OC\Repair::finishProgress': |
528 | 528 | $log->info('\OC\Repair::finishProgress', ['app' => 'updater']); |
529 | 529 | break; |
530 | 530 | case '\OC\Repair::step': |
531 | - $log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']); |
|
531 | + $log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']); |
|
532 | 532 | break; |
533 | 533 | case '\OC\Repair::info': |
534 | - $log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']); |
|
534 | + $log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']); |
|
535 | 535 | break; |
536 | 536 | case '\OC\Repair::warning': |
537 | - $log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']); |
|
537 | + $log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']); |
|
538 | 538 | break; |
539 | 539 | case '\OC\Repair::error': |
540 | - $log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']); |
|
540 | + $log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']); |
|
541 | 541 | break; |
542 | 542 | } |
543 | 543 | }; |
@@ -551,74 +551,74 @@ discard block |
||
551 | 551 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
552 | 552 | |
553 | 553 | |
554 | - $this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) { |
|
554 | + $this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) { |
|
555 | 555 | $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']); |
556 | 556 | }); |
557 | - $this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) { |
|
557 | + $this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) { |
|
558 | 558 | $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']); |
559 | 559 | }); |
560 | - $this->listen('\OC\Updater', 'maintenanceActive', function () use($log) { |
|
560 | + $this->listen('\OC\Updater', 'maintenanceActive', function() use($log) { |
|
561 | 561 | $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']); |
562 | 562 | }); |
563 | - $this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) { |
|
563 | + $this->listen('\OC\Updater', 'updateEnd', function($success) use($log) { |
|
564 | 564 | if ($success) { |
565 | 565 | $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']); |
566 | 566 | } else { |
567 | 567 | $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']); |
568 | 568 | } |
569 | 569 | }); |
570 | - $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) { |
|
570 | + $this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) { |
|
571 | 571 | $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']); |
572 | 572 | }); |
573 | - $this->listen('\OC\Updater', 'dbUpgrade', function () use($log) { |
|
573 | + $this->listen('\OC\Updater', 'dbUpgrade', function() use($log) { |
|
574 | 574 | $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']); |
575 | 575 | }); |
576 | - $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) { |
|
576 | + $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) { |
|
577 | 577 | $log->info('\OC\Updater::dbSimulateUpgradeBefore: Checking whether the database schema can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
578 | 578 | }); |
579 | - $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) { |
|
579 | + $this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) { |
|
580 | 580 | $log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']); |
581 | 581 | }); |
582 | - $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) { |
|
583 | - $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']); |
|
582 | + $this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) { |
|
583 | + $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']); |
|
584 | 584 | }); |
585 | - $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) { |
|
586 | - $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
585 | + $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) { |
|
586 | + $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
587 | 587 | }); |
588 | - $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) { |
|
589 | - $log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']); |
|
588 | + $this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) { |
|
589 | + $log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']); |
|
590 | 590 | }); |
591 | - $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) { |
|
592 | - $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
591 | + $this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) { |
|
592 | + $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
593 | 593 | }); |
594 | - $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) { |
|
594 | + $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) { |
|
595 | 595 | $log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']); |
596 | 596 | }); |
597 | - $this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) { |
|
598 | - $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <' . $app . '> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
|
597 | + $this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) { |
|
598 | + $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <'.$app.'> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
|
599 | 599 | }); |
600 | - $this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) { |
|
600 | + $this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) { |
|
601 | 601 | $log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']); |
602 | 602 | }); |
603 | - $this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) { |
|
604 | - $log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']); |
|
603 | + $this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) { |
|
604 | + $log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']); |
|
605 | 605 | }); |
606 | - $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) { |
|
607 | - $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']); |
|
606 | + $this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) { |
|
607 | + $log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']); |
|
608 | 608 | }); |
609 | - $this->listen('\OC\Updater', 'failure', function ($message) use($log) { |
|
610 | - $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']); |
|
609 | + $this->listen('\OC\Updater', 'failure', function($message) use($log) { |
|
610 | + $log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']); |
|
611 | 611 | }); |
612 | - $this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) { |
|
612 | + $this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) { |
|
613 | 613 | $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']); |
614 | 614 | }); |
615 | - $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) { |
|
616 | - $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']); |
|
615 | + $this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) { |
|
616 | + $log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']); |
|
617 | 617 | }); |
618 | - $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) { |
|
618 | + $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) { |
|
619 | 619 | $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']); |
620 | 620 | }); |
621 | - $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) { |
|
621 | + $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) { |
|
622 | 622 | $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']); |
623 | 623 | }); |
624 | 624 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (!$this->isValidPath($path)) { |
60 | 60 | throw new NotPermittedException('Invalid path'); |
61 | 61 | } |
62 | - return $this->path . $this->normalizePath($path); |
|
62 | + return $this->path.$this->normalizePath($path); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | if ($path === $this->path) { |
74 | 74 | return '/'; |
75 | - } else if (strpos($path, $this->path . '/') !== 0) { |
|
75 | + } else if (strpos($path, $this->path.'/') !== 0) { |
|
76 | 76 | return null; |
77 | 77 | } else { |
78 | 78 | $path = substr($path, strlen($this->path)); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return bool |
88 | 88 | */ |
89 | 89 | public function isSubNode($node) { |
90 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
90 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function getDirectoryListing() { |
100 | 100 | $folderContent = $this->view->getDirectoryContent($this->path); |
101 | 101 | |
102 | - return array_map(function (FileInfo $info) { |
|
102 | + return array_map(function(FileInfo $info) { |
|
103 | 103 | if ($info->getMimetype() === 'httpd/unix-directory') { |
104 | 104 | return new Folder($this->root, $this->view, $info->getPath(), $info); |
105 | 105 | } else { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $fullPath = $this->getFullPath($path); |
161 | 161 | $nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath); |
162 | 162 | $this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]); |
163 | - if(!$this->view->mkdir($fullPath)) { |
|
163 | + if (!$this->view->mkdir($fullPath)) { |
|
164 | 164 | throw new NotPermittedException('Could not create folder'); |
165 | 165 | } |
166 | 166 | $node = new Folder($this->root, $this->view, $fullPath); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function search($query) { |
207 | 207 | if (is_string($query)) { |
208 | - return $this->searchCommon('search', ['%' . $query . '%']); |
|
208 | + return $this->searchCommon('search', ['%'.$query.'%']); |
|
209 | 209 | } else { |
210 | 210 | return $this->searchCommon('searchQuery', [$query]); |
211 | 211 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @return \OC\Files\Node\Node[] |
239 | 239 | */ |
240 | 240 | private function searchCommon($method, $args) { |
241 | - $limitToHome = ($method === 'searchQuery')? $args[0]->limitToHome(): false; |
|
241 | + $limitToHome = ($method === 'searchQuery') ? $args[0]->limitToHome() : false; |
|
242 | 242 | if ($limitToHome && count(explode('/', $this->path)) !== 3) { |
243 | 243 | throw new \InvalidArgumentException('searching by owner is only allows on the users home folder'); |
244 | 244 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $internalPath = $mount->getInternalPath($this->path); |
251 | 251 | $internalPath = rtrim($internalPath, '/'); |
252 | 252 | if ($internalPath !== '') { |
253 | - $internalPath = $internalPath . '/'; |
|
253 | + $internalPath = $internalPath.'/'; |
|
254 | 254 | } |
255 | 255 | $internalRootLength = strlen($internalPath); |
256 | 256 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $result['internalPath'] = $result['path']; |
263 | 263 | $result['path'] = substr($result['path'], $internalRootLength); |
264 | 264 | $result['storage'] = $storage; |
265 | - $files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount); |
|
265 | + $files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount); |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
@@ -277,16 +277,16 @@ discard block |
||
277 | 277 | $results = call_user_func_array([$cache, $method], $args); |
278 | 278 | foreach ($results as $result) { |
279 | 279 | $result['internalPath'] = $result['path']; |
280 | - $result['path'] = $relativeMountPoint . $result['path']; |
|
280 | + $result['path'] = $relativeMountPoint.$result['path']; |
|
281 | 281 | $result['storage'] = $storage; |
282 | - $files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, |
|
282 | + $files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, |
|
283 | 283 | $result['internalPath'], $result, $mount); |
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | - return array_map(function (FileInfo $file) { |
|
289 | + return array_map(function(FileInfo $file) { |
|
290 | 290 | return $this->createNode($file->getPath(), $file); |
291 | 291 | }, $files); |
292 | 292 | } |
@@ -302,16 +302,16 @@ discard block |
||
302 | 302 | } else { |
303 | 303 | $user = null; |
304 | 304 | } |
305 | - $mountsContainingFile = $mountCache->getMountsForFileId((int)$id, $user); |
|
305 | + $mountsContainingFile = $mountCache->getMountsForFileId((int) $id, $user); |
|
306 | 306 | $mounts = $this->root->getMountsIn($this->path); |
307 | 307 | $mounts[] = $this->root->getMount($this->path); |
308 | 308 | /** @var IMountPoint[] $folderMounts */ |
309 | - $folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) { |
|
309 | + $folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) { |
|
310 | 310 | return $mountPoint->getMountPoint(); |
311 | 311 | }, $mounts), $mounts); |
312 | 312 | |
313 | 313 | /** @var ICachedMountInfo[] $mountsContainingFile */ |
314 | - $mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
314 | + $mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
315 | 315 | return isset($folderMounts[$cachedMountInfo->getMountPoint()]); |
316 | 316 | })); |
317 | 317 | |
@@ -322,18 +322,18 @@ discard block |
||
322 | 322 | return []; |
323 | 323 | } |
324 | 324 | |
325 | - $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) { |
|
325 | + $nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) { |
|
326 | 326 | $mount = $folderMounts[$cachedMountInfo->getMountPoint()]; |
327 | - $cacheEntry = $mount->getStorage()->getCache()->get((int)$id); |
|
327 | + $cacheEntry = $mount->getStorage()->getCache()->get((int) $id); |
|
328 | 328 | if (!$cacheEntry) { |
329 | 329 | return null; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // cache jails will hide the "true" internal path |
333 | - $internalPath = ltrim($cachedMountInfo->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/'); |
|
333 | + $internalPath = ltrim($cachedMountInfo->getRootInternalPath().'/'.$cacheEntry->getPath(), '/'); |
|
334 | 334 | $pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath())); |
335 | 335 | $pathRelativeToMount = ltrim($pathRelativeToMount, '/'); |
336 | - $absolutePath = rtrim($cachedMountInfo->getMountPoint() . $pathRelativeToMount, '/'); |
|
336 | + $absolutePath = rtrim($cachedMountInfo->getMountPoint().$pathRelativeToMount, '/'); |
|
337 | 337 | return $this->root->createNode($absolutePath, new \OC\Files\FileInfo( |
338 | 338 | $absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount, |
339 | 339 | \OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount)) |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | |
343 | 343 | $nodes = array_filter($nodes); |
344 | 344 | |
345 | - return array_filter($nodes, function (Node $node) { |
|
345 | + return array_filter($nodes, function(Node $node) { |
|
346 | 346 | return $this->getRelativePath($node->getPath()); |
347 | 347 | }); |
348 | 348 | } |
349 | 349 | |
350 | 350 | protected function getAppDataDirectoryName(): string { |
351 | 351 | $instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid'); |
352 | - return 'appdata_' . $instanceId; |
|
352 | + return 'appdata_'.$instanceId; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | return []; |
372 | 372 | } |
373 | 373 | |
374 | - $absolutePath = '/' . ltrim($cacheEntry->getPath(), '/'); |
|
375 | - $currentPath = rtrim($this->path, '/') . '/'; |
|
374 | + $absolutePath = '/'.ltrim($cacheEntry->getPath(), '/'); |
|
375 | + $currentPath = rtrim($this->path, '/').'/'; |
|
376 | 376 | |
377 | 377 | if (strpos($absolutePath, $currentPath) !== 0) { |
378 | 378 | return []; |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | $mounts = $this->root->getMountsIn($this->path); |
428 | 428 | $mounts[] = $this->getMountPoint(); |
429 | 429 | |
430 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
430 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
431 | 431 | return $mount->getStorage(); |
432 | 432 | }); |
433 | - $storageIds = array_map(function (IMountPoint $mount) { |
|
433 | + $storageIds = array_map(function(IMountPoint $mount) { |
|
434 | 434 | return $mount->getStorage()->getCache()->getNumericStorageId(); |
435 | 435 | }, $mounts); |
436 | 436 | /** @var IMountPoint[] $mountMap */ |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | } |
486 | 486 | |
487 | 487 | private function recentParse($result, $mountMap, $mimetypeLoader) { |
488 | - $files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) { |
|
488 | + $files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) { |
|
489 | 489 | $mount = $mountMap[$entry['storage']]; |
490 | 490 | $entry['internalPath'] = $entry['path']; |
491 | 491 | $entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | return $this->root->createNode($fileInfo->getPath(), $fileInfo); |
499 | 499 | }, $result)); |
500 | 500 | |
501 | - return array_values(array_filter($files, function (Node $node) { |
|
501 | + return array_values(array_filter($files, function(Node $node) { |
|
502 | 502 | $cacheEntry = $node->getMountPoint()->getStorage()->getCache()->get($node->getId()); |
503 | 503 | if (!$cacheEntry) { |
504 | 504 | return false; |
@@ -520,13 +520,13 @@ discard block |
||
520 | 520 | $rootLength = strlen($jailRoot) + 1; |
521 | 521 | if ($path === $jailRoot) { |
522 | 522 | return $mount->getMountPoint(); |
523 | - } else if (substr($path, 0, $rootLength) === $jailRoot . '/') { |
|
524 | - return $mount->getMountPoint() . substr($path, $rootLength); |
|
523 | + } else if (substr($path, 0, $rootLength) === $jailRoot.'/') { |
|
524 | + return $mount->getMountPoint().substr($path, $rootLength); |
|
525 | 525 | } else { |
526 | 526 | return null; |
527 | 527 | } |
528 | 528 | } else { |
529 | - return $mount->getMountPoint() . $path; |
|
529 | + return $mount->getMountPoint().$path; |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -411,17 +411,17 @@ discard block |
||
411 | 411 | $userObject = $userManager->get($user); |
412 | 412 | |
413 | 413 | if (is_null($userObject)) { |
414 | - \OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, ILogger::ERROR); |
|
414 | + \OCP\Util::writeLog('files', ' Backends provided no user object for '.$user, ILogger::ERROR); |
|
415 | 415 | // reset flag, this will make it possible to rethrow the exception if called again |
416 | 416 | unset(self::$usersSetup[$user]); |
417 | - throw new \OC\User\NoUserException('Backends provided no user object for ' . $user); |
|
417 | + throw new \OC\User\NoUserException('Backends provided no user object for '.$user); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | $realUid = $userObject->getUID(); |
421 | 421 | // workaround in case of different casings |
422 | 422 | if ($user !== $realUid) { |
423 | 423 | $stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50)); |
424 | - \OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $realUid . '" got "' . $user . '". Stack: ' . $stack, ILogger::WARN); |
|
424 | + \OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "'.$realUid.'" got "'.$user.'". Stack: '.$stack, ILogger::WARN); |
|
425 | 425 | $user = $realUid; |
426 | 426 | |
427 | 427 | // again with the correct casing |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | } else { |
455 | 455 | self::getMountManager()->addMount(new MountPoint( |
456 | 456 | new NullStorage([]), |
457 | - '/' . $user |
|
457 | + '/'.$user |
|
458 | 458 | )); |
459 | 459 | self::getMountManager()->addMount(new MountPoint( |
460 | 460 | new NullStorage([]), |
461 | - '/' . $user . '/files' |
|
461 | + '/'.$user.'/files' |
|
462 | 462 | )); |
463 | 463 | } |
464 | 464 | \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user]); |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | private static function listenForNewMountProviders(MountProviderCollection $mountConfigManager, IUserManager $userManager) { |
474 | 474 | if (!self::$listeningForProviders) { |
475 | 475 | self::$listeningForProviders = true; |
476 | - $mountConfigManager->listen('\OC\Files\Config', 'registerMountProvider', function (IMountProvider $provider) use ($userManager) { |
|
476 | + $mountConfigManager->listen('\OC\Files\Config', 'registerMountProvider', function(IMountProvider $provider) use ($userManager) { |
|
477 | 477 | foreach (Filesystem::$usersSetup as $user => $setup) { |
478 | 478 | $userObject = $userManager->get($user); |
479 | 479 | if ($userObject) { |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * @return string |
569 | 569 | */ |
570 | 570 | static public function getLocalPath($path) { |
571 | - $datadir = \OC_User::getHome(\OC_User::getUser()) . '/files'; |
|
571 | + $datadir = \OC_User::getHome(\OC_User::getUser()).'/files'; |
|
572 | 572 | $newpath = $path; |
573 | 573 | if (strncmp($newpath, $datadir, strlen($datadir)) == 0) { |
574 | 574 | $newpath = substr($path, strlen($datadir)); |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | static public function isValidPath($path) { |
586 | 586 | $path = self::normalizePath($path); |
587 | 587 | if (!$path || $path[0] !== '/') { |
588 | - $path = '/' . $path; |
|
588 | + $path = '/'.$path; |
|
589 | 589 | } |
590 | 590 | if (strpos($path, '/../') !== false || strrchr($path, '/') === '/..') { |
591 | 591 | return false; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * conversion should get removed as soon as all existing |
807 | 807 | * function calls have been fixed. |
808 | 808 | */ |
809 | - $path = (string)$path; |
|
809 | + $path = (string) $path; |
|
810 | 810 | |
811 | 811 | $cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]); |
812 | 812 | |
@@ -824,13 +824,13 @@ discard block |
||
824 | 824 | } |
825 | 825 | |
826 | 826 | //add leading slash, if it is already there we strip it anyway |
827 | - $path = '/' . $path; |
|
827 | + $path = '/'.$path; |
|
828 | 828 | |
829 | 829 | $patterns = [ |
830 | - '/\\\\/s', // no windows style slashes |
|
830 | + '/\\\\/s', // no windows style slashes |
|
831 | 831 | '/\/\.(\/\.)?\//s', // remove '/./' |
832 | - '/\/{2,}/s', // remove squence of slashes |
|
833 | - '/\/\.$/s', // remove trailing /. |
|
832 | + '/\/{2,}/s', // remove squence of slashes |
|
833 | + '/\/\.$/s', // remove trailing /. |
|
834 | 834 | ]; |
835 | 835 | |
836 | 836 | do { |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function attachListener($mount) { |
132 | 132 | $scanner = $mount->getStorage()->getScanner(); |
133 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount) { |
|
134 | - $this->emit('\OC\Files\Utils\Scanner', 'scanFile', [$mount->getMountPoint() . $path]); |
|
135 | - $this->dispatcher->dispatchTyped(new BeforeFileScannedEvent($mount->getMountPoint() . $path)); |
|
133 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function($path) use ($mount) { |
|
134 | + $this->emit('\OC\Files\Utils\Scanner', 'scanFile', [$mount->getMountPoint().$path]); |
|
135 | + $this->dispatcher->dispatchTyped(new BeforeFileScannedEvent($mount->getMountPoint().$path)); |
|
136 | 136 | }); |
137 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount) { |
|
138 | - $this->emit('\OC\Files\Utils\Scanner', 'scanFolder', [$mount->getMountPoint() . $path]); |
|
139 | - $this->dispatcher->dispatchTyped(new BeforeFolderScannedEvent($mount->getMountPoint() . $path)); |
|
137 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function($path) use ($mount) { |
|
138 | + $this->emit('\OC\Files\Utils\Scanner', 'scanFolder', [$mount->getMountPoint().$path]); |
|
139 | + $this->dispatcher->dispatchTyped(new BeforeFolderScannedEvent($mount->getMountPoint().$path)); |
|
140 | 140 | }); |
141 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount) { |
|
142 | - $this->emit('\OC\Files\Utils\Scanner', 'postScanFile', [$mount->getMountPoint() . $path]); |
|
143 | - $this->dispatcher->dispatchTyped(new FileScannedEvent($mount->getMountPoint() . $path)); |
|
141 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function($path) use ($mount) { |
|
142 | + $this->emit('\OC\Files\Utils\Scanner', 'postScanFile', [$mount->getMountPoint().$path]); |
|
143 | + $this->dispatcher->dispatchTyped(new FileScannedEvent($mount->getMountPoint().$path)); |
|
144 | 144 | }); |
145 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount) { |
|
146 | - $this->emit('\OC\Files\Utils\Scanner', 'postScanFolder', [$mount->getMountPoint() . $path]); |
|
147 | - $this->dispatcher->dispatchTyped(new FolderScannedEvent($mount->getMountPoint() . $path)); |
|
145 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function($path) use ($mount) { |
|
146 | + $this->emit('\OC\Files\Utils\Scanner', 'postScanFolder', [$mount->getMountPoint().$path]); |
|
147 | + $this->dispatcher->dispatchTyped(new FolderScannedEvent($mount->getMountPoint().$path)); |
|
148 | 148 | }); |
149 | 149 | } |
150 | 150 | |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | $scanner = $storage->getScanner(); |
172 | 172 | $this->attachListener($mount); |
173 | 173 | |
174 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
174 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
175 | 175 | $this->triggerPropagator($storage, $path); |
176 | 176 | }); |
177 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
177 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
178 | 178 | $this->triggerPropagator($storage, $path); |
179 | 179 | }); |
180 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
180 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
181 | 181 | $this->triggerPropagator($storage, $path); |
182 | 182 | }); |
183 | 183 | |
@@ -235,15 +235,15 @@ discard block |
||
235 | 235 | $scanner->setUseTransactions(false); |
236 | 236 | $this->attachListener($mount); |
237 | 237 | |
238 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
238 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
239 | 239 | $this->postProcessEntry($storage, $path); |
240 | 240 | $this->dispatcher->dispatchTyped(new NodeRemovedFromCache($storage, $path)); |
241 | 241 | }); |
242 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
242 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
243 | 243 | $this->postProcessEntry($storage, $path); |
244 | 244 | $this->dispatcher->dispatchTyped(new FileCacheUpdated($storage, $path)); |
245 | 245 | }); |
246 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
246 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
247 | 247 | $this->postProcessEntry($storage, $path); |
248 | 248 | $this->dispatcher->dispatchTyped(new NodeAddedToCache($storage, $path)); |
249 | 249 | }); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | $propagator->commitBatch(); |
268 | 268 | } catch (StorageNotAvailableException $e) { |
269 | - $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
269 | + $this->logger->error('Storage '.$storage->getId().' not available'); |
|
270 | 270 | $this->logger->logException($e); |
271 | 271 | $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
272 | 272 | } |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | $path = '/'; |
129 | 129 | } |
130 | 130 | if ($path[0] !== '/') { |
131 | - $path = '/' . $path; |
|
131 | + $path = '/'.$path; |
|
132 | 132 | } |
133 | - return $this->fakeRoot . $path; |
|
133 | + return $this->fakeRoot.$path; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function chroot($fakeRoot) { |
143 | 143 | if (!$fakeRoot == '') { |
144 | 144 | if ($fakeRoot[0] !== '/') { |
145 | - $fakeRoot = '/' . $fakeRoot; |
|
145 | + $fakeRoot = '/'.$fakeRoot; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | $this->fakeRoot = $fakeRoot; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | // missing slashes can cause wrong matches! |
177 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
177 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
178 | 178 | |
179 | 179 | if (strpos($path, $root) !== 0) { |
180 | 180 | return null; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if ($mount instanceof MoveableMount) { |
281 | 281 | // cut of /user/files to get the relative path to data/user/files |
282 | 282 | $pathParts = explode('/', $path, 4); |
283 | - $relPath = '/' . $pathParts[3]; |
|
283 | + $relPath = '/'.$pathParts[3]; |
|
284 | 284 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
285 | 285 | \OC_Hook::emit( |
286 | 286 | Filesystem::CLASSNAME, "umount", |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | } |
707 | 707 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
708 | 708 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
709 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
709 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
710 | 710 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
711 | 711 | return $this->removeMount($mount, $absolutePath); |
712 | 712 | } |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
829 | 829 | } |
830 | 830 | } |
831 | - } catch(\Exception $e) { |
|
831 | + } catch (\Exception $e) { |
|
832 | 832 | throw $e; |
833 | 833 | } finally { |
834 | 834 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | } |
853 | 853 | } |
854 | 854 | } |
855 | - } catch(\Exception $e) { |
|
855 | + } catch (\Exception $e) { |
|
856 | 856 | throw $e; |
857 | 857 | } finally { |
858 | 858 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $hooks[] = 'write'; |
987 | 987 | break; |
988 | 988 | default: |
989 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
989 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | [Filesystem::signal_param_path => $this->getHookPath($path)] |
1091 | 1091 | ); |
1092 | 1092 | } |
1093 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1093 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1094 | 1094 | if ($storage) { |
1095 | 1095 | return $storage->hash($type, $internalPath, $raw); |
1096 | 1096 | } |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | $run = $this->runHooks($hooks, $path); |
1146 | 1146 | /** @var \OC\Files\Storage\Storage $storage */ |
1147 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1147 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1148 | 1148 | if ($run and $storage) { |
1149 | 1149 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
1150 | 1150 | try { |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | if ($result && in_array('delete', $hooks) and $result) { |
1174 | 1174 | $this->removeUpdate($storage, $internalPath); |
1175 | 1175 | } |
1176 | - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
1176 | + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
1177 | 1177 | $this->writeUpdate($storage, $internalPath); |
1178 | 1178 | } |
1179 | 1179 | if ($result && in_array('touch', $hooks)) { |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | $unlockLater = true; |
1190 | 1190 | // make sure our unlocking callback will still be called if connection is aborted |
1191 | 1191 | ignore_user_abort(true); |
1192 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1192 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1193 | 1193 | if (in_array('write', $hooks)) { |
1194 | 1194 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1195 | 1195 | } else if (in_array('read', $hooks)) { |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | return true; |
1251 | 1251 | } |
1252 | 1252 | |
1253 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1253 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | /** |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | if ($hook != 'read') { |
1270 | 1270 | \OC_Hook::emit( |
1271 | 1271 | Filesystem::CLASSNAME, |
1272 | - $prefix . $hook, |
|
1272 | + $prefix.$hook, |
|
1273 | 1273 | [ |
1274 | 1274 | Filesystem::signal_param_run => &$run, |
1275 | 1275 | Filesystem::signal_param_path => $path |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | } elseif (!$post) { |
1279 | 1279 | \OC_Hook::emit( |
1280 | 1280 | Filesystem::CLASSNAME, |
1281 | - $prefix . $hook, |
|
1281 | + $prefix.$hook, |
|
1282 | 1282 | [ |
1283 | 1283 | Filesystem::signal_param_path => $path |
1284 | 1284 | ] |
@@ -1371,11 +1371,11 @@ discard block |
||
1371 | 1371 | return $this->getPartFileInfo($path); |
1372 | 1372 | } |
1373 | 1373 | $relativePath = $path; |
1374 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1374 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1375 | 1375 | |
1376 | 1376 | $mount = Filesystem::getMountManager()->find($path); |
1377 | 1377 | if (!$mount) { |
1378 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
1378 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
1379 | 1379 | return false; |
1380 | 1380 | } |
1381 | 1381 | $storage = $mount->getStorage(); |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | //add the sizes of other mount points to the folder |
1404 | 1404 | $extOnly = ($includeMountPoints === 'ext'); |
1405 | 1405 | $mounts = Filesystem::getMountManager()->findIn($path); |
1406 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
1406 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
1407 | 1407 | $subStorage = $mount->getStorage(); |
1408 | 1408 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
1409 | 1409 | })); |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | |
1413 | 1413 | return $info; |
1414 | 1414 | } else { |
1415 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
1415 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | return false; |
@@ -1459,12 +1459,12 @@ discard block |
||
1459 | 1459 | /** |
1460 | 1460 | * @var \OC\Files\FileInfo[] $fileInfos |
1461 | 1461 | */ |
1462 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1462 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1463 | 1463 | if ($sharingDisabled) { |
1464 | 1464 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1465 | 1465 | } |
1466 | 1466 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
1467 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1467 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1468 | 1468 | }, $contents); |
1469 | 1469 | $files = array_combine($fileNames, $fileInfos); |
1470 | 1470 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | } catch (\Exception $e) { |
1490 | 1490 | // sometimes when the storage is not available it can be any exception |
1491 | 1491 | \OC::$server->getLogger()->logException($e, [ |
1492 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
1492 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
1493 | 1493 | 'level' => ILogger::ERROR, |
1494 | 1494 | 'app' => 'lib', |
1495 | 1495 | ]); |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
1521 | 1521 | } |
1522 | 1522 | |
1523 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1523 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1524 | 1524 | |
1525 | 1525 | // if sharing was disabled for the user we remove the share permissions |
1526 | 1526 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1528,14 +1528,14 @@ discard block |
||
1528 | 1528 | } |
1529 | 1529 | |
1530 | 1530 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
1531 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1531 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | } |
1535 | 1535 | } |
1536 | 1536 | |
1537 | 1537 | if ($mimetype_filter) { |
1538 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1538 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1539 | 1539 | if (strpos($mimetype_filter, '/')) { |
1540 | 1540 | return $file->getMimetype() === $mimetype_filter; |
1541 | 1541 | } else { |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | if ($data instanceof FileInfo) { |
1565 | 1565 | $data = $data->getData(); |
1566 | 1566 | } |
1567 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1567 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1568 | 1568 | /** |
1569 | 1569 | * @var \OC\Files\Storage\Storage $storage |
1570 | 1570 | * @var string $internalPath |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | * @return FileInfo[] |
1592 | 1592 | */ |
1593 | 1593 | public function search($query) { |
1594 | - return $this->searchCommon('search', ['%' . $query . '%']); |
|
1594 | + return $this->searchCommon('search', ['%'.$query.'%']); |
|
1595 | 1595 | } |
1596 | 1596 | |
1597 | 1597 | /** |
@@ -1642,10 +1642,10 @@ discard block |
||
1642 | 1642 | |
1643 | 1643 | $results = call_user_func_array([$cache, $method], $args); |
1644 | 1644 | foreach ($results as $result) { |
1645 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1645 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1646 | 1646 | $internalPath = $result['path']; |
1647 | - $path = $mountPoint . $result['path']; |
|
1648 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1647 | + $path = $mountPoint.$result['path']; |
|
1648 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1649 | 1649 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1650 | 1650 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1651 | 1651 | } |
@@ -1663,8 +1663,8 @@ discard block |
||
1663 | 1663 | if ($results) { |
1664 | 1664 | foreach ($results as $result) { |
1665 | 1665 | $internalPath = $result['path']; |
1666 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1667 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1666 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1667 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1668 | 1668 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1669 | 1669 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1670 | 1670 | } |
@@ -1685,11 +1685,11 @@ discard block |
||
1685 | 1685 | public function getOwner($path) { |
1686 | 1686 | $info = $this->getFileInfo($path); |
1687 | 1687 | if (!$info) { |
1688 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1688 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1689 | 1689 | } |
1690 | 1690 | |
1691 | 1691 | if ($info->getOwner() === null) { |
1692 | - throw new NotFoundException($path . ' has no owner'); |
|
1692 | + throw new NotFoundException($path.' has no owner'); |
|
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | return $info->getOwner()->getUID(); |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | * @return string |
1725 | 1725 | */ |
1726 | 1726 | public function getPath($id) { |
1727 | - $id = (int)$id; |
|
1727 | + $id = (int) $id; |
|
1728 | 1728 | $manager = Filesystem::getMountManager(); |
1729 | 1729 | $mounts = $manager->findIn($this->fakeRoot); |
1730 | 1730 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1746,7 +1746,7 @@ discard block |
||
1746 | 1746 | $cache = $mount->getStorage()->getCache(); |
1747 | 1747 | $internalPath = $cache->getPathById($id); |
1748 | 1748 | if (is_string($internalPath)) { |
1749 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
1749 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
1750 | 1750 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
1751 | 1751 | return $path; |
1752 | 1752 | } |
@@ -1782,10 +1782,10 @@ discard block |
||
1782 | 1782 | private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { |
1783 | 1783 | |
1784 | 1784 | // note: cannot use the view because the target is already locked |
1785 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
1785 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
1786 | 1786 | if ($fileId === -1) { |
1787 | 1787 | // target might not exist, need to check parent instead |
1788 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1788 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | $resultPath = ''; |
1886 | 1886 | foreach ($parts as $part) { |
1887 | 1887 | if ($part) { |
1888 | - $resultPath .= '/' . $part; |
|
1888 | + $resultPath .= '/'.$part; |
|
1889 | 1889 | $result[] = $resultPath; |
1890 | 1890 | } |
1891 | 1891 | } |
@@ -2154,16 +2154,16 @@ discard block |
||
2154 | 2154 | public function getUidAndFilename($filename) { |
2155 | 2155 | $info = $this->getFileInfo($filename); |
2156 | 2156 | if (!$info instanceof \OCP\Files\FileInfo) { |
2157 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2157 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2158 | 2158 | } |
2159 | 2159 | $uid = $info->getOwner()->getUID(); |
2160 | 2160 | if ($uid != \OCP\User::getUser()) { |
2161 | 2161 | Filesystem::initMountPoints($uid); |
2162 | - $ownerView = new View('/' . $uid . '/files'); |
|
2162 | + $ownerView = new View('/'.$uid.'/files'); |
|
2163 | 2163 | try { |
2164 | 2164 | $filename = $ownerView->getPath($info['fileid']); |
2165 | 2165 | } catch (NotFoundException $e) { |
2166 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2166 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2167 | 2167 | } |
2168 | 2168 | } |
2169 | 2169 | return [$uid, $filename]; |
@@ -2180,7 +2180,7 @@ discard block |
||
2180 | 2180 | $directoryParts = array_filter($directoryParts); |
2181 | 2181 | foreach ($directoryParts as $key => $part) { |
2182 | 2182 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2183 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2183 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2184 | 2184 | if ($this->is_file($currentPath)) { |
2185 | 2185 | return false; |
2186 | 2186 | } |
@@ -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 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * local storage backend in temporary folder for testing purpose |
30 | 30 | */ |
31 | -class Temporary extends Local{ |
|
31 | +class Temporary extends Local { |
|
32 | 32 | public function __construct($arguments = null) { |
33 | 33 | parent::__construct(['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]); |
34 | 34 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $this->mkdir($path2); |
225 | 225 | while ($file = readdir($dir)) { |
226 | 226 | if (!Filesystem::isIgnoredDir($file)) { |
227 | - if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file)) { |
|
227 | + if (!$this->copy($path1.'/'.$file, $path2.'/'.$file)) { |
|
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | } |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | if (is_resource($dh)) { |
279 | 279 | while (($file = readdir($dh)) !== false) { |
280 | 280 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
281 | - if ($this->is_dir($path . '/' . $file)) { |
|
282 | - mkdir($target . '/' . $file); |
|
283 | - $this->addLocalFolder($path . '/' . $file, $target . '/' . $file); |
|
281 | + if ($this->is_dir($path.'/'.$file)) { |
|
282 | + mkdir($target.'/'.$file); |
|
283 | + $this->addLocalFolder($path.'/'.$file, $target.'/'.$file); |
|
284 | 284 | } else { |
285 | - $tmp = $this->toTmpFile($path . '/' . $file); |
|
286 | - rename($tmp, $target . '/' . $file); |
|
285 | + $tmp = $this->toTmpFile($path.'/'.$file); |
|
286 | + rename($tmp, $target.'/'.$file); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | while (($item = readdir($dh)) !== false) { |
303 | 303 | if (\OC\Files\Filesystem::isIgnoredDir($item)) continue; |
304 | 304 | if (strstr(strtolower($item), strtolower($query)) !== false) { |
305 | - $files[] = $dir . '/' . $item; |
|
305 | + $files[] = $dir.'/'.$item; |
|
306 | 306 | } |
307 | - if ($this->is_dir($dir . '/' . $item)) { |
|
308 | - $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item)); |
|
307 | + if ($this->is_dir($dir.'/'.$item)) { |
|
308 | + $files = array_merge($files, $this->searchInDir($query, $dir.'/'.$item)); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | if (!isset($this->watcher)) { |
357 | 357 | $this->watcher = new Watcher($storage); |
358 | 358 | $globalPolicy = \OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_NEVER); |
359 | - $this->watcher->setPolicy((int)$this->getMountOption('filesystem_check_changes', $globalPolicy)); |
|
359 | + $this->watcher->setPolicy((int) $this->getMountOption('filesystem_check_changes', $globalPolicy)); |
|
360 | 360 | } |
361 | 361 | return $this->watcher; |
362 | 362 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | if (!isset($storage->propagator)) { |
375 | 375 | $config = \OC::$server->getSystemConfig(); |
376 | - $storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection(), ['appdata_' . $config->getValue('instanceid')]); |
|
376 | + $storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection(), ['appdata_'.$config->getValue('instanceid')]); |
|
377 | 377 | } |
378 | 378 | return $storage->propagator; |
379 | 379 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | */ |
432 | 432 | public function cleanPath($path) { |
433 | 433 | if (strlen($path) == 0 or $path[0] != '/') { |
434 | - $path = '/' . $path; |
|
434 | + $path = '/'.$path; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | $output = []; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | \OC::$server->getLogger()->info("External storage not available: stat() failed"); |
460 | 460 | return false; |
461 | 461 | } catch (\Exception $e) { |
462 | - \OC::$server->getLogger()->info("External storage not available: " . $e->getMessage()); |
|
462 | + \OC::$server->getLogger()->info("External storage not available: ".$e->getMessage()); |
|
463 | 463 | \OC::$server->getLogger()->logException($e, ['level' => ILogger::DEBUG]); |
464 | 464 | return false; |
465 | 465 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | if (is_resource($dh)) { |
613 | 613 | while ($result and ($file = readdir($dh)) !== false) { |
614 | 614 | if (!Filesystem::isIgnoredDir($file)) { |
615 | - $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file); |
|
615 | + $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file); |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $this->getCache()->remove($targetInternalPath); |
639 | 639 | } |
640 | 640 | } |
641 | - return (bool)$result; |
|
641 | + return (bool) $result; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | ); |
745 | 745 | } |
746 | 746 | try { |
747 | - $provider->acquireLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
747 | + $provider->acquireLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
748 | 748 | } catch (LockedException $e) { |
749 | 749 | if ($logger) { |
750 | 750 | $logger->logException($e, ['level' => ILogger::INFO]); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | ); |
777 | 777 | } |
778 | 778 | try { |
779 | - $provider->releaseLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
779 | + $provider->releaseLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
780 | 780 | } catch (LockedException $e) { |
781 | 781 | if ($logger) { |
782 | 782 | $logger->logException($e, ['level' => ILogger::INFO]); |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | ); |
809 | 809 | } |
810 | 810 | try { |
811 | - $provider->changeLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
811 | + $provider->changeLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
812 | 812 | } catch (LockedException $e) { |
813 | 813 | \OC::$server->getLogger()->logException($e, ['level' => ILogger::INFO]); |
814 | 814 | throw $e; |