Skip to content

Commit

Permalink
#229 New Command analyse:website
Browse files Browse the repository at this point in the history
  • Loading branch information
nenes25 committed Dec 9, 2021
1 parent 532a864 commit 775b492
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 1 deletion.
154 changes: 154 additions & 0 deletions COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ PrestashopConsole 1.6.3
**analyze:**

* [`analyze:carriers`](#analyzecarriers)
* [`analyze:global`](#analyzeglobal)
* [`analyze:payments`](#analyzepayments)
* [`analyze:website`](#analyzewebsite)

**cache:**

Expand Down Expand Up @@ -627,6 +629,82 @@ Do not ask any interactive question
* Is multiple: no
* Default: `false`

`analyze:global`
----------------

Run a global analysis on the website

### Usage

* `analyze:global`

Run a global analysis on the website

### Options

#### `--help|-h`

Display this help message

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--quiet|-q`

Do not output any message

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--verbose|-v|-vv|-vvv`

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--version|-V`

Display this application version

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--ansi`

Force ANSI output

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--no-ansi`

Disable ANSI output

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--no-interaction|-n`

Do not ask any interactive question

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

`analyze:payments`
------------------

Expand Down Expand Up @@ -703,6 +781,82 @@ Do not ask any interactive question
* Is multiple: no
* Default: `false`

`analyze:website`
-----------------

Get website statistics

### Usage

* `analyze:website`

Get website statistics

### Options

#### `--help|-h`

Display this help message

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--quiet|-q`

Do not output any message

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--verbose|-v|-vv|-vvv`

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--version|-V`

Display this application version

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--ansi`

Force ANSI output

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--no-ansi`

Disable ANSI output

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

#### `--no-interaction|-n`

Do not ask any interactive question

* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`

`cache:clean`
-------------

Expand Down
2 changes: 1 addition & 1 deletion bin/phar/current.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0d6d820447207c1d56e1c3b20ade4a2c3357f342
9d35ab7e4bf5f7bfc6ae3b99bd700416bd6c4f3f
Binary file modified bin/prestashopConsole.phar
Binary file not shown.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#232 Enhancement module:generate:controller
#233 Provide verbose information when module controller is created
#92 Improve module list ( add option to show id )
#229 New Command analyse:website
2021-03-11 - V 1.6.2 : #142 Error when try to start by prestashopConsole command
#170 Create Webservice key command
#173 Change link in readme
Expand Down
114 changes: 114 additions & 0 deletions src/Hhennes/PrestashopConsole/Command/Analyze/GlobalCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php
/**
* Hervé HENNES
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file docs/licenses/LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to contact@h-hennes.fr so we can send you a copy immediately.
*
* @author Hervé HENNES <contact@h-hhennes.fr>
* @copyright since 2021 Hervé HENNES
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License ("AFL") v. 3.0
*/

namespace Hhennes\PrestashopConsole\Command\Analyze;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\ArrayInput;

class GlobalCommand extends Command
{
/**
* @inheritDoc
*/
protected function configure()
{
$this
->setName('analyze:global')
->setDescription('Run a global analysis on the website');
}

/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$commands = $this->getCommandList();
foreach ($commands as $command) {
try {
$output->writeln('<comment>========================</comment>');
$output->writeln('<comment>' . $command['description'] . '</comment>');
$runCommand = $this->getApplication()->find($command['name']);
if (array_key_exists('arguments', $command)) {
$arguments = new ArrayInput($command['arguments']);
$runCommand->run($arguments, $output);
} else {
$runCommand->run($input, $output);
}
} catch (\Exception $e) {
$output->writeln(
sprintf(
'<error>Get exception during command run %s</error>',
$e->getMessage()
)
);
}
}

return 0;
}

/**
* Get the list of commands to execute
* @return array
*/
protected function getCommandList()
{
$commands = [
[
'description' => 'Get website statistics',
'name' => 'analyze:website',
],
[
'description' => 'List installed modules',
'name' => 'module:list',
'arguments' => [
'--active' => true,
]
],
[
'description' => 'List installed modules no natives',
'name' => 'module:list',
'arguments' => [
'--active' => true,
'--no-native' => true,
]
],
[
'description' => 'List installed payments modules',
'name' => 'analyze:payments',
],
[
'description' => 'List installed carriers',
'name' => 'analyze:carriers',
'arguments' => [
'--active' => true,
]
],
[
'description' => 'List overrides of the project',
'name' => 'dev:list-overrides',
],
];

return $commands;
}
}
Loading

0 comments on commit 775b492

Please sign in to comment.