Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userstepper.php
1
<?
2
namespace
Bitrix\Main\Update
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\Config\Option
;
6
7
Loc::loadMessages
(__FILE__);
8
9
final
class
UserStepper
extends
Stepper
10
{
11
const
OPTION_NAME
=
"main_index_user"
;
12
protected
static
$moduleId
=
"main"
;
13
17
public
function
execute
(array &$result)
18
{
19
$return =
false
;
20
21
$params = Option::get(self::$moduleId, self::OPTION_NAME,
""
);
22
$params = ($params !==
""
? @unserialize($params, [
'allowed_classes'
=>
false
]) : array());
23
$params = (is_array($params) ? $params : array());
24
if
(empty($params))
25
{
26
$params = array(
27
"lastId"
=> 0,
28
"number"
=> 0,
29
"count"
=> \
Bitrix
\Main\
UserTable::getCount
(),
30
);
31
}
32
33
if
($params[
"count"
] > 0)
34
{
35
$result[
"title"
] =
Loc::getMessage
(
"MAIN_UPDATE_USER_INDEX"
);
36
$result[
"progress"
] = 1;
37
$result[
"steps"
] =
""
;
38
$result[
"count"
] = $params[
"count"
];
39
40
$cursor = \Bitrix\Main\UserTable::getList(array(
41
'order'
=> array(
'ID'
=>
'ASC'
),
42
'filter'
=> array(
43
'>ID'
=> $params[
"lastId"
],
44
),
45
'select'
=> array(
'ID'
),
46
'offset'
=> 0,
47
'limit'
=> 100
48
));
49
50
$found =
false
;
51
while
($row = $cursor->fetch())
52
{
53
\Bitrix\Main\UserTable::indexRecord($row[
'ID'
]);
54
55
$params[
"lastId"
] = $row[
'ID'
];
56
$params[
"number"
]++;
57
$found =
true
;
58
}
59
60
if
($found)
61
{
62
Option::set(self::$moduleId, self::OPTION_NAME, serialize($params));
63
$return =
true
;
64
}
65
66
$result[
"progress"
] = intval($params[
"number"
] * 100/ $params[
"count"
]);
67
$result[
"steps"
] = $params[
"number"
];
68
69
if
($found ===
false
)
70
{
71
Option::delete(self::$moduleId, array(
"name"
=> self::OPTION_NAME));
72
}
73
}
74
return
$return;
75
}
76
}
77
?>
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Localization\Loc
Definition
loc.php:11
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\ORM\Data\DataManager\getCount
static getCount($filter=array(), array $cache=array())
Definition
datamanager.php:526
Bitrix\Main\Update\Stepper
Definition
stepper.php:27
Bitrix\Main\Update\UserStepper
Definition
userstepper.php:10
Bitrix\Main\Update\UserStepper\execute
execute(array &$result)
Definition
userstepper.php:17
Bitrix\Main\Update\UserStepper\$moduleId
static $moduleId
Definition
userstepper.php:12
Bitrix\Main\Update\UserStepper\OPTION_NAME
const OPTION_NAME
Definition
userstepper.php:11
Bitrix\Main\Update
Definition
adminfilteroption.php:2
Bitrix
modules
main
lib
update
userstepper.php
Создано системой
1.10.0