| 1 |
<?php |
| 2 |
declare(strict_types=1); |
| 3 |
|
| 4 |
namespace Imagify\CLI; |
| 5 |
|
| 6 |
use Imagify\Bulk\Bulk; |
| 7 |
|
| 8 |
/** |
| 9 |
* Command class for the missing Nextgen generation |
| 10 |
*/ |
| 11 |
class GenerateMissingNextgenCommand extends AbstractCommand { |
| 12 |
/** |
| 13 |
* Executes the command. |
| 14 |
* |
| 15 |
* @param array $arguments Positional argument. |
| 16 |
* @param array $options Optional arguments. |
| 17 |
*/ |
| 18 |
public function __invoke( $arguments, $options ) { |
| 19 |
Bulk::get_instance()->run_generate_nextgen( $arguments ); |
| 20 |
|
| 21 |
\WP_CLI::log( 'Imagify missing next-gen images generation triggered.' ); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* {@inheritdoc} |
| 26 |
*/ |
| 27 |
protected function get_command_name(): string { |
| 28 |
return 'generate-missing-nextgen'; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* {@inheritdoc} |
| 33 |
*/ |
| 34 |
public function get_description(): string { |
| 35 |
return 'Run the generation of the missing next-gen images versions'; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* {@inheritdoc} |
| 40 |
*/ |
| 41 |
public function get_synopsis(): array { |
| 42 |
return [ |
| 43 |
[ |
| 44 |
'type' => 'positional', |
| 45 |
'name' => 'contexts', |
| 46 |
'description' => 'The context(s) to run the missing next-gen images generation for. Possible values are wp and custom-folders.', |
| 47 |
'optional' => false, |
| 48 |
'repeating' => true, |
| 49 |
], |
| 50 |
]; |
| 51 |
} |
| 52 |
} |
| 53 |
|