| @@ 33-62 (lines=30) @@ | ||
| 30 | parent::__construct('liip:imagine:cache:remove'); |
|
| 31 | } |
|
| 32 | ||
| 33 | protected function configure() |
|
| 34 | { |
|
| 35 | $this |
|
| 36 | ->setDescription('Remove cache for given paths and set of filters.') |
|
| 37 | ->addArgument('paths', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Image paths') |
|
| 38 | ->addOption( |
|
| 39 | 'filters', |
|
| 40 | 'f', |
|
| 41 | InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
| 42 | 'Filters list' |
|
| 43 | ) |
|
| 44 | ->setHelp(<<<'EOF' |
|
| 45 | The <info>%command.name%</info> command removes cache by specified parameters. |
|
| 46 | ||
| 47 | Paths should be separated by spaces: |
|
| 48 | <info>php app/console %command.name% path1 path2</info> |
|
| 49 | All cache for a given `paths` will be lost. |
|
| 50 | ||
| 51 | If you use --filters parameter: |
|
| 52 | <info>php app/console %command.name% --filters=thumb1 --filters=thumb2</info> |
|
| 53 | All cache for a given filters will be lost. |
|
| 54 | ||
| 55 | You can combine these parameters: |
|
| 56 | <info>php app/console %command.name% path1 path2 --filters=thumb1 --filters=thumb2</info> |
|
| 57 | ||
| 58 | <info>php app/console %command.name%</info> |
|
| 59 | Cache for all paths and filters will be lost when executing this command without parameters. |
|
| 60 | EOF |
|
| 61 | ); |
|
| 62 | } |
|
| 63 | ||
| 64 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 65 | { |
|
| @@ 38-71 (lines=34) @@ | ||
| 35 | parent::__construct('liip:imagine:cache:resolve'); |
|
| 36 | } |
|
| 37 | ||
| 38 | protected function configure() |
|
| 39 | { |
|
| 40 | $this |
|
| 41 | ->setDescription('Resolve cache for given path and set of filters.') |
|
| 42 | ->addArgument('paths', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Image paths') |
|
| 43 | ->addOption( |
|
| 44 | 'filters', |
|
| 45 | 'f', |
|
| 46 | InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
| 47 | 'Filters list' |
|
| 48 | )->setHelp(<<<'EOF' |
|
| 49 | The <info>%command.name%</info> command resolves cache by specified parameters. |
|
| 50 | It returns list of urls. |
|
| 51 | ||
| 52 | <info>php app/console %command.name% path1 path2 --filters=thumb1</info> |
|
| 53 | Cache for this two paths will be resolved with passed filter. |
|
| 54 | As a result you will get<info> |
|
| 55 | http://localhost/media/cache/thumb1/path1 |
|
| 56 | http://localhost/media/cache/thumb1/path2</info> |
|
| 57 | ||
| 58 | You can pass few filters: |
|
| 59 | <info>php app/console %command.name% path1 --filters=thumb1 --filters=thumb2</info> |
|
| 60 | As a result you will get<info> |
|
| 61 | http://localhost/media/cache/thumb1/path1 |
|
| 62 | http://localhost/media/cache/thumb2/path1</info> |
|
| 63 | ||
| 64 | If you omit --filters parameter then to resolve given paths will be used all configured and available filters in application: |
|
| 65 | <info>php app/console %command.name% path1</info> |
|
| 66 | As a result you will get<info> |
|
| 67 | http://localhost/media/cache/thumb1/path1 |
|
| 68 | http://localhost/media/cache/thumb2/path1</info> |
|
| 69 | EOF |
|
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 74 | { |
|