- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/lib/update/livefeedindexcalendar.php
- Класс: BitrixCalendarUpdateLivefeedIndexCalendar
- Вызов: LivefeedIndexCalendar::execute
public function execute(array &$result)
{
if (!(
Loader::includeModule("calendar")
&& Loader::includeModule("socialnetwork")
&& Option::get('calendar', 'needLivefeedIndex', 'Y') == 'Y'
))
{
return false;
}
$return = false;
$result["title"] = Loc::getMessage("FUPD_LF_CALENDAR_EVENT_INDEX_TITLE");
$result["progress"] = 1;
$result["steps"] = "";
$result["count"] = "";
$params = Option::get("calendar", "livefeedindexcalendar", "");
$params = ($params !== "" ? @unserialize($params, ['allowed_classes' => false]) : array());
$params = (is_array($params) ? $params : array());
if (empty($params))
{
$params = array(
"lastId" => 0,
"number" => 0,
"count" => LogTable::getCount(
array(
'@EVENT_ID' => IntegrationSocialnetworkLog::getEventIdList(),
'!SOURCE_ID' => false
)
)
);
if ($params["count"] > 0)
{
Option::set("calendar", "livefeedindexcalendar", serialize($params));
}
else
{
return $return;
}
}
if (
isset($params["finished"])
&& $params["finished"] === true
)
{
Option::delete("calendar", array("name" => "livefeedindexcalendar"));
Option::set('calendar', 'needLivefeedIndex', 'N');
return false;
}
else
{
$return = true;
}
$result["progress"] = intval($params["number"] * 100/ $params["count"]);
$result["steps"] = $params["number"];
$result["count"] = $params["count"];
if ($params["count"] > 0)
{
$tmpUser = false;
if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"]))
{
$tmpUser = True;
$GLOBALS["USER"] = new CUser;
}
BitrixCalendarUpdateLivefeedIndexCalendar::run();
if ($tmpUser)
{
unset($GLOBALS["USER"]);
}
}
return $return;
}