add empik module
This commit is contained in:
37
modules/empikmarketplace/controllers/front/cron.php
Normal file
37
modules/empikmarketplace/controllers/front/cron.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Empik\Marketplace\Exception\InvalidActionException;
|
||||
use Empik\Marketplace\Handler\CronJobsHandler;
|
||||
|
||||
class EmpikMarketplaceCronModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
/** @var EmpikMarketplace */
|
||||
public $module;
|
||||
|
||||
/** @var CronJobsHandler */
|
||||
protected $cronJobsHandler;
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->cronJobsHandler = $this->module->getService('empik.marketplace.handler.cronJobs');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->cronJobsHandler->checkToken(Tools::getValue('token'))) {
|
||||
try {
|
||||
$this->cronJobsHandler->handle(Tools::getValue('action'));
|
||||
|
||||
die($this->module->l('Job complete'));
|
||||
} catch (InvalidActionException $exception) {
|
||||
die($this->module->l('Unknown action'));
|
||||
} catch (Exception $exception) {
|
||||
die(sprintf($this->module->l('Job failed: %s'), $exception->getMessage()));
|
||||
}
|
||||
} else {
|
||||
die($this->module->l('Invalid token'));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
modules/empikmarketplace/controllers/front/index.php
Normal file
11
modules/empikmarketplace/controllers/front/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user