PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.1
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.1
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / classes / CLI / GenerateMissingWebpCommand.php

GenerateMissingWebpCommand.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.1, at classes/CLI/GenerateMissingWebpCommand.php

53 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 WebP generation
10 */
11 class GenerateMissingWebpCommand 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_webp( $arguments );
20
21 \WP_CLI::log( 'Imagify missing WebP generation triggered.' );
22 }
23
24 /**
25 * {@inheritdoc}
26 */
27 protected function get_command_name(): string {
28 return 'generate-missing-webp';
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 public function get_description(): string {
35 return 'Run the generation of the missing WebP 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 WebP generation for. Possible values are wp and custom-folders.',
47 'optional' => false,
48 'repeating' => true,
49 ],
50 ];
51 }
52 }
53