vendor/tigermedia/tigerdiagnostics/src/Subscriber/InfoSubscriber.php line 27

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace TigerMedia\General\TigerDiagnostics\Subscriber;
  3. use Shopware\Core\Content\Product\ProductEntity;
  4. use Shopware\Core\Framework\Event\BeforeSendResponseEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Symfony\Component\HttpFoundation\RedirectResponse;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\HttpKernel\Event\ControllerEvent;
  9. use Symfony\Component\HttpKernel\KernelEvents;
  10. use TigerMedia\General\TigerDiagnostics\Utilities\Utilities;
  11. class InfoSubscriber implements EventSubscriberInterface
  12. {
  13.     public function __construct()
  14.     {
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             KernelEvents::CONTROLLER => ['onNewRequest'1],
  20.         ];
  21.     }
  22.     public function onNewRequest(ControllerEvent $event)
  23.     {
  24.         if (Utilities::isDevelopmentEnv() || Utilities::isTiger()) {
  25.             if (isset($_GET['phpinfo'])) {
  26.                 phpinfo();
  27.                 exit;
  28.             }
  29.             if (isset($_GET['opcache'])) {
  30.                 echo "<pre>";
  31.                 print_r(opcache_get_status(false));
  32.                 echo "</pre>";
  33.                 exit;
  34.             }
  35.             if (isset($_GET['reset_opcache'])) {
  36.                 echo "Resetting opcache..<br/>";
  37.                 opcache_reset();
  38.                 die("Done");
  39.             }
  40.             if (isset($_GET['clearstatcache'])) {
  41.                 echo "clearstatcache();";
  42.                 clearstatcache();
  43.                 exit;
  44.             }
  45.         }
  46.     }
  47. }