<?php declare(strict_types=1);
namespace TigerMedia\General\TigerDiagnostics\Subscriber;
use Shopware\Core\Content\Product\ProductEntity;
use Shopware\Core\Framework\Event\BeforeSendResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use TigerMedia\General\TigerDiagnostics\Utilities\Utilities;
class InfoSubscriber implements EventSubscriberInterface
{
public function __construct()
{
}
public static function getSubscribedEvents(): array
{
return [
KernelEvents::CONTROLLER => ['onNewRequest', 1],
];
}
public function onNewRequest(ControllerEvent $event)
{
if (Utilities::isDevelopmentEnv() || Utilities::isTiger()) {
if (isset($_GET['phpinfo'])) {
phpinfo();
exit;
}
if (isset($_GET['opcache'])) {
echo "<pre>";
print_r(opcache_get_status(false));
echo "</pre>";
exit;
}
if (isset($_GET['reset_opcache'])) {
echo "Resetting opcache..<br/>";
opcache_reset();
die("Done");
}
if (isset($_GET['clearstatcache'])) {
echo "clearstatcache();";
clearstatcache();
exit;
}
}
}
}