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