psCacheWarmer/assets/warmup.php

45 lignes
1.1 KiB
PHP
Brut Vue normale Historique

2020-08-17 15:13:10 +02:00
<?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");
}
2021-03-17 15:10:26 +01:00
$options = getopt('s:f:');
2020-08-17 15:13:10 +02:00
$shopId = $options['s'] ?? 0;
if (!$shopId) {
$shopId = 1;
}
2021-03-17 15:10:26 +01:00
$sFileSiteMap = $options['f'] ?? '';
if (!$sFileSiteMap) {
$sFileSitemap = '';
}
2025-01-14 14:46:39 +01:00
require_once ('../../../../source/bootstrap.php');
2020-08-17 15:13:10 +02:00
2025-01-14 10:42:36 +01:00
use OxidEsales\Eshop\Core\Config;
2020-08-17 15:13:10 +02:00
use OxidEsales\Eshop\Core\Registry;
use ProudCommerce\CacheWarmer\Core\CacheWarmer;
echo 'Shop-ID '.$shopId." is used!\r\n";
2021-03-17 15:10:26 +01:00
if($sFileSiteMap != '') {
echo 'Sitemap: ' . $sFileSiteMap . " is used!\r\n";
}
2020-08-17 15:13:10 +02:00
Registry::getConfig()->setShopId($shopId);
Registry::set(Config::class, null);
2021-03-17 15:10:26 +01:00
2020-08-17 15:13:10 +02:00
$cacheWarmer = new CacheWarmer();
2021-03-17 15:10:26 +01:00
$cacheWarmer->run($sFileSiteMap);