first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View 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'));
}
}
}