Sindbad~EG File Manager
<?php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\LockableTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ParseUserdata extends BaseCommand
{
protected static $defaultName = 'parse:userdata';
use LockableTrait;
protected function configure(){
$this
->setDescription("Parse the cPanel userdata and display what is returned")
->addArgument('outputFormat', InputArgument::OPTIONAL, "Output format desired (json, dump)", "dump");
}
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$this->lock()) {
$output->writeln('The command is already running in another process.');
return 0;
}
if(!$this->cpanelUserdataParser->parse()){
$this->writeErrorAndDie($output, "Error while parsing the cPanel userdata", BaseCommand::RETURN_PARSE_ERR);
}
$cpUserdata = $this->cpanelUserdataParser->getData();
if ($output->isVerbose()) {
$output->writeln("cPanel userdata parsed !");
}
if($input->getArgument('outputFormat') === 'dump'){
dump($cpUserdata);
} else {
echo json_encode($cpUserdata);
}
return Command::SUCCESS;
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists