Esempio n. 1
0
 /**
  * Updates all related to element information if index exists.
  *
  * @param integer $iblockId Information block identifier.
  * @param integer $elementId Identifier of the element.
  *
  * @return void
  */
 public static function updateElementIndex($iblockId, $elementId)
 {
     $elementId = intval($elementId);
     $productIblock = self::resolveIblock($iblockId);
     $indexer = self::createIndexer($productIblock);
     if ($indexer->isExists()) {
         if ($iblockId != $productIblock) {
             $elementId = self::resolveElement($iblockId, $elementId);
         }
         $indexer->deleteElement($elementId);
         $connection = \Bitrix\Main\Application::getConnection();
         $elementCheck = $connection->query("\n\t\t\t\tSELECT BE.ID\n\t\t\t\tFROM b_iblock_element BE\n\t\t\t\tWHERE BE.ACTIVE = 'Y'\n\t\t\t\t" . \CIBlockElement::wf_getSqlLimit("BE.", "N") . "\n\t\t\t\tAND BE.ID = " . intval($elementId));
         if ($elementCheck->fetch()) {
             $indexer->indexElement($elementId);
         }
     }
 }