Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
forum.php
1<?
3
6
8{
9 protected static $limit = 1;
10 protected static $moduleId = "forum";
11
12 public static function getTitle()
13 {
14 return Loc::getMessage("FORUM_STEPPER_TITLE");
15 }
16
17 public function execute(array &$option)
18 {
19 $option["steps"] = 1;
20 $option["count"] = 1;
21 if (self::do() > 0)
22 {
23 return self::FINISH_EXECUTION;
24 }
25 return self::CONTINUE_EXECUTION;
26 }
27
28 private static function do()
29 {
30 $limit = self::$limit;
31 $dbRes = Main\Application::getConnection()->query(<<<SQL
32SELECT ID, ENTITY_ID
33FROM b_forum_service_statistic_queue
34WHERE ENTITY_TYPE='FORUM'
35ORDER BY ID ASC
36LIMIT {$limit}
37SQL
38 );
39
40 $last = null;
41 while ($res = $dbRes->fetch())
42 {
43 \Bitrix\Forum\Forum::getById($res["ENTITY_ID"])->calculateStatistic();
44 $last = $res;
45 }
46
47 if ($last)
48 {
49 Main\Application::getConnection()->queryExecute(<<<SQL
50DELETE FROM b_forum_service_statistic_queue WHERE ID >= {$last['ID']} AND ENTITY_TYPE='FORUM'
51SQL
52 );
53 }
54 return $limit;
55 }
56
57 public static function run(int $forumId)
58 {
59 Main\Application::getConnection()->queryExecute(<<<SQL
60INSERT IGNORE INTO b_forum_service_statistic_queue (ENTITY_TYPE, ENTITY_ID) VALUES ('FORUM', {$forumId});
61SQL
62 );
63 self::bind(0);
64 }
65}
static run(int $forumId)
Definition forum.php:57
execute(array &$option)
Definition forum.php:17
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29