CacheFill_Connector - Version 2.0.5

Version Notes

CACHE FILL fills your cache and speeds up all pages of your website with a CACHE FILL subscription.

Download this release

Release Info

Developer Magento Core Team
Extension CacheFill_Connector
Version 2.0.5
Comparing to
See all releases


Code changes from version 2.0.4 to 2.0.5

app/code/community/Cachefill/Connector/Block/Adminhtml/System/Config/Login.php CHANGED
@@ -1,73 +1,73 @@
1
- <?php
2
- /**
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- */
12
-
13
- class Cachefill_Connector_Block_Adminhtml_System_Config_Login extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
-
15
- protected function _toHtml() {
16
- $htmlId = $this->getHtmlId();
17
- $ajaxUrl = $this->getAjaxUrl();
18
- $buttonLabel = $this->escapeHtml($this->getButtonLabel());
19
-
20
- $htmlContent = <<< HTML_CONTENT
21
- <script type="text/javascript">
22
- function ajaxLogin() {
23
- var elem = $('$htmlId');
24
-
25
- params = {
26
- username: $('cfconnector_general_username').value,
27
- password: $('cfconnector_general_password').value
28
- };
29
-
30
- new Ajax.Request('$ajaxUrl', {
31
- parameters: params,
32
- onSuccess: function(response) {
33
- result = 'Login failed!';
34
- try {
35
- response = JSON.parse(response.responseText);
36
- result = response.message;
37
- if (response.status == 1) {
38
- elem.removeClassName('fail').addClassName('success');
39
- } else {
40
- elem.removeClassName('success').addClassName('fail');
41
- }
42
- } catch (e) {
43
- elem.removeClassName('success').addClassName('fail');
44
- }
45
- $('ajax_login_result').update(result);
46
- }
47
- });
48
- }
49
- </script>
50
- <button onclick="javascript:ajaxLogin(); return false;" class="scalable" type="button" id="$htmlId">
51
- <span><span><span id="ajax_login_result">$buttonLabel</span></span></span>
52
- </button>
53
- HTML_CONTENT;
54
-
55
- return $htmlContent;
56
- }
57
-
58
- public function render(Varien_Data_Form_Element_Abstract $element){
59
- $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
60
- return parent::render($element);
61
- }
62
-
63
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
64
- $originalData = $element->getOriginalData();
65
- $this->addData(array(
66
- 'button_label' => Mage::helper('cfconnector')->__($originalData['button_label']),
67
- 'html_id' => $element->getHtmlId(),
68
- 'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/system_config_ajax/login')
69
- ));
70
-
71
- return $this->_toHtml();
72
- }
73
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ */
12
+
13
+ class Cachefill_Connector_Block_Adminhtml_System_Config_Login extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
+
15
+ protected function _toHtml() {
16
+ $htmlId = $this->getHtmlId();
17
+ $ajaxUrl = $this->getAjaxUrl();
18
+ $buttonLabel = $this->escapeHtml($this->getButtonLabel());
19
+
20
+ $htmlContent = <<< HTML_CONTENT
21
+ <script type="text/javascript">
22
+ function ajaxLogin() {
23
+ var elem = $('$htmlId');
24
+
25
+ params = {
26
+ username: $('cfconnector_general_username').value,
27
+ password: $('cfconnector_general_password').value
28
+ };
29
+
30
+ new Ajax.Request('$ajaxUrl', {
31
+ parameters: params,
32
+ onSuccess: function(response) {
33
+ result = 'Login failed!';
34
+ try {
35
+ response = JSON.parse(response.responseText);
36
+ result = response.message;
37
+ if (response.status == 1) {
38
+ elem.removeClassName('fail').addClassName('success');
39
+ } else {
40
+ elem.removeClassName('success').addClassName('fail');
41
+ }
42
+ } catch (e) {
43
+ elem.removeClassName('success').addClassName('fail');
44
+ }
45
+ $('ajax_login_result').update(result);
46
+ }
47
+ });
48
+ }
49
+ </script>
50
+ <button onclick="javascript:ajaxLogin(); return false;" class="scalable" type="button" id="$htmlId">
51
+ <span><span><span id="ajax_login_result">$buttonLabel</span></span></span>
52
+ </button>
53
+ HTML_CONTENT;
54
+
55
+ return $htmlContent;
56
+ }
57
+
58
+ public function render(Varien_Data_Form_Element_Abstract $element){
59
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
60
+ return parent::render($element);
61
+ }
62
+
63
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
64
+ $originalData = $element->getOriginalData();
65
+ $this->addData(array(
66
+ 'button_label' => Mage::helper('cfconnector')->__($originalData['button_label']),
67
+ 'html_id' => $element->getHtmlId(),
68
+ 'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/system_config_ajax/login')
69
+ ));
70
+
71
+ return $this->_toHtml();
72
+ }
73
  }
