Vergelijk commits
21 Commits
Auteur | SHA1 | Datum | |
---|---|---|---|
|
ba687d58e6 | ||
a1ff8970f9 | |||
|
87fc962739 | ||
13a5758ad4 | |||
|
f9d1561ea7 | ||
|
dbdd20d7d6 | ||
|
b32e37873d | ||
|
638fcc064a | ||
|
fc6373de2b | ||
|
93bf8fe856 | ||
|
6d955441b4 | ||
|
7fcf810ce4 | ||
|
e73fa97a54 | ||
|
9985d2bfcc | ||
|
a2dcbd6f08 | ||
|
34ce6caad2 | ||
|
30b5b8502f | ||
|
d1091653dd | ||
|
321c92e830 | ||
|
774f655c86 | ||
|
f3b70303a5 |
@ -1,128 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* @copyright (c) Proud Sourcing GmbH | 2016
|
|
||||||
* @link www.proudcommerce.com
|
|
||||||
* @package psCacheWarmer
|
|
||||||
* @version 1.0.1
|
|
||||||
**/
|
|
||||||
|
|
||||||
namespace ProudCommerce\CacheWarmer\Application\Controller;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
use OxidEsales\Eshop\Core\Controller\BaseController;
|
|
||||||
|
|
||||||
class CacheWarmer extends BaseController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Executes cache warmer
|
|
||||||
*/
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
$sMessage = "<b>psCacheWarmer</b><br>".$this->_getSitemapUrl()."<br>---<br>";
|
|
||||||
|
|
||||||
if($this->_checkAuthentification()) {
|
|
||||||
$aUrls = $this->_getSitemapContent();
|
|
||||||
if(!empty(Registry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl')) && count($aUrls) > 0) {
|
|
||||||
foreach($aUrls as $sUrl) {
|
|
||||||
$oCurl = curl_init();
|
|
||||||
curl_setopt($oCurl, CURLOPT_URL, $sUrl);
|
|
||||||
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
curl_setopt($oCurl, CURLOPT_CONNECTTIMEOUT, 25);
|
|
||||||
curl_setopt($oCurl, CURLOPT_HEADER, true);
|
|
||||||
$sUsername = Registry::getConfig()->getShopConfVar('psCacheWarmerUser');
|
|
||||||
$sPassword = Registry::getConfig()->getShopConfVar('psCacheWarmerPass');
|
|
||||||
curl_setopt($oCurl, CURLOPT_USERPWD, $sUsername . ":" . $sPassword);
|
|
||||||
curl_exec($oCurl);
|
|
||||||
$httpStatus = curl_getinfo($oCurl, CURLINFO_HTTP_CODE);
|
|
||||||
if(curl_error($oCurl)) {
|
|
||||||
$sMessage .= '<span style="color: orange;">ERROR '.$httpStatus.': ' . curl_error($oCurl) . '</span><br>';
|
|
||||||
} else {
|
|
||||||
if(trim($httpStatus) == '500')
|
|
||||||
{
|
|
||||||
$sMessage .= '<span style="color: red;">ERROR <b>'.$httpStatus.'</b>: ' . $sUrl. '</span><br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$sMessage .= '<span style="color: green;">OK '.$httpStatus.': ' . $sUrl . '</span><br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
curl_close($oCurl);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$sMessage .= '<span style="color: red;">Keine Daten vorhanden!</span>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$sMessage .= '<span style="color: red;">Authentifizierung fehlgeschlagen!</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<pre>'.$sMessage.'</pre>';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returens urls from sitemap
|
|
||||||
*
|
|
||||||
* @return array urls
|
|
||||||
*/
|
|
||||||
protected function _getSitemapContent($sSitemapUrl = "")
|
|
||||||
{
|
|
||||||
$aUrls = array();
|
|
||||||
if(empty($sSitemapUrl)) {
|
|
||||||
$sSitemapUrl = $this->_getSitemapUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
$sUsername = Registry::getConfig()->getShopConfVar('psCacheWarmerUser');
|
|
||||||
$sPassword = Registry::getConfig()->getShopConfVar('psCacheWarmerPass');
|
|
||||||
$sSitemapUrl = str_replace("://", "://".$sUsername.":".$sPassword."@", $sSitemapUrl);
|
|
||||||
|
|
||||||
$sSitemapXmlData = @file_get_contents($sSitemapUrl);
|
|
||||||
if($oSitemap = @simplexml_load_string($sSitemapXmlData)) {
|
|
||||||
if (count($oSitemap->sitemap) > 0) {
|
|
||||||
foreach ($oSitemap->sitemap as $oSubSitemap) {
|
|
||||||
$sNextSitemapUrl = (string)$oSubSitemap->loc;
|
|
||||||
$aUrls = array_merge($aUrls, $this->_getSitemapContent($sNextSitemapUrl));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count($oSitemap->url) > 0) {
|
|
||||||
foreach($oSitemap->url as $oSitemapUrl) {
|
|
||||||
$aUrls[] = (string)$oSitemapUrl->loc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#print_r($aUrls);
|
|
||||||
return $aUrls;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returens sitemap url
|
|
||||||
*
|
|
||||||
* @return string sitemap url
|
|
||||||
*/
|
|
||||||
protected function _getSitemapUrl()
|
|
||||||
{
|
|
||||||
$sSitemapUrl = Registry::getConfig()->getConfigParam('sShopURL');
|
|
||||||
$sSitemapUrl .= Registry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl');
|
|
||||||
return $sSitemapUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks authentification
|
|
||||||
*
|
|
||||||
* @return bool true|false
|
|
||||||
*/
|
|
||||||
protected function _checkAuthentification()
|
|
||||||
{
|
|
||||||
$oConfig = Registry::getConfig();
|
|
||||||
$sKey = Registry::getConfig()->getRequestParameter("key");
|
|
||||||
$sSavedKey = $oConfig->getShopConfVar('psCacheWarmerKey', $oConfig->getShopId());
|
|
||||||
if($sSavedKey == $sKey) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,26 +5,26 @@
|
|||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* @copyright (c) Proud Sourcing GmbH | 2016
|
* @copyright (c) ProudCommerce | 2020
|
||||||
* @link www.proudcommerce.com
|
* @link www.proudcommerce.com
|
||||||
* @package psCacheWarmer
|
* @package psCacheWarmer
|
||||||
* @version 1.0.1
|
* @version 3.0.0
|
||||||
**/
|
**/
|
||||||
$sLangName = "Deutsch";
|
|
||||||
|
$sLangName = "Deutsch";
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// RESOURCE IDENTITFIER = STRING
|
// RESOURCE IDENTITFIER = STRING
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
$aLang = array(
|
$aLang = [
|
||||||
'charset' => 'UTF-8',
|
'charset' => 'UTF-8',
|
||||||
|
|
||||||
'SHOP_MODULE_GROUP_psCacheWarmerConfig' => 'Einstellungen',
|
'SHOP_MODULE_GROUP_psCacheWarmerConfig' => 'Einstellungen',
|
||||||
'SHOP_MODULE_psCacheWarmerSitemapUrl' => 'XML-Sitemap URL',
|
'SHOP_MODULE_psCacheWarmerSitemapUrl' => 'XML-Sitemap URL',
|
||||||
'SHOP_MODULE_psCacheWarmerKey' => 'Cronjob-Key',
|
'SHOP_MODULE_psCacheWarmerKey' => 'Cronjob-Key',
|
||||||
'SHOP_MODULE_psCacheWarmerUser' => 'Basic-Auth Benutzer',
|
'SHOP_MODULE_psCacheWarmerHttpCodes' => 'gültige HTTP-Responsecode (OK im LOG-File, sonst ERROR)',
|
||||||
'SHOP_MODULE_psCacheWarmerPass' => 'Basic-Auth Kennwort',
|
'SHOP_MODULE_psCacheWarmerUser' => 'Basic-Auth Benutzer',
|
||||||
|
'SHOP_MODULE_psCacheWarmerPass' => 'Basic-Auth Kennwort',
|
||||||
|
'SHOP_MODULE_psCacheWarmerWriteCsv' => 'LOG-File für gesamten Crawl',
|
||||||
|
'SHOP_MODULE_psCacheWarmerWriteCsvOnlyError' => 'LOG-File nur wenn HTTP-Responsecode != 200',
|
||||||
|
|
||||||
);
|
];
|
||||||
|
|
||||||
/*
|
|
||||||
[{ oxmultilang ident="GENERAL_YOUWANTTODELETE" }]
|
|
||||||
*/
|
|
||||||
|
152
Core/CacheWarmer.php
Normal file
152
Core/CacheWarmer.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @copyright (c) ProudCommerce | 2020
|
||||||
|
* @link www.proudcommerce.com
|
||||||
|
* @package psCacheWarmer
|
||||||
|
* @version 3.1.1
|
||||||
|
**/
|
||||||
|
|
||||||
|
namespace ProudCommerce\CacheWarmer\Core;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CacheWarmer
|
||||||
|
*
|
||||||
|
* @package ProudCommerce\CacheWarmer\Core
|
||||||
|
*/
|
||||||
|
class CacheWarmer
|
||||||
|
{
|
||||||
|
private string $sCliSiteMapFile = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function run($sFileSitemap)
|
||||||
|
{
|
||||||
|
$this->sCliSiteMapFile = trim($sFileSitemap);
|
||||||
|
|
||||||
|
$aUrls = $this->_getSitemapContent();
|
||||||
|
if ((!empty(Registry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl'))
|
||||||
|
|| !empty($sFileSitemap))
|
||||||
|
&& !empty($aUrls)) {
|
||||||
|
foreach ($aUrls as $sUrl) {
|
||||||
|
$oCurl = $this->_runCurlConnect($sUrl);
|
||||||
|
$this->_checkCurlResults($oCurl, $sUrl);
|
||||||
|
curl_close($oCurl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $sUrl
|
||||||
|
*
|
||||||
|
* @return false|resource
|
||||||
|
*/
|
||||||
|
protected function _runCurlConnect($sUrl)
|
||||||
|
{
|
||||||
|
$oCurl = curl_init();
|
||||||
|
curl_setopt($oCurl, CURLOPT_URL, $sUrl);
|
||||||
|
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($oCurl, CURLOPT_CONNECTTIMEOUT, 25);
|
||||||
|
curl_setopt($oCurl, CURLOPT_HEADER, true);
|
||||||
|
curl_setopt($oCurl, CURLOPT_USERAGENT, 'CacheWarmer');
|
||||||
|
$sUsername = Registry::getConfig()->getShopConfVar('psCacheWarmerUser');
|
||||||
|
$sPassword = Registry::getConfig()->getShopConfVar('psCacheWarmerPass');
|
||||||
|
curl_setopt($oCurl, CURLOPT_USERPWD, $sUsername . ":" . $sPassword);
|
||||||
|
curl_exec($oCurl);
|
||||||
|
|
||||||
|
return $oCurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $oCurl
|
||||||
|
* @param $sUrl
|
||||||
|
*/
|
||||||
|
protected function _checkCurlResults($oCurl, $sUrl)
|
||||||
|
{
|
||||||
|
$httpStatus = curl_getinfo($oCurl, CURLINFO_HTTP_CODE);
|
||||||
|
if (curl_error($oCurl)) {
|
||||||
|
$sStatusMsg = 'ERROR';
|
||||||
|
$sMessage = curl_error($oCurl);
|
||||||
|
} else {
|
||||||
|
$sMessage = $sUrl;
|
||||||
|
if (in_array(trim($httpStatus), Registry::getConfig()->getShopConfVar('psCacheWarmerHttpCodes'))) {
|
||||||
|
$sStatusMsg = 'OK';
|
||||||
|
} else {
|
||||||
|
$sStatusMsg = 'ERROR';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$httpStatus = trim($httpStatus);
|
||||||
|
$aLog = [$sStatusMsg, $httpStatus, $sMessage];
|
||||||
|
print_r($aLog);
|
||||||
|
|
||||||
|
if (!empty($aLog) && ((Registry::getConfig()->getShopConfVar('psCacheWarmerWriteCsvOnlyError') == true && $httpStatus != '200') || Registry::getConfig()->getShopConfVar('psCacheWarmerWriteCsv') == true)) {
|
||||||
|
$logger = Logging::getLogger('psCacheWarmer', Registry::getConfig()->getLogsDir() . 'pscachewarmer_' . date("dmY_His") . '.log');
|
||||||
|
$logger->info(implode(' | ', $aLog) . "\r");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sSitemapUrl
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function _getSitemapContent($sSitemapUrl = "")
|
||||||
|
{
|
||||||
|
$aUrls = [];
|
||||||
|
if (empty($sSitemapUrl) && $this->sCliSiteMapFile == '')
|
||||||
|
{
|
||||||
|
$sSitemapUrl = $this->_getSitemapUrl($sSitemapUrl);
|
||||||
|
}
|
||||||
|
elseif (empty($sSitemapUrl) && $this->sCliSiteMapFile != '')
|
||||||
|
{
|
||||||
|
$sSitemapUrl = $this->_getSitemapUrl($this->sCliSiteMapFile);
|
||||||
|
}
|
||||||
|
$sUsername = Registry::getConfig()->getShopConfVar('psCacheWarmerUser');
|
||||||
|
$sPassword = Registry::getConfig()->getShopConfVar('psCacheWarmerPass');
|
||||||
|
$sSitemapUrl = str_replace("://", "://" . $sUsername . ":" . $sPassword . "@", $sSitemapUrl);
|
||||||
|
|
||||||
|
$sSitemapXmlData = @file_get_contents($sSitemapUrl);
|
||||||
|
if ($oSitemap = @simplexml_load_string($sSitemapXmlData)) {
|
||||||
|
if (count($oSitemap->sitemap) > 0) {
|
||||||
|
foreach ($oSitemap->sitemap as $oSubSitemap) {
|
||||||
|
$sNextSitemapUrl = (string) $oSubSitemap->loc;
|
||||||
|
$aUrls = array_merge($aUrls, $this->_getSitemapContent($sNextSitemapUrl));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($oSitemap->url) > 0) {
|
||||||
|
foreach ($oSitemap->url as $oSitemapUrl) {
|
||||||
|
$aUrls[] = (string) $oSitemapUrl->loc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $aUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function _getSitemapUrl($sSitemapFile)
|
||||||
|
{
|
||||||
|
$sSitemapUrl = Registry::getConfig()->getShopURL();
|
||||||
|
|
||||||
|
if($sSitemapFile != '')
|
||||||
|
{
|
||||||
|
$sSitemapUrl .= $sSitemapFile;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$sSitemapUrl .= Registry::getConfig()->getShopConfVar('psCacheWarmerSitemapUrl');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sSitemapUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
60
Core/Logging.php
Normal file
60
Core/Logging.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @copyright (c) ProudCommerce | 2020
|
||||||
|
* @link www.proudcommerce.com
|
||||||
|
* @package psCacheWarmer
|
||||||
|
* @version 3.1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
namespace ProudCommerce\CacheWarmer\Core;
|
||||||
|
|
||||||
|
use \OxidEsales\Eshop\Core\Registry;
|
||||||
|
use \Monolog\Logger;
|
||||||
|
use \Monolog\Handler\StreamHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Logging
|
||||||
|
*
|
||||||
|
* @package ProudCommerce\CacheWarmer\Core
|
||||||
|
*/
|
||||||
|
class Logging
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $_aLogger = [];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sLogger
|
||||||
|
* @param string $sPath
|
||||||
|
* @param string $sLogLevel
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public static function getLogger(string $sLogger = '', string $sPath = '', string $sLogLevel = ''): Logger
|
||||||
|
{
|
||||||
|
$sLogger = (!empty($sLogger) ? $sLogger : 'OXID Logger');
|
||||||
|
if (!array_key_exists($sLogger, self::$_aLogger)) {
|
||||||
|
$sPath = ((!empty($sPath)) ? $sPath : Registry::getConfig()->getLogsDir() . 'oxideshop.log');
|
||||||
|
$sLogLevel = strtoupper($sLogLevel);
|
||||||
|
$sLogLevel = ((!empty($sLogLevel) && defined("Logger::$sLogLevel")) ? constant("Logger::$sLogLevel") : Logger::DEBUG);
|
||||||
|
self::$_aLogger[ $sLogger ] = new Logger($sLogger);
|
||||||
|
self::$_aLogger[ $sLogger ]->pushHandler(
|
||||||
|
new StreamHandler(
|
||||||
|
$sPath,
|
||||||
|
$sLogLevel
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$_aLogger[ $sLogger ];
|
||||||
|
}
|
||||||
|
}
|
34
README.md
34
README.md
@ -6,22 +6,35 @@ Free module for OXID eshop 6.
|
|||||||
|
|
||||||
Features
|
Features
|
||||||
|
|
||||||
- admin setting sitemap url
|
- set sitemap url in admin / or cli parameter
|
||||||
- admin setting security key (cronjob)
|
- optional basic auth user/password
|
||||||
- admin setting basic auth user/password
|
- optional csv logfile
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
|
|
||||||
1. composer config repo.ProudCommerce/CacheWarmer git https://github.com/Josef-A-Puckl/psCacheWarmer/
|
composer require proudcommerce/cachewarmer
|
||||||
2. composer require proudcommerce/cachewarmer
|
|
||||||
|
|
||||||
|
Usage
|
||||||
|
|
||||||
|
php source/modules/pc/cachewarmer/bin/warmup.php [optional parameter s for shop-id, eg. warmup.php -s 2 -f sitemaps/categories.xml]
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
-s: ShopId: -s 2
|
||||||
|
-f: Path to separte Sitemap: -f sitemaps/categories.xml
|
||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
2019-07-17 2.1.0 add error 500 check (PR #2)
|
2021-03-17 3.1.2 add new new parameter -f for separate File
|
||||||
2019-06-26 2.0.0 OXID eShop 6 (PR #1)
|
2020-09-15 3.1.1 readd ee shopurl fix (missing 3.0.1)
|
||||||
2016-10-12 1.0.1 fix reading sitemap url with user/pass,fix checking sitemap object
|
2020-09-14 3.1.0 add own logger
|
||||||
2016-08-25 1.0.0 module release for oxid 4.7, 4.8, 4.9, 4.10
|
2020-08-17 3.0.0 cli only, some improvements
|
||||||
|
2020-08-06 2.2.1 fix for OXID 6.2
|
||||||
|
2019-07-19 2.2.0 Write Report in a file (PR #3)
|
||||||
|
2019-07-17 2.1.0 add error 500 check (PR #2)
|
||||||
|
2019-06-26 2.0.0 OXID eShop 6 (PR #1)
|
||||||
|
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
|
||||||
|
|
||||||
License
|
License
|
||||||
|
|
||||||
@ -41,5 +54,4 @@ License
|
|||||||
|
|
||||||
Copyright
|
Copyright
|
||||||
|
|
||||||
Proud Sourcing GmbH 2016
|
ProudCommerce { www.proudcommerce.com }
|
||||||
www.proudcommerce.com / www.proudsourcing.de
|
|
||||||
|
42
bin/warmup.php
Normal file
42
bin/warmup.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @copyright (c) ProudCommerce | 2020
|
||||||
|
* @link www.proudcommerce.com
|
||||||
|
* @package psCacheWarmer
|
||||||
|
* @version 3.0.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
if (PHP_SAPI != 'cli') {
|
||||||
|
die('Only cli execution allowed!'."\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = getopt('s:f:');
|
||||||
|
$shopId = $options['s'] ?? 0;
|
||||||
|
if (!$shopId) {
|
||||||
|
$shopId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sFileSiteMap = $options['f'] ?? '';
|
||||||
|
if (!$sFileSiteMap) {
|
||||||
|
$sFileSitemap = '';
|
||||||
|
}
|
||||||
|
require_once dirname(__FILE__) . '/../../../../bootstrap.php';
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use ProudCommerce\CacheWarmer\Core\CacheWarmer;
|
||||||
|
|
||||||
|
echo 'Shop-ID '.$shopId." is used!\r\n";
|
||||||
|
if($sFileSiteMap != '') {
|
||||||
|
echo 'Sitemap: ' . $sFileSiteMap . " is used!\r\n";
|
||||||
|
}
|
||||||
|
Registry::getConfig()->setShopId($shopId);
|
||||||
|
Registry::set(Config::class, null);
|
||||||
|
|
||||||
|
|
||||||
|
$cacheWarmer = new CacheWarmer();
|
||||||
|
$cacheWarmer->run($sFileSiteMap);
|
@ -1,33 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "proudcommerce/cachewarmer",
|
"name": "proudcommerce/cachewarmer",
|
||||||
"version": "2.1.0",
|
"description": "Website anhand der XML-Sitemap automatisch aufrufen, z. B. zum 'Aufwärmen' eines Caches.",
|
||||||
"description": "psCacheWarmer",
|
"type": "oxideshop-module",
|
||||||
"type": "oxideshop-module",
|
"license": [
|
||||||
"license": [
|
"GPL-3.0-or-later"
|
||||||
"proprietary"
|
],
|
||||||
],
|
"authors": [
|
||||||
"authors": [
|
{
|
||||||
{
|
"name": "ProudCommerce",
|
||||||
"name": "ProudCommerce",
|
"homepage": "https://www.proudcommerce.com/",
|
||||||
"homepage": "https://www.proudcommerce.com/",
|
"email": "welcome@proudcommerce.com",
|
||||||
"email": "welcome@proudcommerce.com",
|
"role": "Developer"
|
||||||
"role": "Developer"
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"email": "support@proudcommerce.com"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">= 7.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"ProudCommerce\\CacheWarmer\\": "../../../source/modules/pc/cachewarmer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"oxideshop": {
|
||||||
|
"target-directory": "pc/cachewarmer"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"email": "support@proudcommerce.com"
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">= 7.0"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"ProudCommerce\\CacheWarmer\\": "../../../source/modules/proudsourcing/psCacheWarmer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"oxideshop": {
|
|
||||||
"target-directory": "proudsourcing/psCacheWarmer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
95
metadata.php
95
metadata.php
@ -4,12 +4,12 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* @copyright (c) Proud Sourcing GmbH | 2016
|
* @copyright (c) ProudCommerce | 2020
|
||||||
* @link www.proudcommerce.com
|
* @link www.proudcommerce.com
|
||||||
* @package psCacheWarmer
|
* @package psCacheWarmer
|
||||||
* @version 1.0.1
|
* @version 3.1.1
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata version
|
* Metadata version
|
||||||
@ -19,53 +19,68 @@ $sMetadataVersion = '2.0';
|
|||||||
/**
|
/**
|
||||||
* Module information
|
* Module information
|
||||||
*/
|
*/
|
||||||
$aModule = array(
|
$aModule = [
|
||||||
'id' => 'psCacheWarmer',
|
'id' => 'psCacheWarmer',
|
||||||
'title' => 'psCacheWarmer',
|
'title' => 'psCacheWarmer',
|
||||||
'description' => array(
|
'description' => [
|
||||||
'de' => 'Website anhand der XML-Sitemap automatisch aufrufen, z. B. zum "Aufwärmen" eines Caches.<br>
|
'de' => 'Website anhand der XML-Sitemap automatisch aufrufen, z. B. zum "Aufwärmen" eines Caches.',
|
||||||
<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>',
|
'en' => 'Automatically calling urls using the xml-sitemap, eg. for cache warmup.',
|
||||||
'en' => 'Automatically calling urls using the xml-sitemap, eg. for cache warming.
|
],
|
||||||
<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',
|
||||||
),
|
'version' => '3.1.2',
|
||||||
'thumbnail' => 'logo_pc-os.jpg',
|
'author' => 'ProudCommerce',
|
||||||
'version' => '2.1.0',
|
'url' => 'https://github.com/proudcommerce/psCacheWarmer',
|
||||||
'author' => 'Proud Sourcing GmbH',
|
'email' => '',
|
||||||
'url' => 'http://www.proudcommerce.com/',
|
'extend' => [
|
||||||
'email' => 'support@proudcommerce.com',
|
],
|
||||||
'extend' => array(
|
'controllers' => [
|
||||||
),
|
],
|
||||||
'controllers' => array(
|
'templates' => [
|
||||||
'pscachewarmer' => \ProudCommerce\CacheWarmer\Application\Controller\CacheWarmer::class,
|
],
|
||||||
),
|
'blocks' => [
|
||||||
'templates' => array(
|
],
|
||||||
),
|
'settings' => [
|
||||||
'blocks' => array(
|
[
|
||||||
),
|
|
||||||
'settings' => array(
|
|
||||||
array(
|
|
||||||
'group' => 'psCacheWarmerConfig',
|
'group' => 'psCacheWarmerConfig',
|
||||||
'name' => 'psCacheWarmerSitemapUrl',
|
'name' => 'psCacheWarmerSitemapUrl',
|
||||||
'type' => 'str',
|
'type' => 'str',
|
||||||
'value' => 'sitemap.xml',
|
'value' => 'sitemap.xml',
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'group' => 'psCacheWarmerConfig',
|
'group' => 'psCacheWarmerConfig',
|
||||||
'name' => 'psCacheWarmerKey',
|
'name' => 'psCacheWarmerKey',
|
||||||
'type' => 'str',
|
'type' => 'str',
|
||||||
'value' => md5(time()),
|
'value' => md5(time()),
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'group' => 'psCacheWarmerConfig',
|
'group' => 'psCacheWarmerConfig',
|
||||||
'name' => 'psCacheWarmerUser',
|
'name' => 'psCacheWarmerUser',
|
||||||
'type' => 'str',
|
'type' => 'str',
|
||||||
'value' => '',
|
'value' => '',
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'group' => 'psCacheWarmerConfig',
|
'group' => 'psCacheWarmerConfig',
|
||||||
'name' => 'psCacheWarmerPass',
|
'name' => 'psCacheWarmerPass',
|
||||||
'type' => 'str',
|
'type' => 'str',
|
||||||
'value' => '',
|
'value' => '',
|
||||||
),
|
],
|
||||||
),
|
[
|
||||||
);
|
'group' => 'psCacheWarmerConfig',
|
||||||
|
'name' => 'psCacheWarmerHttpCodes',
|
||||||
|
'type' => 'arr',
|
||||||
|
'value' => [200, 302],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'group' => 'psCacheWarmerConfig',
|
||||||
|
'name' => 'psCacheWarmerWriteCsv',
|
||||||
|
'type' => 'bool',
|
||||||
|
'value' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'group' => 'psCacheWarmerConfig',
|
||||||
|
'name' => 'psCacheWarmerWriteCsvOnlyError',
|
||||||
|
'type' => 'bool',
|
||||||
|
'value' => true,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* @copyright (c) Proud Sourcing GmbH | 2016
|
|
||||||
* @link www.proudcommerce.com
|
|
||||||
* @package psCacheWarmer
|
|
||||||
* @version 1.0.1
|
|
||||||
**/
|
|
||||||
$sLangName = "Deutsch";
|
|
||||||
// -------------------------------
|
|
||||||
// RESOURCE IDENTITFIER = STRING
|
|
||||||
// -------------------------------
|
|
||||||
$aLang = array(
|
|
||||||
'charset' => 'UTF-8',
|
|
||||||
|
|
||||||
'SHOP_MODULE_GROUP_psCacheWarmerConfig' => 'Einstellungen',
|
|
||||||
'SHOP_MODULE_psCacheWarmerSitemapUrl' => 'XML-Sitemap URL',
|
|
||||||
'SHOP_MODULE_psCacheWarmerKey' => 'Cronjob-Key',
|
|
||||||
'SHOP_MODULE_psCacheWarmerUser' => 'Basic-Auth Benutzer',
|
|
||||||
'SHOP_MODULE_psCacheWarmerPass' => 'Basic-Auth Kennwort',
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
[{ oxmultilang ident="GENERAL_YOUWANTTODELETE" }]
|
|
||||||
*/
|
|
Laden…
x
Verwijs in nieuw issue
Block a user