Merge pull request #1 from Josef-A-Puckl/master

Oxid 6 Update
This commit is contained in:
ProudCommerce 2019-06-29 10:00:28 +02:00 committed by GitHub
commit 546b8c8b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 58 additions and 25 deletions

View File

@ -10,7 +10,13 @@
* @package psCacheWarmer * @package psCacheWarmer
* @version 1.0.1 * @version 1.0.1
**/ **/
class psCacheWarmer extends oxUBase
namespace ProudCommerce\CacheWarmer\Application\Controller;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Controller\BaseController;
class CacheWarmer extends BaseController
{ {
/** /**
* Executes cache warmer * Executes cache warmer
@ -21,15 +27,15 @@ class psCacheWarmer extends oxUBase
if($this->_checkAuthentification()) { if($this->_checkAuthentification()) {
$aUrls = $this->_getSitemapContent(); $aUrls = $this->_getSitemapContent();
if(!empty(oxRegistry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl')) && count($aUrls) > 0) { if(!empty(Registry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl')) && count($aUrls) > 0) {
foreach($aUrls as $sUrl) { foreach($aUrls as $sUrl) {
$oCurl = curl_init(); $oCurl = curl_init();
curl_setopt($oCurl, CURLOPT_URL, $sUrl); curl_setopt($oCurl, CURLOPT_URL, $sUrl);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($oCurl, CURLOPT_CONNECTTIMEOUT, 25); curl_setopt($oCurl, CURLOPT_CONNECTTIMEOUT, 25);
curl_setopt($oCurl, CURLOPT_HEADER, true); curl_setopt($oCurl, CURLOPT_HEADER, true);
$sUsername = oxRegistry::getConfig()->getShopConfVar('psCacheWarmerUser'); $sUsername = Registry::getConfig()->getShopConfVar('psCacheWarmerUser');
$sPassword = oxRegistry::getConfig()->getShopConfVar('psCacheWarmerPass'); $sPassword = Registry::getConfig()->getShopConfVar('psCacheWarmerPass');
curl_setopt($oCurl, CURLOPT_USERPWD, $sUsername . ":" . $sPassword); curl_setopt($oCurl, CURLOPT_USERPWD, $sUsername . ":" . $sPassword);
curl_exec($oCurl); curl_exec($oCurl);
$httpStatus = curl_getinfo($oCurl, CURLINFO_HTTP_CODE); $httpStatus = curl_getinfo($oCurl, CURLINFO_HTTP_CODE);
@ -63,8 +69,8 @@ class psCacheWarmer extends oxUBase
$sSitemapUrl = $this->_getSitemapUrl(); $sSitemapUrl = $this->_getSitemapUrl();
} }
$sUsername = oxRegistry::getConfig()->getShopConfVar('psCacheWarmerUser'); $sUsername = Registry::getConfig()->getShopConfVar('psCacheWarmerUser');
$sPassword = oxRegistry::getConfig()->getShopConfVar('psCacheWarmerPass'); $sPassword = Registry::getConfig()->getShopConfVar('psCacheWarmerPass');
$sSitemapUrl = str_replace("://", "://".$sUsername.":".$sPassword."@", $sSitemapUrl); $sSitemapUrl = str_replace("://", "://".$sUsername.":".$sPassword."@", $sSitemapUrl);
$sSitemapXmlData = @file_get_contents($sSitemapUrl); $sSitemapXmlData = @file_get_contents($sSitemapUrl);
@ -93,8 +99,8 @@ class psCacheWarmer extends oxUBase
*/ */
protected function _getSitemapUrl() protected function _getSitemapUrl()
{ {
$sSitemapUrl = oxRegistry::getConfig()->getConfigParam('sShopURL'); $sSitemapUrl = Registry::getConfig()->getConfigParam('sShopURL');
$sSitemapUrl .= oxRegistry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl'); $sSitemapUrl .= Registry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl');
return $sSitemapUrl; return $sSitemapUrl;
} }
@ -105,8 +111,8 @@ class psCacheWarmer extends oxUBase
*/ */
protected function _checkAuthentification() protected function _checkAuthentification()
{ {
$oConfig = oxRegistry::getConfig(); $oConfig = Registry::getConfig();
$sKey = oxRegistry::getConfig()->getRequestParameter("key"); $sKey = Registry::getConfig()->getRequestParameter("key");
$sSavedKey = $oConfig->getShopConfVar('psCacheWarmerKey', $oConfig->getShopId()); $sSavedKey = $oConfig->getShopConfVar('psCacheWarmerKey', $oConfig->getShopId());
if($sSavedKey == $sKey) { if($sSavedKey == $sKey) {
return true; return true;

View File

@ -2,7 +2,7 @@ psCacheWarmer
============ ============
Automatically calling urls using the xml-sitemap, eg. for cache warming. Automatically calling urls using the xml-sitemap, eg. for cache warming.
Free module for OXID eshop 4.7, 4.8, 4.9 and 4.10. Free module for OXID eshop 6.
Features Features
@ -12,14 +12,14 @@ Features
Installation Installation
1. copy content from copy_this folder into your shop root 1. composer config repo.ProudCommerce/CacheWarmer git https://github.com/Josef-A-Puckl/psCacheWarmer/
2. activate module psCacheWarmer in shop admin 2. composer require proudcommerce/cachewarmer
Tip: Use the [OXID module connector](https://github.com/OXIDprojects/OXID-Module-Connector) to install this module.
Changelog Changelog
2016-10-12 1.0.1 fix reading sitemap url with user/pass,fix checking sitemap object 2019-06-26 2.0.0 OXID eShop 6 - Josef A. Puckl
2016-10-12 1.0.1 fix reading sitemap url with user/pass,fix checking sitemap object
2016-08-25 1.0.0 module release for oxid 4.7, 4.8, 4.9, 4.10 2016-08-25 1.0.0 module release for oxid 4.7, 4.8, 4.9, 4.10
License License

33
composer.json Normal file
View File

@ -0,0 +1,33 @@
{
"name": "proudcommerce/cachewarmer",
"version": "2.0.0",
"description": "psCacheWarmer",
"type": "oxideshop-module",
"license": [
"proprietary"
],
"authors": [
{
"name": "ProudCommerce",
"homepage": "https://www.proudcommerce.com/",
"email": "welcome@proudcommerce.com",
"role": "Developer"
}
],
"support": {
"email": "support@proudcommerce.com"
},
"require": {
"php": ">= 7.0"
},
"autoload": {
"psr-4": {
"ProudCommerce\\CacheWarmer\\": "../../../source/modules/proudsourcing/psCacheWarmer"
}
},
"extra": {
"oxideshop": {
"target-directory": "proudsourcing/psCacheWarmer"
}
}
}

View File

@ -1,6 +0,0 @@
<?php
/**
* Metadata version
*/
$sVendorMetadataVersion = '1.0';

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -14,7 +14,7 @@
/** /**
* Metadata version * Metadata version
*/ */
$sMetadataVersion = '1.1'; $sMetadataVersion = '2.0';
/** /**
* Module information * Module information
@ -29,14 +29,14 @@ $aModule = array(
<b>URL:</b> <a href="'.oxRegistry::getConfig()->getConfigParam('sShopURL').'?cl=psCacheWarmer&key='.oxRegistry::getConfig()->getShopConfVar('psCacheWarmerKey', oxRegistry::getConfig()->getShopId()).'" target="_blank">'.oxRegistry::getConfig()->getConfigParam('sShopURL').'?cl=psCacheWarmer&key='.oxRegistry::getConfig()->getShopConfVar('psCacheWarmerKey', oxRegistry::getConfig()->getShopId()).'</a>', <b>URL:</b> <a href="'.oxRegistry::getConfig()->getConfigParam('sShopURL').'?cl=psCacheWarmer&key='.oxRegistry::getConfig()->getShopConfVar('psCacheWarmerKey', oxRegistry::getConfig()->getShopId()).'" target="_blank">'.oxRegistry::getConfig()->getConfigParam('sShopURL').'?cl=psCacheWarmer&key='.oxRegistry::getConfig()->getShopConfVar('psCacheWarmerKey', oxRegistry::getConfig()->getShopId()).'</a>',
), ),
'thumbnail' => 'logo_pc-os.jpg', 'thumbnail' => 'logo_pc-os.jpg',
'version' => '1.0.1', 'version' => '2.0.0',
'author' => 'Proud Sourcing GmbH', 'author' => 'Proud Sourcing GmbH',
'url' => 'http://www.proudcommerce.com/', 'url' => 'http://www.proudcommerce.com/',
'email' => 'support@proudcommerce.com', 'email' => 'support@proudcommerce.com',
'extend' => array( 'extend' => array(
), ),
'files' => array( 'controllers' => array(
'pscachewarmer' => 'proudsourcing/psCacheWarmer/application/controllers/pscachewarmer.php', 'pscachewarmer' => \ProudCommerce\CacheWarmer\Application\Controller\CacheWarmer::class,
), ),
'templates' => array( 'templates' => array(
), ),