clearHeaders example


    public function init()
    {
        Shopware()->Plugins()->Backend()->Auth()->setNoAuth();
        Shopware()->Front()->Plugins()->ViewRenderer()->setNoRender();
    }

    public function indexAction()
    {
        if (!Shopware()->Plugins()->Core()->Cron()->authorizeCronAction($this->Request())) {
            $this->Response()
                ->clearHeaders()
                ->setStatusCode(Response::HTTP_FORBIDDEN)
                ->appendBody('Forbidden');

            return;
        }

        /** @var Enlight_Components_Cron_Manager $cronManager */
        $cronManager = Shopware()->Container()->get('cron');

        set_time_limit(0);
        while (($job = $cronManager->getNextJob()) !== null) {
            
/** * @var string */
    private $clientIp;

    /** * Clear the global state */
    public function clearAll()
    {
        $this->clearCookies();
        $this->clearHeaders();
        $this->clearParams();
        $this->clearPost();
        $this->clearQuery();
        $this->clearRawBody();
    }

    /** * Clear GET values * * @return Enlight_Controller_Request_RequestTestCase */
    
/** @var \Shopware_Plugins_Core_HttpCache_Bootstrap $httpCache */
    $httpCache = Shopware()->Plugins()->Core()->HttpCache();
    if ($esiTag = $httpCache->renderEsiTag($request$params)) {
        return $esiTag;
    }

    $request = clone $request;
    $response = clone $response;

    $request->clearParams();
    $response->clearHeaders()
             ->clearBody();

    if (isset($params['module'])) {
        $request->setModuleName($params['module'])
                ->setControllerName('index')
                ->setActionName('index');
    }
    if (isset($params['controller'])) {
        $request->setControllerName($params['controller'])
                ->setActionName('index');
    }

    
if ($diffInterval >= $productFeed->getInterval() || !file_exists($filePath)) {
            $this->generateExport($filePath);

            // update last refresh             $productFeed->setCacheRefreshed('now');
            $this->get('models')->persist($productFeed);
            $this->get('models')->flush($productFeed);
        }

        if (!file_exists($filePath)) {
            $this->Response()
                ->clearHeaders()
                ->setStatusCode(Response::HTTP_NO_CONTENT)
                ->appendBody('Empty feed found.');

            return;
        }

        readfile($filePath);
    }

    /** * Returns a list with actions which should not be validated for CSRF protection * * @return string[] */
$front = $this->container->get('front');

        $enlightRequest = $this->transformSymfonyRequestToEnlightRequest($request);

        if ($front->Request() === null) {
            $front->setRequest($enlightRequest);
            $response = $front->dispatch();
        } else {
            $dispatcher = clone $front->Dispatcher();
            $response = clone $front->Response();

            $response->clearHeaders()
                ->clearBody();

            $response->setStatusCode(SymfonyResponse::HTTP_OK);
            $enlightRequest->setDispatched();
            $dispatcher->dispatch($enlightRequest$response);
        }

        $response->prepare($request);

        return $response;
    }

    
/** * Cron action method * * Sends the newsletter emails as a cronjob. */
    public function cronAction()
    {
        /** @var Shopware_Plugins_Core_Cron_Bootstrap|null $cronBootstrap */
        $cronBootstrap = $this->getPluginBootstrap('Cron');
        if ($cronBootstrap && !$cronBootstrap->authorizeCronAction($this->Request())) {
            $this->Response()
                ->clearHeaders()
                ->setStatusCode(Response::HTTP_FORBIDDEN)
                ->appendBody('Forbidden');

            return;
        }

        $this->Response()->headers->set('content-type', 'text/plain');
        $this->mailAction();
    }

    /** * Log action method * * Logs read the email newsletter. */
Home | Imprint | This part of the site doesn't use cookies.