<?php
namespace App\Controller;
use App\Entity\SiteBannedIps;
use App\Form\BannedIpsForm;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Form\Filters\BannedIpFilter;
use App\Repository\ExportFilesRepository;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
#[Route('/test')]
class TestController extends AbstractController
{
#[Route('/command', name: 'test_command', methods: ['GET', 'POST'])]
public function testCommand(Request $request, \Symfony\Component\HttpKernel\KernelInterface $kernel){
try{
$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
$application->setAutoExit(false);
$input = new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'app:export-files'
]);
$output = new \Symfony\Component\Console\Output\BufferedOutput();
$application->run($input, $output);
$content = $output->fetch();
return new \Symfony\Component\HttpFoundation\Response($content);
}catch(\Exception $e){
echo "<pre>";
print_r($e);exit;
}
}
}