| Conditions | 4 |
| Paths | 4 |
| Total Lines | 31 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 44 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 45 | { |
||
| 46 | $output->writeln([ |
||
| 47 | '<info>Cleaning server resources</info>', |
||
| 48 | '<info>=========================</info>', |
||
| 49 | '', |
||
| 50 | ]); |
||
| 51 | |||
| 52 | $config = $input->getOption('config'); |
||
| 53 | |||
| 54 | if ( ! empty($config)) { |
||
| 55 | Config::set($config); |
||
| 56 | } |
||
| 57 | |||
| 58 | $cacheAdapter = $input->getArgument('cache-adapter') ?? 'file'; |
||
| 59 | |||
| 60 | $this->server = new TusServer(CacheFactory::make($cacheAdapter)); |
||
| 61 | |||
| 62 | $deleted = $this->server->handleExpiration(); |
||
| 63 | |||
| 64 | if (empty($deleted)) { |
||
| 65 | $output->writeln('<comment>Nothing to delete.</comment>'); |
||
| 66 | } else { |
||
| 67 | foreach ($deleted as $key => $item) { |
||
| 68 | $output->writeln('<comment>' . ($key + 1) . ". Deleted {$item['name']} from " . \dirname($item['file_path']) . '</comment>'); |
||
| 69 | } |
||
| 70 | } |
||
| 71 | |||
| 72 | $output->writeln(''); |
||
| 73 | |||
| 74 | return 0; |
||
| 75 | } |
||
| 77 |