1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
topicservicecounter.php
См. документацию.
1
<?
2
namespace
Bitrix\Forum\Update;
3
4
use \Bitrix\Main\Update\Stepper;
5
use \Bitrix\Forum\Integration;
6
use \Bitrix\Main\Loader;
7
use \Bitrix\Main;
8
use \Bitrix\Forum\MessageTable;
9
10
class
TopicServiceCounter
extends
Stepper
11
{
12
protected
static
$moduleId
=
"forum"
;
13
protected
const
TOPIC_LIMIT
= 100;
14
15
public
function
execute
(
array
&
$result
)
16
{
17
if
(!
Loader::includeModule
(
"forum"
))
18
{
19
return
self::finishExecution
();
20
}
21
22
if
(
Main
\
Config
\Option::get(
"forum"
,
"LivefeedConvertServiceMessageStepper"
) ===
"inProgress"
)
23
{
24
return
self::CONTINUE_EXECUTION;
25
}
26
27
if
(!array_key_exists(
"lastId"
,
$result
) || (
int
)
$result
[
"lastId"
] <= 0)
28
{
29
$result
[
"lastId"
] = 0;
30
31
$res
= MessageTable::getList([
32
"select"
=> [
"CNT"
],
33
"filter"
=> [
34
'>SERVICE_TYPE'
=> 0
35
],
36
'runtime'
=> [
37
new
\
Bitrix
\
Main
\
Entity
\
ExpressionField
(
'CNT'
,
'COUNT(*)'
)
38
]
39
]);
40
$topicData =
$res
->fetch();
41
$result
[
"count"
] = (int)$topicData[
'CNT'
];
42
}
43
44
$filter
= [
45
'>SERVICE_TYPE'
=> 0
46
];
47
if
(
$result
[
"lastId"
] > 0)
48
{
49
$filter
[
"<TOPIC_ID"
] =
$result
[
"lastId"
];
50
}
51
52
Main\Config\Option::set
(
"forum"
,
"TopicServiceCounterStepper"
,
"inProgress"
);
53
54
$lastId
= 0;
55
56
$res
= MessageTable::getList([
57
"select"
=> [
"TOPIC_ID"
,
"CNT"
],
58
"filter"
=>
$filter
,
59
'runtime'
=> [
60
new
\
Bitrix
\
Main
\
Entity
\
ExpressionField
(
'CNT'
,
'COUNT(*)'
)
61
],
62
"group"
=> [
"TOPIC_ID"
],
63
"limit"
=> self::TOPIC_LIMIT,
64
"order"
=> [
"TOPIC_ID"
=>
"DESC"
]
65
]);
66
while
($topicData =
$res
->fetch())
67
{
68
$topic = \Bitrix\Forum\EO_Topic::wakeUp($topicData[
"TOPIC_ID"
]);
69
$topic->setPostsService($topicData[
"CNT"
]);
70
$topic->save();
71
$lastId
= $topicData[
"TOPIC_ID"
];
72
}
73
74
if
(
$lastId
> 0)
75
{
76
$result
[
"lastId"
] =
$lastId
;
77
}
78
else
79
{
80
return
self::finishExecution
();
81
}
82
83
return
self::CONTINUE_EXECUTION;
84
}
85
86
protected
static
function
finishExecution
()
87
{
88
Main\Config\Option::delete
(
"forum"
, [
"name"
=>
"TopicServiceCounterStepper"
]);
89
return
self::FINISH_EXECUTION;
90
}
91
}
92
?>
Bitrix\Forum\Update\TopicServiceCounter
Определения
topicservicecounter.php:11
Bitrix\Forum\Update\TopicServiceCounter\finishExecution
static finishExecution()
Определения
topicservicecounter.php:86
Bitrix\Forum\Update\TopicServiceCounter\execute
execute(array &$result)
Определения
topicservicecounter.php:15
Bitrix\Forum\Update\TopicServiceCounter\TOPIC_LIMIT
const TOPIC_LIMIT
Определения
topicservicecounter.php:13
Bitrix\Forum\Update\TopicServiceCounter\$moduleId
static $moduleId
Определения
topicservicecounter.php:12
Bitrix\Main\Config\Option\delete
static delete($moduleId, array $filter=array())
Определения
option.php:388
Bitrix\Main\Config\Option\set
static set($moduleId, $name, $value="", $siteId="")
Определения
option.php:261
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Main\ORM\Fields\ExpressionField
Определения
expressionfield.php:25
Bitrix\Main\Update\Stepper
Определения
stepper.php:29
$lastId
if(!\Bitrix\Main\Loader::includeModule('clouds')) $lastId
Определения
sync.php:68
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$res
$res
Определения
filter_act.php:7
$result
$result
Определения
get_property_values.php:14
$filter
$filter
Определения
iblock_catalog_list.php:54
Bitrix\Main\Config
Определения
configuration.php:3
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main
Bitrix
bitrix
modules
forum
lib
update
topicservicecounter.php
Создано системой
1.14.0