Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
livefeedindexcomment.php
1
<?
2
namespace
Bitrix\Wiki\Update
;
3
4
use \Bitrix\Main\Update\Stepper;
5
use \Bitrix\Main\Localization\Loc;
6
use \Bitrix\Socialnetwork\Item\LogIndex;
7
use \Bitrix\Socialnetwork\LogCommentTable;
8
use \Bitrix\Socialnetwork\LogIndexTable;
9
use \Bitrix\Main\Config\Option;
10
use \Bitrix\Main\Loader;
11
12
Loc::loadMessages
(__FILE__);
13
14
final
class
LivefeedIndexComment
extends
Stepper
15
{
16
protected
static
$moduleId
=
"wiki"
;
17
18
public
function
execute
(array &$result)
19
{
20
if
(!(
21
Loader::includeModule(
"forum"
)
22
&& Loader::includeModule(
"socialnetwork"
)
23
&& Option::get(
'wiki'
,
'needLivefeedIndexComment'
,
'Y'
) ==
'Y'
24
))
25
{
26
return
false
;
27
}
28
29
$return =
false
;
30
31
$params = Option::get(
"wiki"
,
"livefeedindexcomment"
,
""
);
32
$params = ($params !==
""
? @unserialize($params, [
"allowed_classes"
=>
false
]) : array());
33
$params = (is_array($params) ? $params : array());
34
if
(empty($params))
35
{
36
$params = array(
37
"lastId"
=> 0,
38
"number"
=> 0,
39
"count"
=> LogCommentTable::getCount(
40
array(
41
'=EVENT_ID'
=>
"wiki_comment"
,
42
'!SOURCE_ID'
=>
false
43
)
44
)
45
);
46
}
47
48
if
($params[
"count"
] > 0)
49
{
50
$result[
"title"
] =
Loc::getMessage
(
"FUPD_LF_WIKI_COMMENT_EVENT_INDEX_TITLE"
);
51
$result[
"progress"
] = 1;
52
$result[
"steps"
] =
""
;
53
$result[
"count"
] = $params[
"count"
];
54
55
$res = LogCommentTable::getList(array(
56
'order'
=> array(
'ID'
=>
'ASC'
),
57
'filter'
=> array(
58
'>ID'
=> $params[
"lastId"
],
59
'=EVENT_ID'
=>
"wiki_comment"
,
60
'!SOURCE_ID'
=>
false
61
),
62
'select'
=> array(
'ID'
,
'EVENT_ID'
,
'SOURCE_ID'
),
63
'offset'
=> 0,
64
'limit'
=> 100
65
));
66
67
$found =
false
;
68
while
($record = $res->fetch())
69
{
70
LogIndex::setIndex(array(
71
'itemType'
=> LogIndexTable::ITEM_TYPE_COMMENT,
72
'itemId'
=> $record[
'ID'
],
73
'fields'
=> $record
74
));
75
76
$params[
"lastId"
] = $record[
'ID'
];
77
$params[
"number"
]++;
78
$found =
true
;
79
}
80
81
if
($found)
82
{
83
Option::set(
"wiki"
,
"livefeedindexcomment"
, serialize($params));
84
$return =
true
;
85
}
86
87
$result[
"progress"
] = intval($params[
"number"
] * 100/ $params[
"count"
]);
88
$result[
"steps"
] = $params[
"number"
];
89
90
if
($found ===
false
)
91
{
92
Option::delete(
"wiki"
, array(
"name"
=>
"livefeedindexcomment"
));
93
Option::set(
'wiki'
,
'needLivefeedIndexComment'
,
'N'
);
94
}
95
}
96
return
$return;
97
}
98
}
99
?>
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\Update\Stepper
Definition
stepper.php:27
Bitrix\Wiki\Update\LivefeedIndexComment
Definition
livefeedindexcomment.php:15
Bitrix\Wiki\Update\LivefeedIndexComment\execute
execute(array &$result)
Definition
livefeedindexcomment.php:18
Bitrix\Wiki\Update\LivefeedIndexComment\$moduleId
static $moduleId
Definition
livefeedindexcomment.php:16
Bitrix\Wiki\Update
Definition
livefeedindexcomment.php:2
modules
wiki
lib
update
livefeedindexcomment.php
Создано системой
1.10.0