first commit
This commit is contained in:
37
modules/gm_omniprice/cron.php
Normal file
37
modules/gm_omniprice/cron.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
$start = microtime(true);
|
||||
require('template.php');
|
||||
require_once('../../config/config.inc.php');
|
||||
|
||||
$omni = Module::getInstanceByName('gm_omniprice');
|
||||
$token = Tools::getValue('token');
|
||||
$comparedToken = Tools::getAdminToken('gm_omniprice');
|
||||
if ($token != $comparedToken) {
|
||||
die('invalid token');
|
||||
}
|
||||
if (Tools::isSubmit('reset')) {
|
||||
$omni->resetIndex();
|
||||
echo 'RESET</br>';
|
||||
}
|
||||
$productId = null;
|
||||
if (Tools::isSubmit('pid')) {
|
||||
$productId = (int) Tools::getValue('pid');
|
||||
$omni->removeProductFromTodaysIndex($productId);
|
||||
$omni->removeProductFromTodaysHistory($productId);
|
||||
}
|
||||
$omni->savePrices(true, $productId);
|
||||
echo 'FINISH<br/>';
|
||||
if (Tools::isSubmit('debug')) {
|
||||
echo 'DEBUG:<br/>';
|
||||
$debug = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'gm_omniprice_history` WHERE `id_product` = ' . $productId);
|
||||
if ($debug) {
|
||||
echo $omni->displayTable($debug, array_keys($debug[0]));
|
||||
}
|
||||
$debug = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'gm_omniprice_cache` WHERE `id_product` = ' . $productId);
|
||||
if ($debug) {
|
||||
echo $omni->displayTable($debug, array_keys($debug[0]));
|
||||
}
|
||||
}
|
||||
$timeElapsedSeconds = microtime(true) - $start;
|
||||
echo round($timeElapsedSeconds, 4) . ' s<br/>';
|
||||
Reference in New Issue
Block a user