app/code/community/Cachefill/Connector/Block/Adminhtml/System/Config/Startnew.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
- /**
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- */
12
-
13
- class Cachefill_Connector_Block_Adminhtml_System_Config_Startnew extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
-
15
- protected function _toHtml() {
16
- $htmlId = $this->getHtmlId();
17
- $ajaxUrl = $this->getAjaxUrl();
18
- $buttonLabel = $this->escapeHtml($this->getButtonLabel());
19
- $accessKey = Mage::helper('cfconnector')->getAccessKey();
20
- if(!$accessKey){
21
- return "";
22
- }
23
-
24
- $startRemoteUrl = Mage::helper('cfconnector')->getStartRemoteUrl();
25
- $htmlContent = <<< HTML_CONTENT
26
- <button onclick="setLocation('$startRemoteUrl')" class="scalable" type="button" id="$htmlId">
27
- <span><span><span>$buttonLabel</span></span></span>
28
- </button>
29
- HTML_CONTENT;
30
-
31
- return $htmlContent;
32
- }
33
-
34
- public function render(Varien_Data_Form_Element_Abstract $element){
35
- $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
36
- return parent::render($element);
37
- }
38
-
39
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
40
- $originalData = $element->getOriginalData();
41
- $this->addData(array(
42
- 'button_label' => Mage::helper('cfconnector')->__($originalData['button_label']),
43
- 'html_id' => $element->getHtmlId()
44
- ));
45
- return $this->_toHtml();
46
- }
47
-
48
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ */
12
+
13
+ class Cachefill_Connector_Block_Adminhtml_System_Config_Startnew extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
+
15
+ protected function _toHtml() {
16
+ $htmlId = $this->getHtmlId();
17
+ $ajaxUrl = $this->getAjaxUrl();
18
+ $buttonLabel = $this->escapeHtml($this->getButtonLabel());
19
+ $accessKey = Mage::helper('cfconnector')->getAccessKey();
20
+ if(!$accessKey){
21
+ return "";
22
+ }
23
+
24
+ $startRemoteUrl = Mage::helper('cfconnector')->getStartRemoteUrl();
25
+ $htmlContent = <<< HTML_CONTENT
26
+ <button onclick="setLocation('$startRemoteUrl')" class="scalable" type="button" id="$htmlId">
27
+ <span><span><span>$buttonLabel</span></span></span>
28
+ </button>
29
+ HTML_CONTENT;
30
+
31
+ return $htmlContent;
32
+ }
33
+
34
+ public function render(Varien_Data_Form_Element_Abstract $element){
35
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
36
+ return parent::render($element);
37
+ }
38
+
39
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
40
+ $originalData = $element->getOriginalData();
41
+ $this->addData(array(
42
+ 'button_label' => Mage::helper('cfconnector')->__($originalData['button_label']),
43
+ 'html_id' => $element->getHtmlId()
44
+ ));
45
+ return $this->_toHtml();
46
+ }
47
+
48
  }
app/code/community/Cachefill/Connector/Block/Adminhtml/System/Config/Viewlast.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php
2
- /**
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- */
12
-
13
- class Cachefill_Connector_Block_Adminhtml_System_Config_Viewlast extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
-
15
- protected function _toHtml() {
16
- $htmlId = $this->getHtmlId();
17
- $ajaxUrl = $this->getAjaxUrl();
18
- $buttonLabel = $this->escapeHtml($this->getButtonLabel());
19
- $accessKey = Mage::helper('cfconnector')->getAccessKey();
20
- if(!$accessKey){
21
- return "";
22
- }
23
-
24
- $lastResultUrl = Mage::helper('cfconnector')->getLastResultUrl();
25
- if(!$lastResultUrl){
26
- return "";
27
- }
28
-
29
-
30
- $htmlContent = <<< HTML_CONTENT
31
- <button onclick="window.open('$lastResultUrl', '_blank')" class="scalable" type="button" id="$htmlId">
32
- <span><span><span>$buttonLabel</span></span></span>
33
- </button>
34
- HTML_CONTENT;
35
-
36
- return $htmlContent;
37
- }
38
-
39
- public function render(Varien_Data_Form_Element_Abstract $element){
40
- $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
41
- return parent::render($element);
42
- }
43
-
44
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
45
- $originalData = $element->getOriginalData();
46
- $this->addData(array(
47
- 'button_label' => Mage::helper('cfconnector')->__($originalData['button_label']),
48
- 'html_id' => $element->getHtmlId()
49
- ));
50
- return $this->_toHtml();
51
- }
52
-
53
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ */
12
+
13
+ class Cachefill_Connector_Block_Adminhtml_System_Config_Viewlast extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
+
15
+ protected function _toHtml() {
16
+ $htmlId = $this->getHtmlId();
17
+ $ajaxUrl = $this->getAjaxUrl();
18
+ $buttonLabel = $this->escapeHtml($this->getButtonLabel());
19
+ $accessKey = Mage::helper('cfconnector')->getAccessKey();
20
+ if(!$accessKey){
21
+ return "";
22
+ }
23
+
24
+ $lastResultUrl = Mage::helper('cfconnector')->getLastResultUrl();
25
+ if(!$lastResultUrl){
26
+ return "";
27
+ }
28
+
29
+
30
+ $htmlContent = <<< HTML_CONTENT
31
+ <button onclick="window.open('$lastResultUrl', '_blank')" class="scalable" type="button" id="$htmlId">
32
+ <span><span><span>$buttonLabel</span></span></span>
33
+ </button>
34
+ HTML_CONTENT;
35
+
36
+ return $htmlContent;
37
+ }
38
+
39
+ public function render(Varien_Data_Form_Element_Abstract $element){
40
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
41
+ return parent::render($element);
42
+ }
43
+
44
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
45
+ $originalData = $element->getOriginalData();
46
+ $this->addData(array(
47
+ 'button_label' => Mage::helper('cfconnector')->__($originalData['button_label']),
48
+ 'html_id' => $element->getHtmlId()
49
+ ));
50
+ return $this->_toHtml();
51
+ }
52
+
53
  }
