Skip to content

Commit

Permalink
feat: dump
Browse files Browse the repository at this point in the history
  • Loading branch information
SocolaDaiCa committed Sep 4, 2023
1 parent ac3c705 commit bf58853
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@
use App\Service\Scheduler;
use App\Util\UserAgentParser;
use Composer\Pcre\Preg;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Graze\DogStatsD\Client as StatsDClient;
Expand Down Expand Up @@ -441,6 +446,15 @@ protected function receivePost(Request $request, string $url, string $urlRegex,

$this->getEM()->flush();

$process = new Process(['../bin/console', 'packagist:dump-v2']);
// Run the command
$process->run();

// Check if the command was successful
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}

return new JsonResponse(['status' => 'success', 'jobs' => $jobs, 'type' => $receiveType], 202);
}

Expand Down

0 comments on commit bf58853

Please sign in to comment.