*/ class ClearCacheCommand extends BaseCommand { protected function configure(): void { $this ->setName('clear-cache') ->setAliases(['clearcache', 'cc']) ->setDescription('Clears composer\'s internal package cache') ->setDefinition([ new InputOption('gc', null, InputOption::VALUE_NONE, 'Only run garbage collection, not a full cache clear'), ]) ->setHelp( "The clear-cache deletes all cached packages from composer's\ncache directory.\n\nRead more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc" ) ; } protected function execute(InputInterface $input, OutputInterface $output): int { $config = Factory::createConfig(); $io = $this->getIO(); $cachePaths = [ 'cache-vcs-dir' => $config->get('cache-vcs-dir'), 'cache-repo-dir' => $config->get('cache-repo-dir'), 'cache-files-dir' => $config->get('cache-files-dir'), 'cache-dir' => $config->get('cache-dir'), ]; foreach ($cachePaths as $key => $cachePath) { // only individual dirs get garbage collected if ($key === 'cache-dir' && $input->getOption('gc')) { continue; } $cachePath = realpath($cachePath); if (!$cachePath) { $io->writeError("Cache directory does not exist ($key): $cachePath"); continue; } $cache = new Cache($io, $cachePath); $cache->setReadOnly($config->get('cache-read-only')); if (!$cache->isEnabled()) { $io->writeError("Cache is not enabled ($key): $cachePath"); continue; } if ($input->getOption('gc')) { $io->writeError("Garbage-collecting cache ($key): $cachePath"); if ($key === 'cache-files-dir') { $cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize')); } elseif ($key === 'cache-repo-dir') { $cache->gc($config->get('cache-ttl'), 1024 * 1024 * 1024 /* 1GB, this should almost never clear anything that is not outdated */); } elseif ($key === 'cache-vcs-dir') { $cache->gcVcsCache($config->get('cache-ttl')); } } else { $io->writeError("Clearing cache ($key): $cachePath"); $cache->clear(); } } if ($input->getOption('gc')) { $io->writeError('All caches garbage-collected.'); } else { $io->writeError('All caches cleared.'); } return 0; } } __halt_compiler();----SIGNATURE:----DrWA+3T+Q1Ieq6KdW/QQltXCREwceBDxR8Ho5ZEDXNvK1Bufe4KIUc/XbZgfZPltj/Sk+PydceQReBt2dHVazmhQLHuQf0DyV+Z1dc1Jo0DZWMgCHeZK+fv66Sx0iAj+jTY/WaHSHEiYA00avr4FW1XV/wkxj2lVOBZnyPUzQIHRoykWTqMDP4bzEY1FbdGz7+tB0/df/ceQ+aMmP7RQ65iBnesd4UtC4ejd0uELlVmySuPcIqGXBCU9wKJyvViHJviRAfoQuFkBOn1Brn13hMfgj1TlH48AmE1ChGh5Bx5cHSplnV5VAjYTvbV2+985E7Vczbd+eMrsMgNFKAiLTaHb0KAiNoCZNZjsriASQ1qhoT7JZ9nbvk2N0tpRkr34Kvy0Pr3CNVOxlmm2UHPIJKjTL+XYEYycFrfGRnO4X4j+m9Guv++qGrkjNEhp05oHwHP96fdMpXJbwXaGE1j3IFZf36uaGuG5F/KRmFX8Ev5cK2Tll96iuodtli55bv5cfapAKXUX5cJCEjGQq9jeNk8BC6KSmWBr0XyNXKNxKQnH+NQwmu0Q4oNeomj6fV3/dv40rmQH8SQ3x2nyHDzOVsR+CuU+sU8Hi4x/jBoPjLlsVz0qM+iOmB3/0pgsmpz0lkp0MiE0sQEz4frP8DW4PxH+a6axRK39VjxEIySiDNE=----ATTACHMENT:----ODEwOTc0ODcxOTIwNDkxOSA4Mjg3Njg5Mjc5NDMyMDA4IDMwMTAyMjg2NDUyMDIyMjk=