1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
createsearchcontentstepper.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Bizproc\Worker\Task;
4
5
use Bitrix\Bizproc\Workflow\Task\TaskSearchContentTable;
6
use Bitrix\Bizproc\Workflow\Task\TaskTable;
7
use Bitrix\Main;
8
9
class
CreateSearchContentStepper
extends
Main\Update\Stepper
10
{
11
protected
static
$moduleId
=
'bizproc'
;
12
13
private
const
STEP_ROWS_LIMIT = 100;
14
15
public
function
execute
(
array
&
$option
)
16
{
17
$lastId
= (int)($this->
getOuterParams
()[0] ?? 0);
//deprecated
18
$lastModifiedOption = (int)($this->
getOuterParams
()[1] ?? 0);
19
20
$oldDate =
Main\Type\Date::createFromTimestamp
(time() - 180 * 86400);
21
22
$taskQuery = TaskTable::query();
23
$taskQuery->setSelect([
'ID'
,
'WORKFLOW_ID'
,
'MODIFIED'
,
'NAME'
,
'DESCRIPTION'
]);
24
$taskQuery->setOrder([
'MODIFIED'
=>
'DESC'
]);
25
$taskQuery->setLimit(self::STEP_ROWS_LIMIT);
26
$taskQuery->where(
'MODIFIED'
,
'>'
, $oldDate);
27
28
if
($lastModifiedOption > 0)
29
{
30
$taskQuery->where(
'MODIFIED'
,
'<='
,
Main
\
Type
\DateTime::createFromTimestamp($lastModifiedOption));
31
}
32
33
$taskResult = $taskQuery->exec();
34
$modified =
null
;
35
36
while
($row = $taskResult->fetch())
37
{
38
$modified = $row[
'MODIFIED'
];
39
try
40
{
41
TaskSearchContentTable::add([
42
'TASK_ID'
=> $row[
'ID'
],
43
'WORKFLOW_ID'
=> $row[
'WORKFLOW_ID'
],
44
'SEARCH_CONTENT'
=> $row[
'NAME'
] .
' '
. $row[
'DESCRIPTION'
],
45
]);
46
}
47
catch
(
Main
\
DB
\
SqlQueryException
$e)
48
{
49
//duplicate, ignore
50
}
51
}
52
53
$lastModified = $modified instanceof
Main\Type\DateTime
? $modified->
getTimestamp
() :
null
;
54
55
if
($lastModified ===
null
)
56
{
57
return
self::FINISH_EXECUTION;
58
}
59
60
if
($lastModified === $lastModifiedOption)
61
{
62
--$lastModified;
// step one second
63
}
64
65
$this->
setOuterParams
([
$lastId
, $lastModified]);
66
67
return
self::CONTINUE_EXECUTION;
68
}
69
}
Bitrix\Bizproc\Worker\Task\CreateSearchContentStepper
Определения
createsearchcontentstepper.php:10
Bitrix\Bizproc\Worker\Task\CreateSearchContentStepper\execute
execute(array &$option)
Определения
createsearchcontentstepper.php:15
Bitrix\Bizproc\Worker\Task\CreateSearchContentStepper\$moduleId
static $moduleId
Определения
createsearchcontentstepper.php:11
Bitrix\Main\DB\SqlQueryException
Определения
sqlqueryexception.php:9
Bitrix\Main\Type\Date\createFromTimestamp
static createFromTimestamp($timestamp)
Определения
date.php:402
Bitrix\Main\Type\Date\getTimestamp
getTimestamp()
Определения
date.php:218
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
Bitrix\Main\Update\Stepper
Определения
stepper.php:29
Bitrix\Main\Update\Stepper\getOuterParams
getOuterParams()
Определения
stepper.php:212
Bitrix\Main\Update\Stepper\setOuterParams
setOuterParams(array $outerParams)
Определения
stepper.php:207
$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
Bitrix\Main\DB
Определения
arrayresult.php:2
Bitrix\Main\Type
Определения
collection.php:2
Bitrix\Main
$option
$option
Определения
options.php:1711
bitrix
modules
bizproc
lib
worker
task
createsearchcontentstepper.php
Создано системой
1.14.0