43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
#!/usr/bin/php
|
|
<?php
|
|
|
|
//require 'vendor/autoload.php';
|
|
require("../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
define("INTERNAL_USER_ID", 1);
|
|
$me = new User(1);
|
|
|
|
foreach(PreordernotificationModel::search(["send_finish" => null, "send_lock" => null]) as $notification) {
|
|
// check tosend date
|
|
if(!$notification->tosend_date || $notification->tosend_date > date('U')) continue;
|
|
|
|
// get notification again from DB in case send_lock was set
|
|
$notification = new Preordernotification($notification->id);
|
|
if($notification->send_lock) continue;
|
|
|
|
// first of all set send lock and start date
|
|
$mypid = getmypid();
|
|
if(!$notification->send_start) {
|
|
$notification->send_start = date("U");
|
|
}
|
|
$notification->send_lock = ($mypid) ? $mypid : 1;
|
|
$notification->save();
|
|
|
|
foreach($notification->getPreorders() as $preorder) {
|
|
$notification->sendToPreorder($preorder);
|
|
}
|
|
|
|
// get notification from DB again and update send lock and finish date
|
|
$notification = new Preordernotification($notification->id);
|
|
$notification->send_finish = date('U');
|
|
$notification->send_lock = null;
|
|
$notification->save();
|
|
|
|
} |