20 if (!Loader::includeModule(self::$moduleId))
26 $params = Option::get(self::$moduleId, self::OPTION_NAME,
"");
27 $params = ($params !==
"" ? @unserialize($params, [
'allowed_classes' =>
false]) : []);
28 $params = (is_array($params) ? $params : []);
36 ->addOrder(
'ID',
'DESC')
41 "lastId" => (int)$lastIdQuery[
'ID'] + 1,
43 "count" => ChatTable::getCount([
49 if ($params[
"count"] > 0)
53 ->setSelect([
'ID',
'ENTITY_TYPE'])
54 ->where(
'ID',
'<', $params[
'lastId'])
56 ->addOrder(
'ID',
'DESC')
57 ->setLimit(self::LIMIT)
61 foreach ($query->exec() as $row)
63 \CIMChat::index($row[
'ID']);
65 $params[
"lastId"] = $row[
'ID'];
71 Option::set(self::$moduleId, self::OPTION_NAME, serialize($params));
76 Option::delete(self::$moduleId, [
"name" => self::OPTION_NAME]);