@@ -38,65 +38,65 @@ |
||
| 38 | 38 | define('OC_CONSOLE', 1); |
| 39 | 39 | |
| 40 | 40 | function exceptionHandler($exception) { |
| 41 | - echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 42 | - echo $exception; |
|
| 43 | - exit(1); |
|
| 41 | + echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 42 | + echo $exception; |
|
| 43 | + exit(1); |
|
| 44 | 44 | } |
| 45 | 45 | try { |
| 46 | - require_once __DIR__ . '/lib/base.php'; |
|
| 46 | + require_once __DIR__ . '/lib/base.php'; |
|
| 47 | 47 | |
| 48 | - // set to run indefinitely if needed |
|
| 49 | - if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 50 | - @set_time_limit(0); |
|
| 51 | - } |
|
| 48 | + // set to run indefinitely if needed |
|
| 49 | + if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 50 | + @set_time_limit(0); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - if (!OC::$CLI) { |
|
| 54 | - echo "This script can be run from the command line only" . PHP_EOL; |
|
| 55 | - exit(1); |
|
| 56 | - } |
|
| 53 | + if (!OC::$CLI) { |
|
| 54 | + echo "This script can be run from the command line only" . PHP_EOL; |
|
| 55 | + exit(1); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - set_exception_handler('exceptionHandler'); |
|
| 58 | + set_exception_handler('exceptionHandler'); |
|
| 59 | 59 | |
| 60 | - if (!function_exists('posix_getuid')) { |
|
| 61 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 62 | - exit(1); |
|
| 63 | - } |
|
| 64 | - $user = posix_getpwuid(posix_getuid()); |
|
| 65 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 66 | - if ($user['name'] !== $configUser['name']) { |
|
| 67 | - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 68 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 69 | - echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 70 | - echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 71 | - echo "If running with 'docker exec' try adding the option '-u " . $configUser['name'] . "' to the docker command (without the single quotes)" . PHP_EOL; |
|
| 72 | - exit(1); |
|
| 73 | - } |
|
| 60 | + if (!function_exists('posix_getuid')) { |
|
| 61 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 62 | + exit(1); |
|
| 63 | + } |
|
| 64 | + $user = posix_getpwuid(posix_getuid()); |
|
| 65 | + $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 66 | + if ($user['name'] !== $configUser['name']) { |
|
| 67 | + echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 68 | + echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 69 | + echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 70 | + echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 71 | + echo "If running with 'docker exec' try adding the option '-u " . $configUser['name'] . "' to the docker command (without the single quotes)" . PHP_EOL; |
|
| 72 | + exit(1); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $oldWorkingDir = getcwd(); |
|
| 76 | - if ($oldWorkingDir === false) { |
|
| 77 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 78 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 79 | - } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
|
| 80 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 81 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 82 | - exit(1); |
|
| 83 | - } |
|
| 75 | + $oldWorkingDir = getcwd(); |
|
| 76 | + if ($oldWorkingDir === false) { |
|
| 77 | + echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 78 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 79 | + } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
|
| 80 | + echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 81 | + echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 82 | + exit(1); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
|
| 86 | - echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
| 87 | - } |
|
| 85 | + if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
|
| 86 | + echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - $application = new Application( |
|
| 90 | - \OC::$server->getConfig(), |
|
| 91 | - \OC::$server->getEventDispatcher(), |
|
| 92 | - \OC::$server->getRequest(), |
|
| 93 | - \OC::$server->getLogger(), |
|
| 94 | - \OC::$server->query(\OC\MemoryInfo::class) |
|
| 95 | - ); |
|
| 96 | - $application->loadCommands(new ArgvInput(), new ConsoleOutput()); |
|
| 97 | - $application->run(); |
|
| 89 | + $application = new Application( |
|
| 90 | + \OC::$server->getConfig(), |
|
| 91 | + \OC::$server->getEventDispatcher(), |
|
| 92 | + \OC::$server->getRequest(), |
|
| 93 | + \OC::$server->getLogger(), |
|
| 94 | + \OC::$server->query(\OC\MemoryInfo::class) |
|
| 95 | + ); |
|
| 96 | + $application->loadCommands(new ArgvInput(), new ConsoleOutput()); |
|
| 97 | + $application->run(); |
|
| 98 | 98 | } catch (Exception $ex) { |
| 99 | - exceptionHandler($ex); |
|
| 99 | + exceptionHandler($ex); |
|
| 100 | 100 | } catch (Error $ex) { |
| 101 | - exceptionHandler($ex); |
|
| 101 | + exceptionHandler($ex); |
|
| 102 | 102 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 32 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 33 | 33 | |
| 34 | 34 | use OC\Console\Application; |
| 35 | 35 | use Symfony\Component\Console\Input\ArgvInput; |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | define('OC_CONSOLE', 1); |
| 39 | 39 | |
| 40 | 40 | function exceptionHandler($exception) { |
| 41 | - echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 41 | + echo "An unhandled exception has been thrown:".PHP_EOL; |
|
| 42 | 42 | echo $exception; |
| 43 | 43 | exit(1); |
| 44 | 44 | } |
| 45 | 45 | try { |
| 46 | - require_once __DIR__ . '/lib/base.php'; |
|
| 46 | + require_once __DIR__.'/lib/base.php'; |
|
| 47 | 47 | |
| 48 | 48 | // set to run indefinitely if needed |
| 49 | 49 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
@@ -51,39 +51,39 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (!OC::$CLI) { |
| 54 | - echo "This script can be run from the command line only" . PHP_EOL; |
|
| 54 | + echo "This script can be run from the command line only".PHP_EOL; |
|
| 55 | 55 | exit(1); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | set_exception_handler('exceptionHandler'); |
| 59 | 59 | |
| 60 | 60 | if (!function_exists('posix_getuid')) { |
| 61 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 61 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php".PHP_EOL; |
|
| 62 | 62 | exit(1); |
| 63 | 63 | } |
| 64 | 64 | $user = posix_getpwuid(posix_getuid()); |
| 65 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 65 | + $configUser = posix_getpwuid(fileowner(OC::$configDir.'config.php')); |
|
| 66 | 66 | if ($user['name'] !== $configUser['name']) { |
| 67 | - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 68 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 69 | - echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 70 | - echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 71 | - echo "If running with 'docker exec' try adding the option '-u " . $configUser['name'] . "' to the docker command (without the single quotes)" . PHP_EOL; |
|
| 67 | + echo "Console has to be executed with the user that owns the file config/config.php".PHP_EOL; |
|
| 68 | + echo "Current user: ".$user['name'].PHP_EOL; |
|
| 69 | + echo "Owner of config.php: ".$configUser['name'].PHP_EOL; |
|
| 70 | + echo "Try adding 'sudo -u ".$configUser['name']." ' to the beginning of the command (without the single quotes)".PHP_EOL; |
|
| 71 | + echo "If running with 'docker exec' try adding the option '-u ".$configUser['name']."' to the docker command (without the single quotes)".PHP_EOL; |
|
| 72 | 72 | exit(1); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $oldWorkingDir = getcwd(); |
| 76 | 76 | if ($oldWorkingDir === false) { |
| 77 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 78 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 77 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
| 78 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact.".PHP_EOL; |
|
| 79 | 79 | } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
| 80 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 81 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 80 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
| 81 | + echo "Can't change to Nextcloud root directory.".PHP_EOL; |
|
| 82 | 82 | exit(1); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
| 86 | - echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; |
|
| 86 | + echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php".PHP_EOL; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $application = new Application( |