@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | return true; |
40 | 40 | } |
41 | 41 | foreach ($this->namespacePrefixes as $prefix) { |
42 | - if (str_starts_with($fullyQualifiedObjectType->getClassName(), $prefix . '\\')) { |
|
42 | + if (str_starts_with($fullyQualifiedObjectType->getClassName(), $prefix.'\\')) { |
|
43 | 43 | // Import Nextcloud namespaces |
44 | 44 | return false; |
45 | 45 | } |
@@ -51,28 +51,28 @@ discard block |
||
51 | 51 | |
52 | 52 | $config = RectorConfig::configure() |
53 | 53 | ->withPaths([ |
54 | - $nextcloudDir . '/apps', |
|
55 | - $nextcloudDir . '/core', |
|
56 | - $nextcloudDir . '/ocs', |
|
57 | - $nextcloudDir . '/ocs-provider', |
|
58 | - $nextcloudDir . '/console.php', |
|
59 | - $nextcloudDir . '/cron.php', |
|
60 | - $nextcloudDir . '/index.php', |
|
61 | - $nextcloudDir . '/occ', |
|
62 | - $nextcloudDir . '/public.php', |
|
63 | - $nextcloudDir . '/remote.php', |
|
64 | - $nextcloudDir . '/status.php', |
|
65 | - $nextcloudDir . '/version.php', |
|
54 | + $nextcloudDir.'/apps', |
|
55 | + $nextcloudDir.'/core', |
|
56 | + $nextcloudDir.'/ocs', |
|
57 | + $nextcloudDir.'/ocs-provider', |
|
58 | + $nextcloudDir.'/console.php', |
|
59 | + $nextcloudDir.'/cron.php', |
|
60 | + $nextcloudDir.'/index.php', |
|
61 | + $nextcloudDir.'/occ', |
|
62 | + $nextcloudDir.'/public.php', |
|
63 | + $nextcloudDir.'/remote.php', |
|
64 | + $nextcloudDir.'/status.php', |
|
65 | + $nextcloudDir.'/version.php', |
|
66 | 66 | // $nextcloudDir . '/config', |
67 | 67 | // $nextcloudDir . '/lib', |
68 | 68 | // $nextcloudDir . '/tests', |
69 | 69 | // $nextcloudDir . '/themes', |
70 | 70 | ]) |
71 | 71 | ->withSkip([ |
72 | - $nextcloudDir . '/apps/*/3rdparty/*', |
|
73 | - $nextcloudDir . '/apps/*/build/stubs/*', |
|
74 | - $nextcloudDir . '/apps/*/composer/*', |
|
75 | - $nextcloudDir . '/apps/*/config/*', |
|
72 | + $nextcloudDir.'/apps/*/3rdparty/*', |
|
73 | + $nextcloudDir.'/apps/*/build/stubs/*', |
|
74 | + $nextcloudDir.'/apps/*/composer/*', |
|
75 | + $nextcloudDir.'/apps/*/config/*', |
|
76 | 76 | ]) |
77 | 77 | // uncomment to reach your current PHP version |
78 | 78 | // ->withPhpSets() |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $config->registerService(NextcloudNamespaceSkipVoter::class, tag:ClassNameImportSkipVoterInterface::class); |
90 | 90 | |
91 | 91 | /* Ignore all files ignored by git */ |
92 | -$ignoredEntries = shell_exec('git status --porcelain --ignored ' . escapeshellarg($nextcloudDir)); |
|
92 | +$ignoredEntries = shell_exec('git status --porcelain --ignored '.escapeshellarg($nextcloudDir)); |
|
93 | 93 | $ignoredEntries = explode("\n", $ignoredEntries); |
94 | 94 | $ignoredEntries = array_filter($ignoredEntries, static fn (string $line) => str_starts_with($line, '!! ')); |
95 | 95 | $ignoredEntries = array_map(static fn (string $line) => substr($line, 3), $ignoredEntries); |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | foreach ($ignoredEntries as $ignoredEntry) { |
99 | 99 | if (str_ends_with($ignoredEntry, '/')) { |
100 | - $config->withSkip([$ignoredEntry . '*']); |
|
100 | + $config->withSkip([$ignoredEntry.'*']); |
|
101 | 101 | } else { |
102 | - $config->withSkip([$ignoredEntry . '/*']); |
|
102 | + $config->withSkip([$ignoredEntry.'/*']); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |
10 | 10 | * SPDX-License-Identifier: AGPL-3.0-only |
11 | 11 | */ |
12 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
12 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
13 | 13 | |
14 | 14 | use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; |
15 | 15 | use OCP\App\IAppManager; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | class RemoteException extends \Exception { |
28 | 28 | } |
29 | 29 | |
30 | -function handleException(Exception|Error $e): void { |
|
30 | +function handleException(Exception | Error $e): void { |
|
31 | 31 | try { |
32 | 32 | $request = \OCP\Server::get(IRequest::class); |
33 | 33 | // in case the request content type is text/xml - we assume it's a WebDAV request |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // we shall not log on RemoteException |
40 | 40 | $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OCP\Server::get(LoggerInterface::class))); |
41 | 41 | } |
42 | - $server->on('beforeMethod:*', function () use ($e): void { |
|
42 | + $server->on('beforeMethod:*', function() use ($e): void { |
|
43 | 43 | if ($e instanceof RemoteException) { |
44 | 44 | switch ($e->getCode()) { |
45 | 45 | case 503: |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // we shall not log on RemoteException |
63 | 63 | \OCP\Server::get(ITemplateManager::class)->printErrorPage($e->getMessage(), '', $e->getCode()); |
64 | 64 | } else { |
65 | - \OCP\Server::get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'remote','exception' => $e]); |
|
65 | + \OCP\Server::get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'remote', 'exception' => $e]); |
|
66 | 66 | \OCP\Server::get(ITemplateManager::class)->printExceptionErrorPage($e, $statusCode); |
67 | 67 | } |
68 | 68 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | return $services[$service]; |
91 | 91 | } |
92 | 92 | |
93 | - return \OCP\Server::get(IConfig::class)->getAppValue('core', 'remote_' . $service); |
|
93 | + return \OCP\Server::get(IConfig::class)->getAppValue('core', 'remote_'.$service); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | try { |
97 | - require_once __DIR__ . '/lib/base.php'; |
|
97 | + require_once __DIR__.'/lib/base.php'; |
|
98 | 98 | |
99 | 99 | // All resources served via the DAV endpoint should have the strictest possible |
100 | 100 | // policy. Exempted from this is the SabreDAV browser plugin which overwrites |
@@ -137,17 +137,17 @@ discard block |
||
137 | 137 | |
138 | 138 | switch ($app) { |
139 | 139 | case 'core': |
140 | - $file = OC::$SERVERROOT . '/' . $file; |
|
140 | + $file = OC::$SERVERROOT.'/'.$file; |
|
141 | 141 | break; |
142 | 142 | default: |
143 | 143 | if (!$appManager->isEnabledForUser($app)) { |
144 | - throw new RemoteException('App not installed: ' . $app); |
|
144 | + throw new RemoteException('App not installed: '.$app); |
|
145 | 145 | } |
146 | 146 | $appManager->loadApp($app); |
147 | - $file = $appManager->getAppPath($app) . '/' . ($parts[1] ?? ''); |
|
147 | + $file = $appManager->getAppPath($app).'/'.($parts[1] ?? ''); |
|
148 | 148 | break; |
149 | 149 | } |
150 | - $baseuri = OC::$WEBROOT . '/remote.php/' . $service . '/'; |
|
150 | + $baseuri = OC::$WEBROOT.'/remote.php/'.$service.'/'; |
|
151 | 151 | require_once $file; |
152 | 152 | } catch (Exception $ex) { |
153 | 153 | handleException($ex); |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * SPDX-License-Identifier: AGPL-3.0-only |
17 | 17 | */ |
18 | 18 | |
19 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
20 | -require_once __DIR__ . '/../lib/base.php'; |
|
19 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
20 | +require_once __DIR__.'/../lib/base.php'; |
|
21 | 21 | |
22 | 22 | use OC\OCS\ApiHelper; |
23 | 23 | use OCP\AppFramework\Http; |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | OC::handleLogin(Server::get(IRequest::class)); |
55 | 55 | } |
56 | 56 | |
57 | - Server::get(Router::class)->match('/ocsapp' . Server::get(IRequest::class)->getRawPathInfo()); |
|
57 | + Server::get(Router::class)->match('/ocsapp'.Server::get(IRequest::class)->getRawPathInfo()); |
|
58 | 58 | } catch (MaxDelayReached $ex) { |
59 | 59 | ApiHelper::respond(Http::STATUS_TOO_MANY_REQUESTS, $ex->getMessage()); |
60 | 60 | } catch (ResourceNotFoundException $e) { |
61 | 61 | $txt = 'Invalid query, please check the syntax. API specifications are here:' |
62 | - . ' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.' . "\n"; |
|
62 | + . ' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
63 | 63 | ApiHelper::respond(OCSController::RESPOND_NOT_FOUND, $txt); |
64 | 64 | } catch (MethodNotAllowedException $e) { |
65 | 65 | ApiHelper::setContentType(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } catch (\Exception $e) { |
70 | 70 | Server::get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]); |
71 | 71 | |
72 | - $txt = 'Internal Server Error' . "\n"; |
|
72 | + $txt = 'Internal Server Error'."\n"; |
|
73 | 73 | try { |
74 | 74 | if (Server::get(SystemConfig::class)->getValue('debug', false)) { |
75 | 75 | $txt .= $e->getMessage(); |
@@ -8,14 +8,14 @@ |
||
8 | 8 | * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |
9 | 9 | * SPDX-License-Identifier: AGPL-3.0-only |
10 | 10 | */ |
11 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
12 | -require_once __DIR__ . '/../lib/base.php'; |
|
11 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
12 | +require_once __DIR__.'/../lib/base.php'; |
|
13 | 13 | |
14 | 14 | header('Content-type: application/xml'); |
15 | 15 | |
16 | 16 | $request = Server::get(IRequest::class); |
17 | 17 | |
18 | -$url = $request->getServerProtocol() . '://' . substr($request->getServerHost() . $request->getRequestUri(), 0, -17) . 'ocs/v1.php/'; |
|
18 | +$url = $request->getServerProtocol().'://'.substr($request->getServerHost().$request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
19 | 19 | |
20 | 20 | $writer = new XMLWriter(); |
21 | 21 | $writer->openURI('php://output'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |
11 | 11 | * SPDX-License-Identifier: AGPL-3.0-only |
12 | 12 | */ |
13 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
13 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
14 | 14 | |
15 | 15 | use OC\Console\Application; |
16 | 16 | use OCP\AppFramework\Http\Response; |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | define('OC_CONSOLE', 1); |
24 | 24 | |
25 | 25 | function exceptionHandler($exception) { |
26 | - echo 'An unhandled exception has been thrown:' . PHP_EOL; |
|
26 | + echo 'An unhandled exception has been thrown:'.PHP_EOL; |
|
27 | 27 | echo $exception; |
28 | 28 | exit(1); |
29 | 29 | } |
30 | 30 | try { |
31 | - require_once __DIR__ . '/lib/base.php'; |
|
31 | + require_once __DIR__.'/lib/base.php'; |
|
32 | 32 | |
33 | 33 | // set to run indefinitely if needed |
34 | 34 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!OC::$CLI) { |
39 | - echo 'This script can be run from the command line only' . PHP_EOL; |
|
39 | + echo 'This script can be run from the command line only'.PHP_EOL; |
|
40 | 40 | exit(1); |
41 | 41 | } |
42 | 42 | |
@@ -44,34 +44,34 @@ discard block |
||
44 | 44 | set_exception_handler('exceptionHandler'); |
45 | 45 | |
46 | 46 | if (!function_exists('posix_getuid')) { |
47 | - echo 'The posix extensions are required - see https://www.php.net/manual/en/book.posix.php' . PHP_EOL; |
|
47 | + echo 'The posix extensions are required - see https://www.php.net/manual/en/book.posix.php'.PHP_EOL; |
|
48 | 48 | exit(1); |
49 | 49 | } |
50 | 50 | |
51 | 51 | $user = posix_getuid(); |
52 | - $configUser = fileowner(OC::$configDir . 'config.php'); |
|
52 | + $configUser = fileowner(OC::$configDir.'config.php'); |
|
53 | 53 | if ($user !== $configUser) { |
54 | - echo 'Console has to be executed with the user that owns the file config/config.php' . PHP_EOL; |
|
55 | - echo 'Current user id: ' . $user . PHP_EOL; |
|
56 | - echo 'Owner id of config.php: ' . $configUser . PHP_EOL; |
|
57 | - echo "Try adding 'sudo -u #" . $configUser . "' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
58 | - echo "If running with 'docker exec' try adding the option '-u " . $configUser . "' to the docker command (without the single quotes)" . PHP_EOL; |
|
54 | + echo 'Console has to be executed with the user that owns the file config/config.php'.PHP_EOL; |
|
55 | + echo 'Current user id: '.$user.PHP_EOL; |
|
56 | + echo 'Owner id of config.php: '.$configUser.PHP_EOL; |
|
57 | + echo "Try adding 'sudo -u #".$configUser."' to the beginning of the command (without the single quotes)".PHP_EOL; |
|
58 | + echo "If running with 'docker exec' try adding the option '-u ".$configUser."' to the docker command (without the single quotes)".PHP_EOL; |
|
59 | 59 | exit(1); |
60 | 60 | } |
61 | 61 | |
62 | 62 | $oldWorkingDir = getcwd(); |
63 | 63 | if ($oldWorkingDir === false) { |
64 | - echo 'This script can be run from the Nextcloud root directory only.' . PHP_EOL; |
|
65 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
64 | + echo 'This script can be run from the Nextcloud root directory only.'.PHP_EOL; |
|
65 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact.".PHP_EOL; |
|
66 | 66 | } elseif ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
67 | - echo 'This script can be run from the Nextcloud root directory only.' . PHP_EOL; |
|
68 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
67 | + echo 'This script can be run from the Nextcloud root directory only.'.PHP_EOL; |
|
68 | + echo "Can't change to Nextcloud root directory.".PHP_EOL; |
|
69 | 69 | exit(1); |
70 | 70 | } |
71 | 71 | |
72 | 72 | if (!(function_exists('pcntl_signal') && function_exists('pcntl_signal_dispatch')) && !in_array('--no-warnings', $argv)) { |
73 | - echo 'The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php' . PHP_EOL; |
|
74 | - echo "Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini." . PHP_EOL; |
|
73 | + echo 'The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php'.PHP_EOL; |
|
74 | + echo "Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.".PHP_EOL; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $eventLogger = Server::get(IEventLogger::class); |