Sindbad~EG File Manager
<?php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class OpenrestyPurge extends BaseCommand
{
protected static $defaultName = 'openresty:purge';
protected function configure(){
$this
->setDescription("Purge the OpenResty internal cache used to store SSL file and proxypass data")
->setHelp("This command will purge the OpenResty internal (in memory) cache used to stored encoded
SSL file and ProxyPass data. It does not change/refresh the data inside the redis DB.
It will force OpenResty to re-query the Redis DB which is our source of truth.")
->addArgument('domain', InputArgument::OPTIONAL, "The domain to purge. If not provided, purge everything", false);
}
protected function execute(InputInterface $input, OutputInterface $output){
if($input->getArgument('domain') !== false){
$r = $this->openrestyApiClient->purgeDomain($input->getArgument('domain'));
if($output->isVerbose()){
$output->writeln("Api response = " . $this->openrestyApiClient->getLastRawResponse());
}
if($r === true){
$output->writeln("OpenResty internal cache purged for the domain : " . $input->getArgument('domain'));
return Command::SUCCESS;
}
$this->writeError($output, "OpenResty internal cache not purge, unexpected return.", BaseCommand::RETURN_GENERIC_ERR);
}
$r = $this->openrestyApiClient->purge();
if($output->isVerbose()){
$output->writeln("Api response = " . $this->openrestyApiClient->getLastRawResponse());
}
if($r === true){
$output->writeln("OpenResty internal cache purged");
return Command::SUCCESS;
}
$this->writeError($output, "OpenResty internal cache not purge", BaseCommand::RETURN_GENERIC_ERR);
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists