Completed
Branch master (01bfb0)
by Nik
03:53
created
src/Module/Command/ModuleCommand.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Module\Command;
8 8
 
@@ -21,48 +21,48 @@  discard block
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Module/Command/RegisterCommand.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -17,24 +17,24 @@
 block discarded – undo
17 17
  */
18 18
 class RegisterCommand 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:register')
28
-			->setDescription('Install module');
29
-	}
27
+        $this->setName('module:register')
28
+            ->setDescription('Install 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->register();
38
-		$output->writeln(sprintf('registered <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->register();
38
+        $output->writeln(sprintf('registered <info>%s</info>', $module->getName()));
39
+    }
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/Module/Command/CanRestart.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Module\Command;
8 8
 
@@ -16,27 +16,27 @@  discard block
 block discarded – undo
16 16
  */
17 17
 trait CanRestart
18 18
 {
19
-	/**
20
-	 * Executes another copy of console process to continue updates
21
-	 *
22
-	 * We may encounter problems when module update scripts (update.php or update_post.php) requires module files,
23
-	 * they are included only once and stay in most early version.
24
-	 * Bitrix update system always run update scripts in separate requests to web-server.
25
-	 * This ensures the same behavior as in original update system, updates always run on latest module version.
26
-	 *
27
-	 * @param InputInterface $input
28
-	 * @param OutputInterface $output
29
-	 * @return mixed
30
-	 */
31
-	protected function restartScript(InputInterface $input, OutputInterface $output)
32
-	{
33
-		$proc = popen('php -f ' . join(' ', $GLOBALS['argv']) . ' 2>&1', 'r');
34
-		while (!feof($proc))
35
-		{
36
-			$output->write(fread($proc, 4096));
37
-		}
19
+    /**
20
+     * Executes another copy of console process to continue updates
21
+     *
22
+     * We may encounter problems when module update scripts (update.php or update_post.php) requires module files,
23
+     * they are included only once and stay in most early version.
24
+     * Bitrix update system always run update scripts in separate requests to web-server.
25
+     * This ensures the same behavior as in original update system, updates always run on latest module version.
26
+     *
27
+     * @param InputInterface $input
28
+     * @param OutputInterface $output
29
+     * @return mixed
30
+     */
31
+    protected function restartScript(InputInterface $input, OutputInterface $output)
32
+    {
33
+        $proc = popen('php -f ' . join(' ', $GLOBALS['argv']) . ' 2>&1', 'r');
34
+        while (!feof($proc))
35
+        {
36
+            $output->write(fread($proc, 4096));
37
+        }
38 38
 
39
-		return pclose($proc);
40
-	}
39
+        return pclose($proc);
40
+    }
41 41
 
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
src/Module/Command/LoadCommand.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -19,72 +19,72 @@
 block discarded – undo
19 19
  */
20 20
 class LoadCommand extends ModuleCommand
21 21
 {
22
-	use CanRestart;
22
+    use CanRestart;
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:load')
32
-			->setDescription('Load and install module from Marketplace')
33
-			->addOption('no-update', 'nu', InputOption::VALUE_NONE, 'Don\' update module')
34
-			->addOption('no-register', 'ni', InputOption::VALUE_NONE, 'Load only, don\' register module')
35
-			->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases');
36
-	}
31
+        $this->setName('module:load')
32
+            ->setDescription('Load and install module from Marketplace')
33
+            ->addOption('no-update', 'nu', InputOption::VALUE_NONE, 'Don\' update module')
34
+            ->addOption('no-register', 'ni', InputOption::VALUE_NONE, 'Load only, don\' register module')
35
+            ->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases');
36
+    }
37 37
 
38
-	/**
39
-	 * {@inheritdoc}
40
-	 */
41
-	protected function execute(InputInterface $input, OutputInterface $output)
42
-	{
43
-		$module = new Module($input->getArgument('module'));
38
+    /**
39
+     * {@inheritdoc}
40
+     */
41
+    protected function execute(InputInterface $input, OutputInterface $output)
42
+    {
43
+        $module = new Module($input->getArgument('module'));
44 44
 
45
-		if (!$module->isThirdParty())
46
-		{
47
-			$output->writeln('<info>Loading kernel modules is unsupported</info>');
48
-		}
45
+        if (!$module->isThirdParty())
46
+        {
47
+            $output->writeln('<info>Loading kernel modules is unsupported</info>');
48
+        }
49 49
 
50
-		if ($input->getOption('beta'))
51
-		{
52
-			$module->setBeta();
53
-		}
50
+        if ($input->getOption('beta'))
51
+        {
52
+            $module->setBeta();
53
+        }
54 54
 
55
-		$module->load();
55
+        $module->load();
56 56
 
57
-		if (!$input->getOption('no-update'))
58
-		{
59
-			$modulesUpdated = null;
60
-			while ($module->update($modulesUpdated))
61
-			{
62
-				if (is_array($modulesUpdated))
63
-				{
64
-					foreach ($modulesUpdated as $moduleName => $moduleVersion)
65
-					{
66
-						$output->writeln(sprintf('updated %s to <info>%s</info>', $moduleName, $moduleVersion));
67
-					}
68
-				}
69
-				return $this->restartScript($input, $output);
70
-			}
71
-		}
57
+        if (!$input->getOption('no-update'))
58
+        {
59
+            $modulesUpdated = null;
60
+            while ($module->update($modulesUpdated))
61
+            {
62
+                if (is_array($modulesUpdated))
63
+                {
64
+                    foreach ($modulesUpdated as $moduleName => $moduleVersion)
65
+                    {
66
+                        $output->writeln(sprintf('updated %s to <info>%s</info>', $moduleName, $moduleVersion));
67
+                    }
68
+                }
69
+                return $this->restartScript($input, $output);
70
+            }
71
+        }
72 72
 
73
-		if (!$input->getOption('no-register'))
74
-		{
75
-			try
76
-			{
77
-				$module->register();
78
-			}
79
-			catch (ModuleInstallException $e)
80
-			{
81
-				$output->writeln(sprintf('<comment>%s</comment>', $e->getMessage()), OutputInterface::VERBOSITY_VERBOSE);
82
-				$output->writeln(sprintf('Module loaded, but <error>not registered</error>. You need to do it yourself in admin panel.', $module->getName()));
83
-			}
84
-		}
73
+        if (!$input->getOption('no-register'))
74
+        {
75
+            try
76
+            {
77
+                $module->register();
78
+            }
79
+            catch (ModuleInstallException $e)
80
+            {
81
+                $output->writeln(sprintf('<comment>%s</comment>', $e->getMessage()), OutputInterface::VERBOSITY_VERBOSE);
82
+                $output->writeln(sprintf('Module loaded, but <error>not registered</error>. You need to do it yourself in admin panel.', $module->getName()));
83
+            }
84
+        }
85 85
 
86
-		$output->writeln(sprintf('installed <info>%s</info>', $module->getName()));
86
+        $output->writeln(sprintf('installed <info>%s</info>', $module->getName()));
87 87
 
88
-		return 0;
89
-	}
88
+        return 0;
89
+    }
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
src/Module/Command/UnregisterCommand.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Module\Command;
8 8
 
@@ -17,24 +17,24 @@  discard block
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Module/Command/RemoveCommand.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Module\Command;
8 8
 
@@ -17,24 +17,24 @@  discard block
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Cache/Command/ClearCommand.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Cache\Command;
8 8
 
Please login to merge, or discard this patch.
src/Agent/AgentTrait.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Agent;
8 8
 
Please login to merge, or discard this patch.
src/Agent/Agent.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For the full copyright and license information, please view the LICENSE.md
4
- * file that was distributed with this source code.
5
- */
3
+     * For the full copyright and license information, please view the LICENSE.md
4
+     * file that was distributed with this source code.
5
+     */
6 6
 
7 7
 namespace Notamedia\ConsoleJedi\Agent;
8 8
 
Please login to merge, or discard this patch.