| @@ 69-92 (lines=24) @@ | ||
| 66 | * |
|
| 67 | * @return null |
|
| 68 | */ |
|
| 69 | public function flushPartialAction() { |
|
| 70 | $postData = $this->getRequest()->getPost(); |
|
| 71 | if ( ! isset($postData['pattern'])) { |
|
| 72 | $this->_getSession()->addError($this->__('Missing URL post data')); |
|
| 73 | } else { |
|
| 74 | $pattern = $postData['pattern']; |
|
| 75 | Mage::dispatchEvent('turpentine_varnish_flush_partial', |
|
| 76 | array('pattern' => $pattern)); |
|
| 77 | $result = Mage::getModel('turpentine/varnish_admin') |
|
| 78 | ->flushUrl($pattern); |
|
| 79 | foreach ($result as $name => $value) { |
|
| 80 | if ($value === true) { |
|
| 81 | $this->_getSession() |
|
| 82 | ->addSuccess(Mage::helper('turpentine/data') |
|
| 83 | ->__('Flushed matching URLs for: ').$name); |
|
| 84 | } else { |
|
| 85 | $this->_getSession() |
|
| 86 | ->addError(Mage::helper('turpentine/data') |
|
| 87 | ->__('Error flushing matching URLs on: ').$name); |
|
| 88 | } |
|
| 89 | } |
|
| 90 | } |
|
| 91 | $this->_redirect('*/cache'); |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Flush objects by content type (ctype in POST) |
|
| @@ 99-122 (lines=24) @@ | ||
| 96 | * |
|
| 97 | * @return null |
|
| 98 | */ |
|
| 99 | public function flushContentTypeAction() { |
|
| 100 | $postData = $this->getRequest()->getPost(); |
|
| 101 | if ( ! isset($postData['ctype'])) { |
|
| 102 | $this->_getSession()->addError($this->__('Missing URL post data')); |
|
| 103 | } else { |
|
| 104 | $ctype = $postData['ctype']; |
|
| 105 | Mage::dispatchEvent('turpentine_varnish_flush_content_type', |
|
| 106 | array('ctype' => $ctype)); |
|
| 107 | $result = Mage::getModel('turpentine/varnish_admin') |
|
| 108 | ->flushContentType($ctype); |
|
| 109 | foreach ($result as $name => $value) { |
|
| 110 | if ($value === true) { |
|
| 111 | $this->_getSession() |
|
| 112 | ->addSuccess(Mage::helper('turpentine/data') |
|
| 113 | ->__('Flushed matching content-types for: ').$name); |
|
| 114 | } else { |
|
| 115 | $this->_getSession() |
|
| 116 | ->addError(Mage::helper('turpentine/data') |
|
| 117 | ->__('Error flushing matching content-types on: ').$name); |
|
| 118 | } |
|
| 119 | } |
|
| 120 | } |
|
| 121 | $this->_redirect('*/cache'); |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * Load the current VCL in varnish and activate it |
|