- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/update/block/lastused.php
- Класс: BitrixLandingUpdateBlockLastUsed
- Вызов: LastUsed::execute
public function execute(array &$option): bool
{
$lastId = Option::get('landing', self::OPTION_CODE, 0);
if (!isset($option['steps']))
{
$option['steps'] = 0;
}
// total counts
$option['count'] = count(BlockTable::getList([
'select' => [
'CREATED_BY_ID',
new BitrixMainEntityExpressionField(
'CNT', 'COUNT(*)'
)
],
'filter' => [
'=PUBLIC' => 'N'
],
'group' => [
'CREATED_BY_ID'
]
])->fetchAll());
// current step
$finished = true;
$resBlocks = BlockTable::getList([
'select' => [
'CREATED_BY_ID'
],
'filter' => [
'=PUBLIC' => 'N',
'>CREATED_BY_ID' => $option['steps']
],
'group' => [
'CREATED_BY_ID'
],
'order' => [
'CREATED_BY_ID' => 'asc'
]
]);
if ($row = $resBlocks->fetch())
{
$finished = false;
$option['steps']++;
self::massInsertBlocks($row['CREATED_BY_ID']);
}
if (!$finished)
{
Option::set('landing', self::OPTION_CODE, $lastId);
return true;
}
else
{
Option::delete('landing', ['name' => self::OPTION_CODE]);
return false;
}
}