From 3fdba1318ba66d52b248d0320d7f80c67c0a211f Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Sun, 17 Aug 2014 16:12:50 +0700 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D1=87=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D0=BA=D1=80=D0=BE=D0=BD=20-=20=D0=BE=D1=87=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=BA=D0=B0=20=D1=81=D1=82=D0=B0=D1=80=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=20=D0=BA=D0=B5=D1=88=D0=B0=20=D0=B8=20=D1=80=D0=B0=D1=81=D1=81?= =?UTF-8?q?=D1=8B=D0=BB=D0=BA=D0=B0=20=D0=B5=D0=BC=D0=B0=D0=B9=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/modules/tools/Tools.class.php | 32 ++++++++++- .../install/data/sql/patch_1.0.3_to_2.0.0.sql | 7 ++- application/utilities/cron/notify.php | 53 ------------------- application/utilities/cron/template.php | 43 --------------- framework | 2 +- 5 files changed, 38 insertions(+), 99 deletions(-) delete mode 100644 application/utilities/cron/notify.php delete mode 100644 application/utilities/cron/template.php 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