app/code/community/Cachefill/Connector/Block/Rewrite/Adminhtml/Cache.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
- /**
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- */
12
-
13
- class Cachefill_Connector_Block_Rewrite_Adminhtml_Cache extends Mage_Adminhtml_Block_Cache {
14
-
15
- public function __construct(){
16
- parent::__construct();
17
- $this->_addButton('cachefill_new', array(
18
- 'label' => Mage::helper('core')->__('Start New CACHE FILL Process'),
19
- 'onclick' => 'setLocation(\'' . Mage::helper('cfconnector')->getStartRemoteUrl() .'\')',
20
- 'class' => 'add',
21
- ));
22
-
23
- $lastResultUrl = Mage::helper('cfconnector')->getLastResultUrl();
24
- if(!!$lastResultUrl){
25
- $this->_addButton('cachefill_last', array(
26
- 'label' => Mage::helper('core')->__('View Last CACHE FILL Result'),
27
- 'onclick' => 'window.open(\'' . $lastResultUrl .'\', \'_blank\')',
28
- 'class' => 'save',
29
- ));
30
- }
31
- }
32
-
33
-
34
-
35
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ */
12
+
13
+ class Cachefill_Connector_Block_Rewrite_Adminhtml_Cache extends Mage_Adminhtml_Block_Cache {
14
+
15
+ public function __construct(){
16
+ parent::__construct();
17
+ $this->_addButton('cachefill_new', array(
18
+ 'label' => Mage::helper('core')->__('Start New CACHE FILL Process'),
19
+ 'onclick' => 'setLocation(\'' . Mage::helper('cfconnector')->getStartRemoteUrl() .'\')',
20
+ 'class' => 'add',
21
+ ));
22
+
23
+ $lastResultUrl = Mage::helper('cfconnector')->getLastResultUrl();
24
+ if(!!$lastResultUrl){
25
+ $this->_addButton('cachefill_last', array(
26
+ 'label' => Mage::helper('core')->__('View Last CACHE FILL Result'),
27
+ 'onclick' => 'window.open(\'' . $lastResultUrl .'\', \'_blank\')',
28
+ 'class' => 'save',
29
+ ));
30
+ }
31
+ }
32
+
33
+
34
+
35
  }
app/code/community/Cachefill/Connector/Model/Rewrite/Paypal/Api/Nvp.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php
2
- /*
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- *
12
- *
13
- */
14
- class Cachefill_Connector_Model_Rewrite_Paypal_Api_Nvp extends Mage_Paypal_Model_Api_Nvp {
15
-
16
- public function getButtonSourceEc(){
17
- return $this->getBuildNotationCode();
18
- }
19
-
20
- public function getButtonSourceDp(){
21
- return $this->getBuildNotationCode();
22
- }
23
-
24
- //Important build code update, for Mage_Paypal 1.4 -
25
- public function getBuildNotationCode($countryCode = null){
26
- if($this->_isModuleActive('Enterprise_Enterprise')){
27
- return 'Hara_SI_MagentoEE_PPA';
28
- }else{
29
- return 'Hara_SI_MagentoCE_PPA';
30
- }
31
- }
32
-
33
- private function _isModuleActive($code) {
34
- $module = Mage::getConfig()->getNode("modules/$code");
35
- $model = Mage::getConfig()->getNode("global/models/$code");
36
- return $module && $module->is('active') || $model;
37
- }
38
-
39
  }
1
+ <?php
2
+ /*
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ *
12
+ *
13
+ */
14
+ class Cachefill_Connector_Model_Rewrite_Paypal_Api_Nvp extends Mage_Paypal_Model_Api_Nvp {
15
+
16
+ public function getButtonSourceEc(){
17
+ return $this->getBuildNotationCode();
18
+ }
19
+
20
+ public function getButtonSourceDp(){
21
+ return $this->getBuildNotationCode();
22
+ }
23
+
24
+ //Important build code update, for Mage_Paypal 1.4 -
25
+ public function getBuildNotationCode($countryCode = null){
26
+ if($this->_isModuleActive('Enterprise_Enterprise')){
27
+ return 'Hara_SI_MagentoEE_PPA';
28
+ }else{
29
+ return 'Hara_SI_MagentoCE_PPA';
30
+ }
31
+ }
32
+
33
+ private function _isModuleActive($code) {
34
+ $module = Mage::getConfig()->getNode("modules/$code");
35
+ $model = Mage::getConfig()->getNode("global/models/$code");
36
+ return $module && $module->is('active') || $model;
37
+ }
38
+
39
  }
app/code/community/Cachefill/Connector/controllers/Adminhtml/ServiceController.php CHANGED
@@ -1,89 +1,89 @@
1
- <?php
2
- /**
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- */
12
-
13
- class Cachefill_Connector_Adminhtml_ServiceController extends Mage_Adminhtml_Controller_Action {
14
-
15
- public function remoteEngineExecAction() {
16
- //Must have a valid access_key
17
- $accessKey = Mage::helper('cfconnector')->getAccessKey();
18
- if(!$accessKey){
19
- $systemConfigUrl = $this->getUrl('adminhtml/system_config/edit', array('section' => 'cfconnector'));
20
- $this->_getSession()->addError("Your CACHE FILL service is not properly configured. Please <a href=\"$systemConfigUrl\">go to the CACHE FILL configuration panel</a>.");
21
- $this->_redirectReferer();
22
- return;
23
- }
24
-
25
- //Check if any remote process is still running
26
- $hasActiveRemoteproc = false;
27
- $activeRemoteprocCollection = Mage::getModel('cfconnector/remoteproc')->getCollection();
28
- $activeRemoteprocCollection->getSelect()->where('`status` = ?', Cachefill_Connector_Model_Remoteproc::STATUS_PROCESSING);
29
- foreach($activeRemoteprocCollection as $activeRemoteproc){
30
- //Update status remotely
31
- $remoteRequestStatus = Mage::helper('cfconnector')->updateProcStatusByEngineRemote($activeRemoteproc, $accessKey);
32
- if($remoteRequestStatus !== false && $activeRemoteproc->getStatus() == Cachefill_Connector_Model_Remoteproc::STATUS_PROCESSING){
33
- $hasActiveRemoteproc = true;
34
- $resultUrl = Mage::helper('cfconnector')->getEngineExecResultUrl($activeRemoteproc->getData('exec_key'));
35
- break;
36
- }
37
- }
38
- if($hasActiveRemoteproc){
39
- $this->_getSession()->addNotice("The last CACHE FILL process is still running. Please <a href=\"$resultUrl\" target=\"_blank\">click here to see preliminary results</a>.");
40
- $this->_redirectReferer();
41
- return;
42
- }
43
-
44
- //Prepare to make a new request
45
- $requestParamInfo = base64_encode(json_encode(array(
46
- 'access_key' => $accessKey,
47
- 'site_url' => Mage::helper('cfconnector')->getHostOnlyUrl(), //Host only, the CACHE FILL always starts from the webroot
48
- 'platform' => 'Magento',
49
- 'version' => Mage::getVersion()
50
- )));
51
-
52
- $crawlerRequestUrl = Mage::helper('cfconnector')->getEngineExecRequestUrl($requestParamInfo);
53
- $crawlerRequestCurl = curl_init();
54
- curl_setopt($crawlerRequestCurl, CURLOPT_URL, $crawlerRequestUrl);
55
- curl_setopt($crawlerRequestCurl, CURLOPT_SSL_VERIFYPEER, 0);
56
- curl_setopt($crawlerRequestCurl, CURLOPT_RETURNTRANSFER, 1);
57
- $crawlerResultData = json_decode(curl_exec($crawlerRequestCurl), 1);
58
- curl_close($crawlerRequestCurl);
59
-
60
- //Check status, exec_key and engine_status
61
- if(!isset($crawlerResultData['status'])
62
- || $crawlerResultData['status'] != 1
63
- || !isset($crawlerResultData['exec_key'])
64
- ){
65
- $this->_getSession()->addError("There is an error trying to run CACHE FILL on your site. Please try again later.");
66
- $this->_redirectReferer();
67
- return;
68
- }
69
-
70
- //Save a new process
71
- $remoteproc = Mage::getModel('cfconnector/remoteproc');
72
- $remoteproc->setExecKey($crawlerResultData['exec_key']);
73
- if(isset($crawlerResultData['engine_status'])){
74
- $remoteproc->setStatus($crawlerResultData['engine_status']);
75
- }
76
- $remoteproc->save();
77
-
78
- //Try to save the engine request and status
79
- $resultUrl = Mage::helper('cfconnector')->getEngineExecResultUrl($crawlerResultData['exec_key']);
80
- $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The CACHE FILL process is running in the background. <a href=\"$resultUrl\" target=\"_blank\">Click here to see preliminary results</a>."));
81
- $this->_redirectReferer();
82
- return;
83
- }
84
-
85
- protected function _getSession() {
86
- return Mage::getSingleton('adminhtml/session');
87
- }
88
-
89
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ */
12
+
13
+ class Cachefill_Connector_Adminhtml_ServiceController extends Mage_Adminhtml_Controller_Action {
14
+
15
+ public function remoteEngineExecAction() {
16
+ //Must have a valid access_key
17
+ $accessKey = Mage::helper('cfconnector')->getAccessKey();
18
+ if(!$accessKey){
19
+ $systemConfigUrl = $this->getUrl('adminhtml/system_config/edit', array('section' => 'cfconnector'));
20
+ $this->_getSession()->addError("Your CACHE FILL service is not properly configured. Please <a href=\"$systemConfigUrl\">go to the CACHE FILL configuration panel</a>.");
21
+ $this->_redirectReferer();
22
+ return;
23
+ }
24
+
25
+ //Check if any remote process is still running
26
+ $hasActiveRemoteproc = false;
27
+ $activeRemoteprocCollection = Mage::getModel('cfconnector/remoteproc')->getCollection();
28
+ $activeRemoteprocCollection->getSelect()->where('`status` = ?', Cachefill_Connector_Model_Remoteproc::STATUS_PROCESSING);
29
+ foreach($activeRemoteprocCollection as $activeRemoteproc){
30
+ //Update status remotely
31
+ $remoteRequestStatus = Mage::helper('cfconnector')->updateProcStatusByEngineRemote($activeRemoteproc, $accessKey);
32
+ if($remoteRequestStatus !== false && $activeRemoteproc->getStatus() == Cachefill_Connector_Model_Remoteproc::STATUS_PROCESSING){
33
+ $hasActiveRemoteproc = true;
34
+ $resultUrl = Mage::helper('cfconnector')->getEngineExecResultUrl($activeRemoteproc->getData('exec_key'));
35
+ break;
36
+ }
37
+ }
38
+ if($hasActiveRemoteproc){
39
+ $this->_getSession()->addNotice("The last CACHE FILL process is still running. Please <a href=\"$resultUrl\" target=\"_blank\">click here to see preliminary results</a>.");
40
+ $this->_redirectReferer();
41
+ return;
42
+ }
43
+
44
+ //Prepare to make a new request
45
+ $requestParamInfo = base64_encode(json_encode(array(
46
+ 'access_key' => $accessKey,
47
+ 'site_url' => Mage::helper('cfconnector')->getHostOnlyUrl(), //Host only, the CACHE FILL always starts from the webroot
48
+ 'platform' => 'Magento',
49
+ 'version' => Mage::getVersion()
50
+ )));
51
+
52
+ $crawlerRequestUrl = Mage::helper('cfconnector')->getEngineExecRequestUrl($requestParamInfo);
53
+ $crawlerRequestCurl = curl_init();
54
+ curl_setopt($crawlerRequestCurl, CURLOPT_URL, $crawlerRequestUrl);
55
+ curl_setopt($crawlerRequestCurl, CURLOPT_SSL_VERIFYPEER, 0);
56
+ curl_setopt($crawlerRequestCurl, CURLOPT_RETURNTRANSFER, 1);
57
+ $crawlerResultData = json_decode(curl_exec($crawlerRequestCurl), 1);
58
+ curl_close($crawlerRequestCurl);
59
+
60
+ //Check status, exec_key and engine_status
61
+ if(!isset($crawlerResultData['status'])
62
+ || $crawlerResultData['status'] != 1
63
+ || !isset($crawlerResultData['exec_key'])
64
+ ){
65
+ $this->_getSession()->addError("There is an error trying to run CACHE FILL on your site. Please try again later.");
66
+ $this->_redirectReferer();
67
+ return;
68
+ }
69
+
70
+ //Save a new process
71
+ $remoteproc = Mage::getModel('cfconnector/remoteproc');
72
+ $remoteproc->setExecKey($crawlerResultData['exec_key']);
73
+ if(isset($crawlerResultData['engine_status'])){
74
+ $remoteproc->setStatus($crawlerResultData['engine_status']);
75
+ }
76
+ $remoteproc->save();
77
+
78
+ //Try to save the engine request and status
79
+ $resultUrl = Mage::helper('cfconnector')->getEngineExecResultUrl($crawlerResultData['exec_key']);
80
+ $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The CACHE FILL process is running in the background. <a href=\"$resultUrl\" target=\"_blank\">Click here to see preliminary results</a>."));
81
+ $this->_redirectReferer();
82
+ return;
83
+ }
84
+
85
+ protected function _getSession() {
86
+ return Mage::getSingleton('adminhtml/session');
87
+ }
88
+
89
  }
