Код Handler
<?php
class ASMP_Cron_Handler1 extends ASMP_Cron_Handler
{
public function execute()
{
$oShop = Core_Entity::factory('Shop', 1);
$oCore_QueryBuilder_Select = Core_QueryBuilder::select('shop_items.id')
->from('shop_items')
->where('shop_items.shop_id', '=', $oShop->id)
->open()
->where('shop_items.image_large', 'IS', NULL)
->setOr()
->where('shop_items.image_large', '=', '')
->close();
$iFrom = 0;
$step = 5000;
do {
$oCore_QueryBuilder_Select->offset($iFrom)->limit($step);
$aRows = $oCore_QueryBuilder_Select->execute()->asAssoc()->result(FALSE);
foreach ($aRows as $row)
{
$aIDs[] = $row['id'];
}
$iFrom += $step;
$iCount = count($aRows);
}
while ($iCount);
$this->_total = count($aIDs);
if($this->_total)
{
$siteUrl = $this->_getSiteUrl();
foreach ($aIDs as $entity_id)
{
$oShop_Item = Core_Entity::factory('Shop_Item', (int) $entity_id);
$message = sprintf('%1$s/admin/shop/item/index.php?hostcms[action]=edit&shop_id=%2$d1&shop_group_id=%3$d&hostcms[checked][1][%4$d]=1', $siteUrl, $oShop_Item->shop_id, $oShop_Item->shop_group_id, $oShop_Item->id);
$this->addLog($message, -1);
}
}
return TRUE;
}
}Поддерживаемые методы в execute()
heartbeat - механизм продления lock во время выполнения долгой задачи
Последнее обновление