@@ -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,38 +51,38 @@ 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; |
|
| 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 | 71 | exit(1); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $oldWorkingDir = getcwd(); |
| 75 | 75 | if ($oldWorkingDir === false) { |
| 76 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 77 | - echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; |
|
| 76 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
| 77 | + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact.".PHP_EOL; |
|
| 78 | 78 | } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { |
| 79 | - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; |
|
| 80 | - echo "Can't change to Nextcloud root directory." . PHP_EOL; |
|
| 79 | + echo "This script can be run from the Nextcloud root directory only.".PHP_EOL; |
|
| 80 | + echo "Can't change to Nextcloud root directory.".PHP_EOL; |
|
| 81 | 81 | exit(1); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { |
| 85 | - 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; |
|
| 85 | + 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 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $application = new Application( |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | if ($this->memoryInfo->isMemoryLimitSufficient() === false) { |
| 111 | 111 | $output->getErrorOutput()->writeln( |
| 112 | - '<comment>The current PHP memory limit ' . |
|
| 112 | + '<comment>The current PHP memory limit '. |
|
| 113 | 113 | 'is below the recommended value of 512MB.</comment>' |
| 114 | 114 | ); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | try { |
| 118 | - require_once __DIR__ . '/../../../core/register_command.php'; |
|
| 118 | + require_once __DIR__.'/../../../core/register_command.php'; |
|
| 119 | 119 | if ($this->config->getSystemValue('installed', false)) { |
| 120 | 120 | if (\OCP\Util::needUpgrade()) { |
| 121 | 121 | throw new NeedsUpdateException(); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | // load from register_command.php |
| 137 | 137 | \OC_App::registerAutoloading($app, $appPath); |
| 138 | - $file = $appPath . '/appinfo/register_command.php'; |
|
| 138 | + $file = $appPath.'/appinfo/register_command.php'; |
|
| 139 | 139 | if (file_exists($file)) { |
| 140 | 140 | try { |
| 141 | 141 | require $file; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } else if ($input->getArgument('command') !== '_completion' && $input->getArgument('command') !== 'maintenance:install') { |
| 149 | 149 | $output->writeln("Nextcloud is not installed - only a limited number of commands are available"); |
| 150 | 150 | } |
| 151 | - } catch(NeedsUpdateException $e) { |
|
| 151 | + } catch (NeedsUpdateException $e) { |
|
| 152 | 152 | if ($input->getArgument('command') !== '_completion') { |
| 153 | 153 | $output->writeln("Nextcloud or one of the apps require upgrade - only a limited number of commands are available"); |
| 154 | 154 | $output->writeln("You may use your browser or the occ upgrade command to do the upgrade"); |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | $errors = \OC_Util::checkServer(\OC::$server->getSystemConfig()); |
| 160 | 160 | if (!empty($errors)) { |
| 161 | 161 | foreach ($errors as $error) { |
| 162 | - $output->writeln((string)$error['error']); |
|
| 163 | - $output->writeln((string)$error['hint']); |
|
| 162 | + $output->writeln((string) $error['error']); |
|
| 163 | + $output->writeln((string) $error['hint']); |
|
| 164 | 164 | $output->writeln(''); |
| 165 | 165 | } |
| 166 | 166 | throw new \Exception("Environment not properly prepared."); |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | && $input->getArgument('command') !== 'maintenance:mode') { |
| 185 | 185 | $errOutput = $output->getErrorOutput(); |
| 186 | 186 | $errOutput->writeln( |
| 187 | - '<comment>Nextcloud is in maintenance mode - ' . |
|
| 188 | - 'no apps have been loaded</comment>' . PHP_EOL |
|
| 187 | + '<comment>Nextcloud is in maintenance mode - '. |
|
| 188 | + 'no apps have been loaded</comment>'.PHP_EOL |
|
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if ($iniValue === '-1') { |
| 51 | 51 | return -1; |
| 52 | 52 | } else if (is_numeric($iniValue) === true) { |
| 53 | - return (int)$iniValue; |
|
| 53 | + return (int) $iniValue; |
|
| 54 | 54 | } else { |
| 55 | 55 | return $this->memoryLimitToBytes($iniValue); |
| 56 | 56 | } |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private function memoryLimitToBytes(string $memoryLimit): int { |
| 66 | 66 | $last = strtolower(substr($memoryLimit, -1)); |
| 67 | - $memoryLimit = (int)substr($memoryLimit, 0, -1); |
|
| 67 | + $memoryLimit = (int) substr($memoryLimit, 0, -1); |
|
| 68 | 68 | |
| 69 | 69 | // intended fall trough |
| 70 | - switch($last) { |
|
| 70 | + switch ($last) { |
|
| 71 | 71 | case 'g': |
| 72 | 72 | $memoryLimit *= 1024; |
| 73 | 73 | case 'm': |