@@ -17,24 +17,24 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class UnregisterCommand extends ModuleCommand |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * {@inheritdoc} |
|
| 22 | - */ |
|
| 23 | - protected function configure() |
|
| 24 | - { |
|
| 25 | - parent::configure(); |
|
| 20 | + /** |
|
| 21 | + * {@inheritdoc} |
|
| 22 | + */ |
|
| 23 | + protected function configure() |
|
| 24 | + { |
|
| 25 | + parent::configure(); |
|
| 26 | 26 | |
| 27 | - $this->setName('module:unregister') |
|
| 28 | - ->setDescription('Uninstall module'); |
|
| 29 | - } |
|
| 27 | + $this->setName('module:unregister') |
|
| 28 | + ->setDescription('Uninstall module'); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * {@inheritdoc} |
|
| 33 | - */ |
|
| 34 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | - { |
|
| 36 | - $module = new Module($input->getArgument('module')); |
|
| 37 | - $module->unRegister(); |
|
| 38 | - $output->writeln(sprintf('unregistered <info>%s</info>', $module->getName())); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * {@inheritdoc} |
|
| 33 | + */ |
|
| 34 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | + { |
|
| 36 | + $module = new Module($input->getArgument('module')); |
|
| 37 | + $module->unRegister(); |
|
| 38 | + $output->writeln(sprintf('unregistered <info>%s</info>', $module->getName())); |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -19,38 +19,38 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class UpdateCommand extends ModuleCommand |
| 21 | 21 | { |
| 22 | - use CanRestartTrait; |
|
| 22 | + use CanRestartTrait; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * {@inheritdoc} |
|
| 26 | - */ |
|
| 27 | - protected function configure() |
|
| 28 | - { |
|
| 29 | - parent::configure(); |
|
| 24 | + /** |
|
| 25 | + * {@inheritdoc} |
|
| 26 | + */ |
|
| 27 | + protected function configure() |
|
| 28 | + { |
|
| 29 | + parent::configure(); |
|
| 30 | 30 | |
| 31 | - $this->setName('module:update') |
|
| 32 | - ->setDescription('Load module updates from Marketplace') |
|
| 33 | - ->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases'); |
|
| 34 | - } |
|
| 31 | + $this->setName('module:update') |
|
| 32 | + ->setDescription('Load module updates from Marketplace') |
|
| 33 | + ->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases'); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * {@inheritdoc} |
|
| 38 | - */ |
|
| 39 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 40 | - { |
|
| 41 | - $module = new Module($input->getArgument('module')); |
|
| 42 | - $modulesUpdated = null; |
|
| 43 | - while ($module->update($modulesUpdated)) |
|
| 44 | - { |
|
| 45 | - if (is_array($modulesUpdated)) |
|
| 46 | - { |
|
| 47 | - foreach ($modulesUpdated as $moduleName => $moduleVersion) |
|
| 48 | - { |
|
| 49 | - $output->writeln(sprintf('updated %s to <info>%s</info>', $moduleName, $moduleVersion)); |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - return $this->restartScript($input, $output); |
|
| 53 | - } |
|
| 54 | - return 0; |
|
| 55 | - } |
|
| 36 | + /** |
|
| 37 | + * {@inheritdoc} |
|
| 38 | + */ |
|
| 39 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 40 | + { |
|
| 41 | + $module = new Module($input->getArgument('module')); |
|
| 42 | + $modulesUpdated = null; |
|
| 43 | + while ($module->update($modulesUpdated)) |
|
| 44 | + { |
|
| 45 | + if (is_array($modulesUpdated)) |
|
| 46 | + { |
|
| 47 | + foreach ($modulesUpdated as $moduleName => $moduleVersion) |
|
| 48 | + { |
|
| 49 | + $output->writeln(sprintf('updated %s to <info>%s</info>', $moduleName, $moduleVersion)); |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + return $this->restartScript($input, $output); |
|
| 53 | + } |
|
| 54 | + return 0; |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -17,24 +17,24 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class RemoveCommand extends ModuleCommand |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * {@inheritdoc} |
|
| 22 | - */ |
|
| 23 | - protected function configure() |
|
| 24 | - { |
|
| 25 | - parent::configure(); |
|
| 20 | + /** |
|
| 21 | + * {@inheritdoc} |
|
| 22 | + */ |
|
| 23 | + protected function configure() |
|
| 24 | + { |
|
| 25 | + parent::configure(); |
|
| 26 | 26 | |
| 27 | - $this->setName('module:remove') |
|
| 28 | - ->setDescription('Uninstall and remove module folder from system'); |
|
| 29 | - } |
|
| 27 | + $this->setName('module:remove') |
|
| 28 | + ->setDescription('Uninstall and remove module folder from system'); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * {@inheritdoc} |
|
| 33 | - */ |
|
| 34 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | - { |
|
| 36 | - $module = new Module($input->getArgument('module')); |
|
| 37 | - $module->remove(); |
|
| 38 | - $output->writeln(sprintf('removed <info>%s</info>', $module->getName())); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * {@inheritdoc} |
|
| 33 | + */ |
|
| 34 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | + { |
|
| 36 | + $module = new Module($input->getArgument('module')); |
|
| 37 | + $module->remove(); |
|
| 38 | + $output->writeln(sprintf('removed <info>%s</info>', $module->getName())); |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -21,48 +21,48 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | abstract class ModuleCommand extends BitrixCommand |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * {@inheritdoc} |
|
| 26 | - */ |
|
| 27 | - protected function configure() |
|
| 28 | - { |
|
| 29 | - parent::configure(); |
|
| 24 | + /** |
|
| 25 | + * {@inheritdoc} |
|
| 26 | + */ |
|
| 27 | + protected function configure() |
|
| 28 | + { |
|
| 29 | + parent::configure(); |
|
| 30 | 30 | |
| 31 | - $this->addArgument('module', InputArgument::REQUIRED, 'Module name (e.g. `vendor.module`)') |
|
| 32 | - ->addOption('confirm-thirdparty', 'ct', InputOption::VALUE_NONE, 'Suppress third-party modules warning'); |
|
| 33 | - } |
|
| 31 | + $this->addArgument('module', InputArgument::REQUIRED, 'Module name (e.g. `vendor.module`)') |
|
| 32 | + ->addOption('confirm-thirdparty', 'ct', InputOption::VALUE_NONE, 'Suppress third-party modules warning'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @inheritdoc |
|
| 37 | - */ |
|
| 38 | - protected function interact(InputInterface $input, OutputInterface $output) |
|
| 39 | - { |
|
| 40 | - parent::interact($input, $output); |
|
| 35 | + /** |
|
| 36 | + * @inheritdoc |
|
| 37 | + */ |
|
| 38 | + protected function interact(InputInterface $input, OutputInterface $output) |
|
| 39 | + { |
|
| 40 | + parent::interact($input, $output); |
|
| 41 | 41 | |
| 42 | - $module = new Module($input->getArgument('module')); |
|
| 42 | + $module = new Module($input->getArgument('module')); |
|
| 43 | 43 | |
| 44 | - if (in_array($this->getName(), ['module:register', 'module:unregister']) |
|
| 45 | - && $module->isThirdParty() && !$input->getOption('confirm-thirdparty') |
|
| 46 | - ) |
|
| 47 | - { |
|
| 48 | - $output->writeln($module->isThirdParty() . ' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
| 49 | - } |
|
| 50 | - } |
|
| 44 | + if (in_array($this->getName(), ['module:register', 'module:unregister']) |
|
| 45 | + && $module->isThirdParty() && !$input->getOption('confirm-thirdparty') |
|
| 46 | + ) |
|
| 47 | + { |
|
| 48 | + $output->writeln($module->isThirdParty() . ' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Gets console commands from this package. |
|
| 54 | - * |
|
| 55 | - * @return Command[] |
|
| 56 | - */ |
|
| 57 | - public static function getCommands() |
|
| 58 | - { |
|
| 59 | - return [ |
|
| 60 | - new LoadCommand(), |
|
| 61 | - new RegisterCommand(), |
|
| 62 | - new RemoveCommand(), |
|
| 63 | - new UnregisterCommand(), |
|
| 64 | - new UpdateCommand(), |
|
| 65 | - ]; |
|
| 66 | - } |
|
| 52 | + /** |
|
| 53 | + * Gets console commands from this package. |
|
| 54 | + * |
|
| 55 | + * @return Command[] |
|
| 56 | + */ |
|
| 57 | + public static function getCommands() |
|
| 58 | + { |
|
| 59 | + return [ |
|
| 60 | + new LoadCommand(), |
|
| 61 | + new RegisterCommand(), |
|
| 62 | + new RemoveCommand(), |
|
| 63 | + new UnregisterCommand(), |
|
| 64 | + new UpdateCommand(), |
|
| 65 | + ]; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | \ No newline at end of file |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | && $module->isThirdParty() && !$input->getOption('confirm-thirdparty') |
| 46 | 46 | ) |
| 47 | 47 | { |
| 48 | - $output->writeln($module->isThirdParty() . ' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
| 48 | + $output->writeln($module->isThirdParty().' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | protected function restartScript(InputInterface $input, OutputInterface $output) |
| 33 | 33 | { |
| 34 | - $proc = popen('php -f ' . join(' ', $GLOBALS['argv']) . ' 2>&1', 'r'); |
|
| 34 | + $proc = popen('php -f '.join(' ', $GLOBALS['argv']).' 2>&1', 'r'); |
|
| 35 | 35 | while (!feof($proc)) |
| 36 | 36 | { |
| 37 | 37 | $output->write(fread($proc, 4096)); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | if ($this->getConfiguration() === null) |
| 110 | 110 | { |
| 111 | - $output->writeln(PHP_EOL . '<error>No configuration loaded.</error> ' |
|
| 111 | + $output->writeln(PHP_EOL.'<error>No configuration loaded.</error> ' |
|
| 112 | 112 | . 'Please run <info>init</info> command first'); |
| 113 | 113 | } |
| 114 | 114 | else |
@@ -116,18 +116,18 @@ discard block |
||
| 116 | 116 | switch ($this->getBitrixStatus()) |
| 117 | 117 | { |
| 118 | 118 | case static::BITRIX_STATUS_UNAVAILABLE: |
| 119 | - $output->writeln(PHP_EOL . sprintf('<error>No Bitrix kernel found in %s.</error> ' |
|
| 119 | + $output->writeln(PHP_EOL.sprintf('<error>No Bitrix kernel found in %s.</error> ' |
|
| 120 | 120 | . 'Please run <info>env:init</info> command to configure', $this->getDocumentRoot())); |
| 121 | 121 | break; |
| 122 | 122 | |
| 123 | 123 | case static::BITRIX_STATUS_NO_DB_CONNECTION: |
| 124 | - $output->writeln(PHP_EOL . '<error>Bitrix database connection is unavailable.</error>'); |
|
| 124 | + $output->writeln(PHP_EOL.'<error>Bitrix database connection is unavailable.</error>'); |
|
| 125 | 125 | break; |
| 126 | 126 | |
| 127 | 127 | case static::BITRIX_STATUS_COMPLETE: |
| 128 | 128 | if ($this->getCommandName($input) === null) |
| 129 | 129 | { |
| 130 | - $output->writeln(PHP_EOL . sprintf('Using Bitrix <info>kernel v%s</info>.</info>', SM_VERSION), |
|
| 130 | + $output->writeln(PHP_EOL.sprintf('Using Bitrix <info>kernel v%s</info>.</info>', SM_VERSION), |
|
| 131 | 131 | OutputInterface::VERBOSITY_VERY_VERBOSE); |
| 132 | 132 | } |
| 133 | 133 | break; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | foreach (ModuleManager::getInstalledModules() as $module) |
| 181 | 181 | { |
| 182 | - $cliFile = getLocalPath('modules/' . $module['ID'] . '/cli.php'); |
|
| 182 | + $cliFile = getLocalPath('modules/'.$module['ID'].'/cli.php'); |
|
| 183 | 183 | |
| 184 | 184 | if ($cliFile === false) |
| 185 | 185 | { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | continue; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $config = include_once $this->getDocumentRoot() . $cliFile; |
|
| 193 | + $config = include_once $this->getDocumentRoot().$cliFile; |
|
| 194 | 194 | |
| 195 | 195 | if (isset($config['commands']) && is_array($config['commands'])) |
| 196 | 196 | { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | if (!is_array($this->configuration)) |
| 223 | 223 | { |
| 224 | - throw new ConfigurationException('Configuration file ' . $path . ' must return an array'); |
|
| 224 | + throw new ConfigurationException('Configuration file '.$path.' must return an array'); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | //TODO-fox: Проверка на указание в качестве относительного пути / |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | else |
| 238 | 238 | { |
| 239 | - $this->setDocumentRoot($this->getRoot() . '/' . $this->configuration['web-dir']); |
|
| 239 | + $this->setDocumentRoot($this->getRoot().'/'.$this->configuration['web-dir']); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if (!is_dir($_SERVER['DOCUMENT_ROOT'])) |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | /** @noinspection PhpUnusedLocalVariableInspection */ |
| 288 | 288 | $DB, $DBType, $DBHost, $DBLogin, $DBPassword, $DBName, $DBDebug, $DBDebugToFile, $APPLICATION, $USER, $DBSQLServerType; |
| 289 | 289 | |
| 290 | - require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php'; |
|
| 290 | + require_once $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php'; |
|
| 291 | 291 | |
| 292 | 292 | if (defined('B_PROLOG_INCLUDED') && B_PROLOG_INCLUDED === true) |
| 293 | 293 | { |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | public function checkBitrix() |
| 311 | 311 | { |
| 312 | 312 | if ( |
| 313 | - !is_file($_SERVER['DOCUMENT_ROOT'] . '/bitrix/.settings.php') |
|
| 314 | - && !is_file($_SERVER['DOCUMENT_ROOT'] . '/bitrix/.settings_extra.php') |
|
| 313 | + !is_file($_SERVER['DOCUMENT_ROOT'].'/bitrix/.settings.php') |
|
| 314 | + && !is_file($_SERVER['DOCUMENT_ROOT'].'/bitrix/.settings_extra.php') |
|
| 315 | 315 | ) |
| 316 | 316 | { |
| 317 | 317 | return false; |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | |
| 358 | 358 | $this->initializeBitrix(); |
| 359 | 359 | |
| 360 | - spl_autoload_register(function ($className) { |
|
| 360 | + spl_autoload_register(function($className) { |
|
| 361 | 361 | $file = ltrim($className, "\\"); |
| 362 | 362 | $file = strtr($file, Loader::ALPHA_UPPER, Loader::ALPHA_LOWER); |
| 363 | 363 | $file = str_replace('\\', '/', $file); |
@@ -382,18 +382,18 @@ discard block |
||
| 382 | 382 | return false; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - $module = array_shift($arFile) . '.' . array_shift($arFile); |
|
| 385 | + $module = array_shift($arFile).'.'.array_shift($arFile); |
|
| 386 | 386 | |
| 387 | 387 | if (!Loader::includeModule($module)) |
| 388 | 388 | { |
| 389 | 389 | return false; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - $path = getLocalPath('/modules/' . $module . '/' . implode('/', $arFile) . '.php'); |
|
| 392 | + $path = getLocalPath('/modules/'.$module.'/'.implode('/', $arFile).'.php'); |
|
| 393 | 393 | |
| 394 | 394 | if ($path !== false) |
| 395 | 395 | { |
| 396 | - include_once $this->getDocumentRoot() . $path; |
|
| 396 | + include_once $this->getDocumentRoot().$path; |
|
| 397 | 397 | } |
| 398 | 398 | }); |
| 399 | 399 | } |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $output->writeln(PHP_EOL . '<error>No configuration loaded.</error> ' |
| 112 | 112 | . 'Please run <info>init</info> command first'); |
| 113 | - } |
|
| 114 | - else |
|
| 113 | + } else |
|
| 115 | 114 | { |
| 116 | 115 | switch ($this->getBitrixStatus()) |
| 117 | 116 | { |
@@ -184,8 +183,7 @@ discard block |
||
| 184 | 183 | if ($cliFile === false) |
| 185 | 184 | { |
| 186 | 185 | continue; |
| 187 | - } |
|
| 188 | - elseif (!Loader::includeModule($module['ID'])) |
|
| 186 | + } elseif (!Loader::includeModule($module['ID'])) |
|
| 189 | 187 | { |
| 190 | 188 | continue; |
| 191 | 189 | } |
@@ -225,16 +223,16 @@ discard block |
||
| 225 | 223 | } |
| 226 | 224 | |
| 227 | 225 | //TODO-fox: Проверка на указание в качестве относительного пути / |
| 228 | - if ($this->configuration['web-dir'] == '/') |
|
| 229 | - $this->configuration['web-dir'] = ''; |
|
| 226 | + if ($this->configuration['web-dir'] == '/') { |
|
| 227 | + $this->configuration['web-dir'] = ''; |
|
| 228 | + } |
|
| 230 | 229 | |
| 231 | 230 | $filesystem = new Filesystem(); |
| 232 | 231 | |
| 233 | 232 | if ($filesystem->isAbsolutePath($this->configuration['web-dir'])) |
| 234 | 233 | { |
| 235 | 234 | $this->setDocumentRoot($this->configuration['web-dir']); |
| 236 | - } |
|
| 237 | - else |
|
| 235 | + } else |
|
| 238 | 236 | { |
| 239 | 237 | $this->setDocumentRoot($this->getRoot() . '/' . $this->configuration['web-dir']); |
| 240 | 238 | } |
@@ -267,8 +265,7 @@ discard block |
||
| 267 | 265 | if ($this->bitrixStatus === static::BITRIX_STATUS_COMPLETE) |
| 268 | 266 | { |
| 269 | 267 | return static::BITRIX_STATUS_COMPLETE; |
| 270 | - } |
|
| 271 | - elseif (!$this->checkBitrix()) |
|
| 268 | + } elseif (!$this->checkBitrix()) |
|
| 272 | 269 | { |
| 273 | 270 | return static::BITRIX_STATUS_UNAVAILABLE; |
| 274 | 271 | } |
@@ -293,8 +290,7 @@ discard block |
||
| 293 | 290 | { |
| 294 | 291 | $this->bitrixStatus = static::BITRIX_STATUS_COMPLETE; |
| 295 | 292 | } |
| 296 | - } |
|
| 297 | - catch (ConnectionException $e) |
|
| 293 | + } catch (ConnectionException $e) |
|
| 298 | 294 | { |
| 299 | 295 | $this->bitrixStatus = static::BITRIX_STATUS_NO_DB_CONNECTION; |
| 300 | 296 | } |
@@ -372,12 +368,10 @@ discard block |
||
| 372 | 368 | if (preg_match("#[^\\\\/a-zA-Z0-9_]#", $file)) |
| 373 | 369 | { |
| 374 | 370 | return false; |
| 375 | - } |
|
| 376 | - elseif ($arFile[0] === 'bitrix') |
|
| 371 | + } elseif ($arFile[0] === 'bitrix') |
|
| 377 | 372 | { |
| 378 | 373 | return false; |
| 379 | - } |
|
| 380 | - elseif ($arFile[2] !== 'tests') |
|
| 374 | + } elseif ($arFile[2] !== 'tests') |
|
| 381 | 375 | { |
| 382 | 376 | return false; |
| 383 | 377 | } |
@@ -39,11 +39,11 @@ |
||
| 39 | 39 | throw new ArgumentTypeException('callChain', 'array'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $chain .= '->' . $method . '(' . static::convertArgsToString($methodArgs) . ')'; |
|
| 42 | + $chain .= '->'.$method.'('.static::convertArgsToString($methodArgs).')'; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - return '\\' . $className . '::agent(' . static::convertArgsToString($args). ')' . $chain . ';'; |
|
| 46 | + return '\\'.$className.'::agent('.static::convertArgsToString($args).')'.$chain.';'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | protected static function convertArgsToString(array $args) |