diff --git a/admin/inc/header.php b/admin/inc/header.php index 86e9e69..47f44ed 100644 --- a/admin/inc/header.php +++ b/admin/inc/header.php @@ -208,7 +208,8 @@

- + +
diff --git a/admin/threads.php b/admin/threads.php index 65308bc..96b7808 100644 --- a/admin/threads.php +++ b/admin/threads.php @@ -45,7 +45,7 @@ getCountTasks();?> getCountTasks(['active' => 'Y', 'in_progress' => 'N']);?> getCountTasks(['active' => 'Y', 'in_progress' => 'Y']);?> - getCountTasks(['active' => 'N', 'in_progress' => 'N', 'status' => MQ::STATUS_ERROR]);?> + getCountTasks(['in_progress' => 'N', 'status' => MQ::STATUS_ERROR]);?> diff --git a/core/SQL_DUMPS/threads.sql b/core/SQL_DUMPS/threads.sql index 84fabbb..8382160 100644 --- a/core/SQL_DUMPS/threads.sql +++ b/core/SQL_DUMPS/threads.sql @@ -1,20 +1,19 @@ CREATE TABLE `threads` ( -`id` int(11) NOT NULL, -`active` varchar(1) NOT NULL DEFAULT 'N', -`in_progress` varchar(1) NOT NULL DEFAULT 'N', -`executed` varchar(1) NOT NULL DEFAULT 'N', -`execution_time` varchar(255) DEFAULT NULL, -`attempts` int(11) NOT NULL, -`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, -`date_updated` datetime DEFAULT NULL, -`class` varchar(255) DEFAULT NULL, -`method` varchar(255) DEFAULT NULL, -`params` text, -`status` varchar(255) DEFAULT NULL, -`response` text + `id` int(11) NOT NULL, + `active` varchar(1) NOT NULL DEFAULT 'N', + `in_progress` varchar(1) NOT NULL DEFAULT 'N', + `priority` int(11) DEFAULT NULL, + `execution_time` varchar(255) DEFAULT NULL, + `attempts` int(11) NOT NULL, + `attempts_limit` int(11) DEFAULT '1', + `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `date_updated` datetime DEFAULT NULL, + `class` varchar(255) DEFAULT NULL, + `method` varchar(255) DEFAULT NULL, + `params` text, + `status` varchar(255) DEFAULT NULL, + `response` text ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`); - -ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17923; +ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78989; COMMIT; \ No newline at end of file diff --git a/core/lib/Core/Models/MQ.class.php b/core/lib/Core/Models/MQ.class.php index 8c63a8b..2d38cc5 100644 --- a/core/lib/Core/Models/MQ.class.php +++ b/core/lib/Core/Models/MQ.class.php @@ -398,7 +398,7 @@ 'active' => self::VALUE_N, 'in_progress' => self::VALUE_N, 'attempts' => '0', - 'attempts_limit' => $this->attempts, + 'attempts_limit' => $this->runNow ? '1' : $this->attempts, // Если запускаем немедленно, то попытка одна 'class' => !empty($class) ? addslashes($class) : '', 'method' => $method, 'priority' => $priority, @@ -504,11 +504,11 @@ } if (!empty($arTask['class']) && !method_exists($arTask['class'], $arTask['method'])) { - throw new CoreException('Класс или метод не определен, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND); + throw new CoreException('Класс или метод не существует, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND); } if (empty($arTask['class']) && !empty($arTask['method']) && !function_exists($arTask['method'])) { - throw new CoreException('Функция не определена, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND); + throw new CoreException('Функция не существует, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND); } if (empty($arTask['class'])) { @@ -572,7 +572,7 @@ ); // TODO: Следующая строка нужна больше для отладки - в дальнейшем нужно удалить ее - echo 'Exception: ' . $t->getFile() . ' в строке ' . $t->getLine() . PHP_EOL . $t->getMessage() . PHP_EOL; + //echo 'Exception: ' . $t->getFile() . ' в строке ' . $t->getLine() . PHP_EOL . $t->getMessage() . PHP_EOL; } return $response; diff --git a/core/migrations/000006_threads.sql b/core/migrations/000006_threads.sql index 8d88790..aa19292 100644 --- a/core/migrations/000006_threads.sql +++ b/core/migrations/000006_threads.sql @@ -1,10 +1,11 @@ -CREATE TABLE if not exists `threads` ( +CREATE TABLE `threads` ( `id` int(11) NOT NULL, `active` varchar(1) NOT NULL DEFAULT 'N', `in_progress` varchar(1) NOT NULL DEFAULT 'N', - `executed` varchar(1) NOT NULL DEFAULT 'N', + `priority` int(11) DEFAULT NULL, `execution_time` varchar(255) DEFAULT NULL, `attempts` int(11) NOT NULL, + `attempts_limit` int(11) DEFAULT '1', `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_updated` datetime DEFAULT NULL, `class` varchar(255) DEFAULT NULL, @@ -14,4 +15,4 @@ CREATE TABLE if not exists `threads` ( `response` text ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`); -ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17923; \ No newline at end of file +ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78989; \ No newline at end of file