-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcron.php
34 lines (27 loc) · 1.01 KB
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/
require_once dirname(__FILE__) . "/../../../bootstrap.php";
function canRunCronjob() {
if(empty($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['HTTP_USER_AGENT']) && count($_SERVER['argv']) > 0) {
// is called by php cli
return true;
}
$sSecureKey = \OxidEsales\Eshop\Core\Registry::getRequest()->getRequestEscapedParameter("secureKey");
if (!empty($sSecureKey) && $sSecureKey == \OxidEsales\Eshop\Core\Registry::getConfig()->getShopConfVar('sStripeCronSecureKey')) {
// is called via webserver and secureKey param is given and matches configured secure key
return true;
}
return false;
}
if (canRunCronjob() === false) {
die('Permission denied');
}
$iShopId = false;
if (isset($argv[1]) && is_numeric($argv[1])) {
$iShopId = $argv[1];
}
$oScheduler = oxNew(\OxidSolutionCatalysts\Stripe\Application\Model\Cronjob\Scheduler::class);
$oScheduler->start($iShopId);