@@ -34,64 +34,64 @@ |
||
| 34 | 34 | // Show warning if a PHP version below 5.6.0 is used, this has to happen here |
| 35 | 35 | // because base.php will already use 5.6 syntax. |
| 36 | 36 | if (version_compare(PHP_VERSION, '5.6.0') === -1) { |
| 37 | - echo 'This version of Nextcloud requires at least PHP 5.6.0'.PHP_EOL; |
|
| 38 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'.PHP_EOL; |
|
| 39 | - return; |
|
| 37 | + echo 'This version of Nextcloud requires at least PHP 5.6.0'.PHP_EOL; |
|
| 38 | + echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'.PHP_EOL; |
|
| 39 | + return; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function exceptionHandler($exception) { |
| 43 | - echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 44 | - echo $exception; |
|
| 45 | - exit(1); |
|
| 43 | + echo "An unhandled exception has been thrown:" . PHP_EOL; |
|
| 44 | + echo $exception; |
|
| 45 | + exit(1); |
|
| 46 | 46 | } |
| 47 | 47 | try { |
| 48 | - require_once __DIR__ . '/lib/base.php'; |
|
| 48 | + require_once __DIR__ . '/lib/base.php'; |
|
| 49 | 49 | |
| 50 | - // set to run indefinitely if needed |
|
| 51 | - if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 52 | - @set_time_limit(0); |
|
| 53 | - } |
|
| 50 | + // set to run indefinitely if needed |
|
| 51 | + if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 52 | + @set_time_limit(0); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (!OC::$CLI) { |
|
| 56 | - echo "This script can be run from the command line only" . PHP_EOL; |
|
| 57 | - exit(1); |
|
| 58 | - } |
|
| 55 | + if (!OC::$CLI) { |
|
| 56 | + echo "This script can be run from the command line only" . PHP_EOL; |
|
| 57 | + exit(1); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - set_exception_handler('exceptionHandler'); |
|
| 60 | + set_exception_handler('exceptionHandler'); |
|
| 61 | 61 | |
| 62 | - if (!function_exists('posix_getuid')) { |
|
| 63 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 64 | - exit(1); |
|
| 65 | - } |
|
| 66 | - $user = posix_getpwuid(posix_getuid()); |
|
| 67 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 68 | - if ($user['name'] !== $configUser['name']) { |
|
| 69 | - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 70 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 71 | - echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 72 | - echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 73 | - exit(1); |
|
| 74 | - } |
|
| 62 | + if (!function_exists('posix_getuid')) { |
|
| 63 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 64 | + exit(1); |
|
| 65 | + } |
|
| 66 | + $user = posix_getpwuid(posix_getuid()); |
|
| 67 | + $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 68 | + if ($user['name'] !== $configUser['name']) { |
|
| 69 | + echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; |
|
| 70 | + echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 71 | + echo "Owner of config.php: " . $configUser['name'] . PHP_EOL; |
|
| 72 | + echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL; |
|
| 73 | + exit(1); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - $oldWorkingDir = getcwd(); |
|
| 77 | - if ($oldWorkingDir === false) { |
|
| 78 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 79 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 80 | - } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
|
| 81 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 82 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 83 | - exit(1); |
|
| 84 | - } |
|
| 76 | + $oldWorkingDir = getcwd(); |
|
| 77 | + if ($oldWorkingDir === false) { |
|
| 78 | + echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 79 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 80 | + } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
|
| 81 | + echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 82 | + echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 83 | + exit(1); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
|
| 87 | - 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; |
|
| 88 | - } |
|
| 86 | + if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
|
| 87 | + 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; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - $application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest(), \OC::$server->getLogger()); |
|
| 91 | - $application->loadCommands(new ArgvInput(), new ConsoleOutput()); |
|
| 92 | - $application->run(); |
|
| 90 | + $application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest(), \OC::$server->getLogger()); |
|
| 91 | + $application->loadCommands(new ArgvInput(), new ConsoleOutput()); |
|
| 92 | + $application->run(); |
|
| 93 | 93 | } catch (Exception $ex) { |
| 94 | - exceptionHandler($ex); |
|
| 94 | + exceptionHandler($ex); |
|
| 95 | 95 | } catch (Error $ex) { |
| 96 | - exceptionHandler($ex); |
|
| 96 | + exceptionHandler($ex); |
|
| 97 | 97 | } |