|
@@ -10,7 +10,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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); |
|
@@ -105,7 +105,7 @@ discard block |
|
|
block discarded – undo |
|
105
|
105
|
'profiler' => 'db', |
|
106
|
106
|
'token' => $profile->getToken(), |
|
107
|
107
|
]); |
|
108
|
|
- $output->getErrorOutput()->writeln('Profiler output available at ' . $url); |
|
|
108
|
+ $output->getErrorOutput()->writeln('Profiler output available at '.$url); |
|
109
|
109
|
} |
|
110
|
110
|
|
|
111
|
111
|
if ($exitCode > 255) { |