1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00
ifhub.club/application/utilities/cron/notify.php

53 lines
1.5 KiB
PHP
Raw Normal View History

<?php
/*-------------------------------------------------------
*
* LiveStreet Engine Social Networking
* Copyright © 2008 Mzhelskiy Maxim
*
*--------------------------------------------------------
*
* Official site: www.livestreet.ru
* Contact e-mail: rus.engine@gmail.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
---------------------------------------------------------
*/
2014-06-11 13:52:44 +03:00
require_once(dirname(dirname(dirname(__DIR__))).'/bootstrap/start.php');
2014-06-11 13:52:44 +03:00
class CronNotify extends Cron {
/**
* Выбираем пул заданий и рассылаем по ним e-mail
*/
public function Client() {
2011-04-27 10:44:28 +03:00
$aNotifyTasks = $this->Notify_GetTasksDelayed(Config::Get('module.notify.per_process'));
if(empty($aNotifyTasks)) {
2011-04-27 10:44:28 +03:00
$this->Log("No tasks are found.");
return;
}
/**
* Последовательно загружаем задания на публикацию
*/
$aArrayId=array();
foreach ($aNotifyTasks as $oTask) {
2011-04-27 10:44:28 +03:00
$this->Notify_SendTask($oTask);
$aArrayId[]=$oTask->getTaskId();
}
2011-04-27 10:44:28 +03:00
$this->Log("Send notify: ".count($aArrayId));
/**
* Удаляем отработанные задания
*/
2011-04-27 10:44:28 +03:00
$this->Notify_DeleteTaskByArrayId($aArrayId);
}
}
2014-06-11 13:52:44 +03:00
$sLockFilePath=Config::Get('sys.cache.dir').'CronNotify.lock';
/**
* Создаем объект крон-процесса,
* передавая параметром путь к лок-файлу
*/
2014-06-11 13:52:44 +03:00
$app=new CronNotify($sLockFilePath);
print $app->Exec();