Quantcast
Channel: Magento – Ken Nguyen
Viewing all articles
Browse latest Browse all 14

How to check Full Page Cache is working?

$
0
0

You need ope file and insert the log scripts:

/app/code/core/Mage/Core/Model/App.php

public function run($params)
    {

        $base_url = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 'https' : 'http' ) . '://' .  $_SERVER['HTTP_HOST'];
        $url = $base_url . $_SERVER["REQUEST_URI"];
        $options = isset($params['options']) ? $params['options'] : array();
        $this->baseInit($options);
        Mage::register('application_params', $params);

        if ($this->_cache->processRequest()) {

            file_put_contents('url_have_fpc.txt', date("H:i:s")." URL: $url \n",FILE_APPEND);
            $this->getResponse()->sendResponse();
            
        } else {
            file_put_contents('url_non_fpc.txt', date("H:i:s")." URL: $url \n",FILE_APPEND);
            
            $this->_initModules();
            $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);

            if ($this->_config->isLocalConfigLoaded()) {
                $scopeCode = isset($params['scope_code']) ? $params['scope_code'] : '';
                $scopeType = isset($params['scope_type']) ? $params['scope_type'] : 'store';
                $this->_initCurrentStore($scopeCode, $scopeType);
                $this->_initRequest();
                Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
            }

            $this->getFrontController()->dispatch();
        }
        return $this;
    }

Or change this file

/app/code/core/Enterprise/PageCache/Model/Processor.php

// XSS vulnerability protection provided by htmlspcialchars call - escape & " ' < > chars
Enterprise_PageCache_Helper_Url::restoreSid($content, htmlspecialchars($sidCookieValue, ENT_QUOTES));
$base_url = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 'https' : 'http' ) . '://' .  $_SERVER['HTTP_HOST'];
$url = $base_url . $_SERVER["REQUEST_URI"];
if ($isProcessed) {
    file_put_contents('z_url_have_fpc.txt', date("H:i:s")." URL: $url \n",FILE_APPEND);
    return $content;
} else {
     file_put_contents('z_url_non_fpc.txt', date("H:i:s")." URL: $url \n",FILE_APPEND);
    Mage::register('cached_page_content', $content);
    Mage::register('cached_page_containers', $containers);
    Mage::app()->getRequest()
        ->setModuleName('pagecache')
        ->setControllerName('request')
        ->setActionName('process')
        ->isStraight(true);

    // restore original routing info
    $routingInfo = array(
        'aliases'              => $this->getMetadata('routing_aliases'),
        'requested_route'      => $this->getMetadata('routing_requested_route'),
        'requested_controller' => $this->getMetadata('routing_requested_controller'),
        'requested_action'     => $this->getMetadata('routing_requested_action')
    );

    Mage::app()->getRequest()->setRoutingInfo($routingInfo);
    return false;
}

 


Viewing all articles
Browse latest Browse all 14

Trending Articles