| @@ 14-44 (lines=31) @@ | ||
| 11 | ||
| 12 | class RemoveCacheCommand extends ContainerAwareCommand |
|
| 13 | { |
|
| 14 | protected function configure() |
|
| 15 | { |
|
| 16 | $this |
|
| 17 | ->setName('liip:imagine:cache:remove') |
|
| 18 | ->setDescription('Remove cache for given paths and set of filters.') |
|
| 19 | ->addArgument('paths', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Image paths') |
|
| 20 | ->addOption( |
|
| 21 | 'filters', |
|
| 22 | 'f', |
|
| 23 | InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
| 24 | 'Filters list' |
|
| 25 | ) |
|
| 26 | ->setHelp(<<<'EOF' |
|
| 27 | The <info>%command.name%</info> command removes cache by specified parameters. |
|
| 28 | ||
| 29 | Paths should be separated by spaces: |
|
| 30 | <info>php app/console %command.name% path1 path2</info> |
|
| 31 | All cache for a given `paths` will be lost. |
|
| 32 | ||
| 33 | If you use --filters parameter: |
|
| 34 | <info>php app/console %command.name% --filters=thumb1 --filters=thumb2</info> |
|
| 35 | All cache for a given filters will be lost. |
|
| 36 | ||
| 37 | You can combine these parameters: |
|
| 38 | <info>php app/console %command.name% path1 path2 --filters=thumb1 --filters=thumb2</info> |
|
| 39 | ||
| 40 | <info>php app/console %command.name%</info> |
|
| 41 | Cache for all paths and filters will be lost when executing this command without parameters. |
|
| 42 | EOF |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | ||
| 46 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 47 | { |
|
| @@ 16-50 (lines=35) @@ | ||
| 13 | ||
| 14 | class ResolveCacheCommand extends ContainerAwareCommand |
|
| 15 | { |
|
| 16 | protected function configure() |
|
| 17 | { |
|
| 18 | $this |
|
| 19 | ->setName('liip:imagine:cache:resolve') |
|
| 20 | ->setDescription('Resolve cache for given path and set of filters.') |
|
| 21 | ->addArgument('paths', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Image paths') |
|
| 22 | ->addOption( |
|
| 23 | 'filters', |
|
| 24 | 'f', |
|
| 25 | InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
| 26 | 'Filters list' |
|
| 27 | )->setHelp(<<<'EOF' |
|
| 28 | The <info>%command.name%</info> command resolves cache by specified parameters. |
|
| 29 | It returns list of urls. |
|
| 30 | ||
| 31 | <info>php app/console %command.name% path1 path2 --filters=thumb1</info> |
|
| 32 | Cache for this two paths will be resolved with passed filter. |
|
| 33 | As a result you will get<info> |
|
| 34 | http://localhost/media/cache/thumb1/path1 |
|
| 35 | http://localhost/media/cache/thumb1/path2</info> |
|
| 36 | ||
| 37 | You can pass few filters: |
|
| 38 | <info>php app/console %command.name% path1 --filters=thumb1 --filters=thumb2</info> |
|
| 39 | As a result you will get<info> |
|
| 40 | http://localhost/media/cache/thumb1/path1 |
|
| 41 | http://localhost/media/cache/thumb2/path1</info> |
|
| 42 | ||
| 43 | If you omit --filters parameter then to resolve given paths will be used all configured and available filters in application: |
|
| 44 | <info>php app/console %command.name% path1</info> |
|
| 45 | As a result you will get<info> |
|
| 46 | http://localhost/media/cache/thumb1/path1 |
|
| 47 | http://localhost/media/cache/thumb2/path1</info> |
|
| 48 | EOF |
|
| 49 | ); |
|
| 50 | } |
|
| 51 | ||
| 52 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 53 | { |
|