diff --git a/application/classes/modules/tools/Tools.class.php b/application/classes/modules/tools/Tools.class.php index 6c0fe219..6edd5e6f 100644 --- a/application/classes/modules/tools/Tools.class.php +++ b/application/classes/modules/tools/Tools.class.php @@ -128,7 +128,15 @@ class ModuleTools extends Module { } return $sText; } - + /** + * Отдает файл на загрузку в браузер пользователя + * + * @param $sFilePath + * @param $sFileName + * @param null $iFileSize + * + * @return bool + */ public function DownloadFile($sFilePath,$sFileName,$iFileSize=null) { if (file_exists($sFilePath) and $file=fopen($sFilePath,"r")) { header("Content-Type: application/octet-stream"); @@ -145,4 +153,26 @@ class ModuleTools extends Module { } return false; } + /** + * Запускает задачу рассылки емайлов (отложенная отправка) + */ + public function SystemTaskNotify() { + $aNotifyTasks = $this->Notify_GetTasksDelayed(Config::Get('module.notify.per_process')); + if(!$aNotifyTasks) { + return 'empty'; + } + /** + * Последовательно загружаем задания + */ + $aArrayId=array(); + foreach ($aNotifyTasks as $oTask) { + $this->Notify_SendTask($oTask); + $aArrayId[]=$oTask->getTaskId(); + } + /** + * Удаляем отработанные задания + */ + $this->Notify_DeleteTaskByArrayId($aArrayId); + return "Send notify: ".count($aArrayId); + } } \ No newline at end of file diff --git a/application/install/data/sql/patch_1.0.3_to_2.0.0.sql b/application/install/data/sql/patch_1.0.3_to_2.0.0.sql index d4eeedae..b1d5a531 100644 --- a/application/install/data/sql/patch_1.0.3_to_2.0.0.sql +++ b/application/install/data/sql/patch_1.0.3_to_2.0.0.sql @@ -627,4 +627,9 @@ CREATE TABLE IF NOT EXISTS `prefix_cron_task` ( KEY `plugin` (`plugin`), KEY `method` (`method`(255)), KEY `period_run` (`period_run`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +-- 17.08.2014 +INSERT INTO `prefix_cron_task` (`id`, `title`, `method`, `plugin`, `state`, `count_run`, `period_run`, `date_create`, `date_run_last`) VALUES (NULL, 'Отложенная отправка емайлов', 'Tools_SystemTaskNotify', '', '1', '0', '2', '2014-08-17 00:00:00', NULL); +INSERT INTO `prefix_cron_task` (`id`, `title`, `method`, `plugin`, `state`, `count_run`, `period_run`, `date_create`, `date_run_last`) VALUES (NULL, 'Удаление старого кеша данных', 'Cache_ClearOldCache', '', '1', '0', '1500', '2014-08-17 00:00:00', NULL); \ No newline at end of file diff --git a/application/utilities/cron/notify.php b/application/utilities/cron/notify.php deleted file mode 100644 index 9f95cd44..00000000 --- a/application/utilities/cron/notify.php +++ /dev/null @@ -1,53 +0,0 @@ -Notify_GetTasksDelayed(Config::Get('module.notify.per_process')); - - if(empty($aNotifyTasks)) { - $this->Log("No tasks are found."); - return; - } - /** - * Последовательно загружаем задания на публикацию - */ - $aArrayId=array(); - foreach ($aNotifyTasks as $oTask) { - $this->Notify_SendTask($oTask); - $aArrayId[]=$oTask->getTaskId(); - } - $this->Log("Send notify: ".count($aArrayId)); - /** - * Удаляем отработанные задания - */ - $this->Notify_DeleteTaskByArrayId($aArrayId); - } -} - -$sLockFilePath=Config::Get('sys.cache.dir').'CronNotify.lock'; -/** - * Создаем объект крон-процесса, - * передавая параметром путь к лок-файлу - */ -$app=new CronNotify($sLockFilePath); -print $app->Exec(); \ No newline at end of file diff --git a/application/utilities/cron/template.php b/application/utilities/cron/template.php deleted file mode 100644 index e7300176..00000000 --- a/application/utilities/cron/template.php +++ /dev/null @@ -1,43 +0,0 @@ -Log("Cache files count: ".count($aFiles)); - - foreach ($aFiles as $sFilePath) { - @unlink($sFilePath); - } - } -} - -/** - * Создаем объект крон-процесса - */ -$app=new CronTemplateCacheClean(); -print $app->Exec(); \ No newline at end of file diff --git a/framework b/framework index 5f4f0fc4..9c87dad0 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 5f4f0fc412f26ee1725e16260404ff9ef03c9f70 +Subproject commit 9c87dad040c61d82c05d46a336561fff0d163eb6