app/code/community/Cachefill/Connector/controllers/Adminhtml/System/Config/AjaxController.php CHANGED
@@ -1,79 +1,79 @@
1
- <?php
2
- /**
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- */
12
-
13
- class Cachefill_Connector_Adminhtml_System_Config_AjaxController extends Mage_Adminhtml_Controller_Action {
14
-
15
- public function loginAction() {
16
- try{
17
- $username = $this->getRequest()->getParam('username');
18
- $password = $this->getRequest()->getParam('password');
19
- //Check encrypted password
20
- if (preg_match('/^\*+$/', $password)) {
21
- $password = Mage::helper('core')->decrypt(Mage::getStoreConfig('waconnector/general/password'));
22
- }
23
-
24
- //Host only, the CACHE FILL always starts from the webroot
25
- $requestParamInfo = base64_encode(json_encode(array(
26
- 'username' => $username,
27
- 'password' => $password,
28
- 'site_url' => Mage::helper('cfconnector')->getHostOnlyUrl(), //Host only, the CACHE FILL always starts from the webroot
29
- 'platform' => 'Magento',
30
- 'version' => Mage::getVersion()
31
- )));
32
-
33
- $loginRequestUrl = Mage::helper('cfconnector')->getSubscriptionValidateRequestUrl($requestParamInfo);
34
- $loginRequestCurl = curl_init();
35
- curl_setopt($loginRequestCurl, CURLOPT_URL, $loginRequestUrl);
36
- curl_setopt($loginRequestCurl, CURLOPT_SSL_VERIFYPEER, 0);
37
- curl_setopt($loginRequestCurl, CURLOPT_RETURNTRANSFER, 1);
38
- $loginResultData = json_decode(curl_exec($loginRequestCurl), 1);
39
- curl_close($loginRequestCurl);
40
-
41
- if(!isset($loginResultData['status'])){
42
- throw new Exception('Connection Failed.');
43
- }
44
-
45
- if($loginResultData['status'] != 1){
46
- if(!isset($loginResultData['message'])){
47
- throw new Exception('Connection Failed.');
48
- }else{
49
- throw new Exception($loginResultData['message']);
50
- }
51
- }
52
-
53
- if(!isset($loginResultData['access_key'])){
54
- throw new Exception('Invalid access key.');
55
- }
56
-
57
- $accessKeyConfigValue = $loginResultData['access_key'];
58
- echo json_encode(array(
59
- 'status' => 1,
60
- 'message' => 'Success! Please save configuration.'
61
- )); //Json success
62
-
63
- }catch(Exception $e){
64
- $accessKeyConfigValue = "";
65
- echo json_encode(array(
66
- 'status' => 0,
67
- 'message' => $e->getMessage()
68
- )); //Json error
69
-
70
- }
71
-
72
- $coreConfigData = Mage::getModel('core/config_data')->load('cfconnector/general/access_key', 'path');
73
- $coreConfigData->setPath('cfconnector/general/access_key'); //In case of new save
74
- $coreConfigData->setValue($accessKeyConfigValue);
75
- $coreConfigData->save();
76
- exit;
77
- }
78
-
79
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ */
12
+
13
+ class Cachefill_Connector_Adminhtml_System_Config_AjaxController extends Mage_Adminhtml_Controller_Action {
14
+
15
+ public function loginAction() {
16
+ try{
17
+ $username = $this->getRequest()->getParam('username');
18
+ $password = $this->getRequest()->getParam('password');
19
+ //Check encrypted password
20
+ if (preg_match('/^\*+$/', $password)) {
21
+ $password = Mage::helper('core')->decrypt(Mage::getStoreConfig('waconnector/general/password'));
22
+ }
23
+
24
+ //Host only, the CACHE FILL always starts from the webroot
25
+ $requestParamInfo = base64_encode(json_encode(array(
26
+ 'username' => $username,
27
+ 'password' => $password,
28
+ 'site_url' => Mage::helper('cfconnector')->getHostOnlyUrl(), //Host only, the CACHE FILL always starts from the webroot
29
+ 'platform' => 'Magento',
30
+ 'version' => Mage::getVersion()
31
+ )));
32
+
33
+ $loginRequestUrl = Mage::helper('cfconnector')->getSubscriptionValidateRequestUrl($requestParamInfo);
34
+ $loginRequestCurl = curl_init();
35
+ curl_setopt($loginRequestCurl, CURLOPT_URL, $loginRequestUrl);
36
+ curl_setopt($loginRequestCurl, CURLOPT_SSL_VERIFYPEER, 0);
37
+ curl_setopt($loginRequestCurl, CURLOPT_RETURNTRANSFER, 1);
38
+ $loginResultData = json_decode(curl_exec($loginRequestCurl), 1);
39
+ curl_close($loginRequestCurl);
40
+
41
+ if(!isset($loginResultData['status'])){
42
+ throw new Exception('Connection Failed.');
43
+ }
44
+
45
+ if($loginResultData['status'] != 1){
46
+ if(!isset($loginResultData['message'])){
47
+ throw new Exception('Connection Failed.');
48
+ }else{
49
+ throw new Exception($loginResultData['message']);
50
+ }
51
+ }
52
+
53
+ if(!isset($loginResultData['access_key'])){
54
+ throw new Exception('Invalid access key.');
55
+ }
56
+
57
+ $accessKeyConfigValue = $loginResultData['access_key'];
58
+ echo json_encode(array(
59
+ 'status' => 1,
60
+ 'message' => 'Success! Please save configuration.'
61
+ )); //Json success
62
+
63
+ }catch(Exception $e){
64
+ $accessKeyConfigValue = "";
65
+ echo json_encode(array(
66
+ 'status' => 0,
67
+ 'message' => $e->getMessage()
68
+ )); //Json error
69
+
70
+ }
71
+
72
+ $coreConfigData = Mage::getModel('core/config_data')->load('cfconnector/general/access_key', 'path');
73
+ $coreConfigData->setPath('cfconnector/general/access_key'); //In case of new save
74
+ $coreConfigData->setValue($accessKeyConfigValue);
75
+ $coreConfigData->save();
76
+ exit;
77
+ }
78
+
79
  }
app/etc/modules/Cachefill_Connector.xml CHANGED
@@ -1,20 +1,20 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- * NOTICE OF LICENSE
4
- *
5
- * This source file is subject to the End User Software Agreement (EULA).
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.harapartners.com/license
8
- * If you did not receive a copy of the license and are unable to
9
- * obtain it through the world-wide-web, please send an email
10
- * to eula@harapartners.com so we can send you a copy immediately.
11
- *
12
- -->
13
- <config>
14
- <modules>
15
- <Cachefill_Connector>
16
- <active>true</active>
17
- <codePool>community</codePool>
18
- </Cachefill_Connector>
19
- </modules>
20
- </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the End User Software Agreement (EULA).
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.harapartners.com/license
8
+ * If you did not receive a copy of the license and are unable to
9
+ * obtain it through the world-wide-web, please send an email
10
+ * to eula@harapartners.com so we can send you a copy immediately.
11
+ *
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <Cachefill_Connector>
16
+ <active>true</active>
17
+ <codePool>community</codePool>
18
+ </Cachefill_Connector>
19
+ </modules>
20
+ </config>
package.xml CHANGED
@@ -1,22 +1,26 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CacheFill_Connector</name>
4
- <version>2.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.harapartners.com/terms/eula">Hara Partners End User License Agreement</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>CACHE FILL prefills your cache and speeds up every page of your website before your customers visit your website.</summary>
10
- <description>CACHE FILL is an easy to use way to speed up your web server browsing experience to your customers and maximizes the value of your hosting and caching technologies.&#xD;
11
- &#xD;
12
- This Magento plug-in instantly enables CACHE FILL for your website and lets you run CACHE FILL any time to speed up your website.&#xD;
13
- &#xD;
14
- Use CACHE FILL every time you refresh and clear your server cache to fill it up again.</description>
15
- <notes>Stable</notes>
16
- <authors><author><name>CACHE FILL</name><user>cachefill</user><email>magento@cachefill.com</email></author></authors>
 
 
 
 
17
  <date>2013-11-26</date>
18
- <time>18:54:13</time>
19
- <contents><target name="magecommunity"><dir name="Cachefill"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Login.php" hash="a2b3a8cd6d8f4ab6c643327c31d2d3ca"/><file name="Startnew.php" hash="4a0901d1d5e174a186a0dcc8a66c418d"/><file name="Viewlast.php" hash="91bfe26d669f2c0a6c532e4d7db60d4d"/></dir></dir></dir><dir name="Rewrite"><dir name="Adminhtml"><file name="Cache.php" hash="7711a2d617e1c2ce6b3fcb2337a5e0b4"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="86318acfbe973aa6bf92f9b36989fdb8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Remoteproc"><file name="Collection.php" hash="e565d3db46bc43b00bb1641c3d8db10b"/></dir><file name="Remoteproc.php" hash="58a8de2b6e8e700aea2f04fda007fb7e"/></dir><file name="Remoteproc.php" hash="fdd8afefc2a9431e16b0317792e43f1f"/><dir name="Rewrite"><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="d3eb6a78a8382bf23f995e099def7b18"/></dir><file name="Config.php" hash="0790d2b007551d55610de68952f36c6c"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ServiceController.php" hash="d4b28f27bcc325ea3f6e607e9721ab6e"/><dir name="System"><dir name="Config"><file name="AjaxController.php" hash="d7255967773c5d60b30f883bc61511f2"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="27a229a6aece1174d3709e24c35b79bb"/><file name="system.xml" hash="0a1bb4c42f743fd22852d1662e2868df"/></dir><dir name="sql"><dir name="cfconnector_setup"><file name="mysql4-install-1.0.0.php" hash="65eac1a3a4b068b391b05f6ad42c8678"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cachefill_Connector.xml" hash="b84276cba22101c3634110b26bd0afa8"/></dir></target></contents>
20
  <compatible/>
21
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CacheFill_Connector</name>
4
+ <version>2.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.harapartners.com/terms/eula">Hara Partners End User License Agreement</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>CACHE FILL prefills your cache and speeds up every page of your website before your customers visit your website.</summary>
10
+ <description>CACHE FILL is an easy to use way to speed up your web server browsing experience to your customers and maximizes the value of your hosting and caching technologies.
11
+ &lt;br /&gt;&lt;br /&gt;
12
+ This Magento plug-in instantly enables CACHE FILL for your website and lets you run CACHE FILL any time to speed up your website.
13
+ &lt;br /&gt;&lt;br /&gt;
14
+ Use CACHE FILL every time you refresh and clear your server cache to fill it up again.
15
+ &lt;br /&gt;&lt;br /&gt;
16
+ This free module will enable you to trigger the CACHE FILL service from within Magento's cache management panel. You do need an active CACHE FILL subscription.
17
+ &lt;br /&gt;&lt;br /&gt;
18
+ You can try CACHE FILL with your own for only $1.99 directly on www.cachefill.com.</description>
19
+ <notes>CACHE FILL fills your cache and speeds up all pages of your website with a CACHE FILL subscription.</notes>
20
+ <authors><author><name>CACHE FILL</name><user>auto-converted</user><email>magento@cachefill.com</email></author></authors>
21
  <date>2013-11-26</date>
22
+ <time>19:25:03</time>
23
+ <contents><target name="magecommunity"><dir name="Cachefill"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Login.php" hash="e5a9e06f98b199537e37085a411b3d83"/><file name="Startnew.php" hash="e8689fb98b8874d92fc63a05173e4144"/><file name="Viewlast.php" hash="f8bba42689249c6ee72cdda795233f07"/></dir></dir></dir><dir name="Rewrite"><dir name="Adminhtml"><file name="Cache.php" hash="d8f8261fc14b5baac6e6dcfba99f091f"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="AjaxController.php" hash="29679e78cc73499d1bf033f700d461f7"/></dir></dir><file name="ServiceController.php" hash="eea5f38709c343bb1de86af4d10d74de"/></dir></dir><dir name="etc"><file name="config.xml" hash="27a229a6aece1174d3709e24c35b79bb"/><file name="system.xml" hash="0a1bb4c42f743fd22852d1662e2868df"/></dir><dir name="Helper"><file name="Data.php" hash="86318acfbe973aa6bf92f9b36989fdb8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Remoteproc"><file name="Collection.php" hash="e565d3db46bc43b00bb1641c3d8db10b"/></dir><file name="Remoteproc.php" hash="58a8de2b6e8e700aea2f04fda007fb7e"/></dir><dir name="Rewrite"><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="17b0b82874fe2cd871343a840257b224"/></dir><file name="Config.php" hash="0790d2b007551d55610de68952f36c6c"/></dir></dir><file name="Remoteproc.php" hash="fdd8afefc2a9431e16b0317792e43f1f"/></dir><dir name="sql"><dir name="cfconnector_setup"><file name="mysql4-install-1.0.0.php" hash="65eac1a3a4b068b391b05f6ad42c8678"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cachefill_Connector.xml" hash="48210d16cf4d5c3e243c412a93d2b418"/></dir></target></contents>
24
  <compatible/>
25
+ <dependencies/>
26
  </package>