PHOENIX-MEDIA / Magento-PageCache-powered-by-Varnish

Community version which is available on Magento Connect (http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html)
89 stars 49 forks source link

Missing Singleton VCL #5

Closed franklinkim closed 10 years ago

franklinkim commented 10 years ago

There's a missing singleton class call Mage::getSingleton('varnishcacheenterprise/vcl') in the app/code/community/Phoenix/VarnishCache/Model/Observer.php file.


    /**
     * Shows notice to update Varnish VCL file
     *
     * @param Varien_Event_Observer $observer
     * @return Phoenix_VarnishCache_Model_Observer
     */
    public function showVclUpdateMessage(Varien_Event_Observer $observer)
    {
        try {
            Mage::getSingleton('core/session')->addNotice(
                Mage::helper('varnishcache')->__(
                    'Update Varnish VCL with design exceptions by using the following snippet:'
                )
            );

            // THIS DOES NOT EXIST
            $designExceptionSubSnippet = Mage::getSingleton('varnishcacheenterprise/vcl')
                ->generateDesignExceptionSub();

            $designExceptionSubSnippet = str_replace(' ', ' ', $designExceptionSubSnippet);
            $designExceptionSubSnippet = nl2br($designExceptionSubSnippet);

            Mage::getSingleton('core/session')->addNotice($designExceptionSubSnippet);
        } catch (Exception $e) {
            $msg = 'Failed to prepare vcl: '.$e->getMessage();
            Mage::helper('varnishcache')->debug($msg);
            Mage::throwException($msg);
        }

        return $this;
    }
PHOENIX-MEDIA commented 10 years ago

This issue should be fixed in the latest version we pushed last week. Can you confirm?

franklinkim commented 9 years ago

hi, sorry, hadn't had time to validate it till now but i can confirm that it works! thx

avra911 commented 8 years ago

I don't think the module Mage::getSingleton('varnishcache/vcl') exists either

cc @franklinkim