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