try { if ($skipExecutedUpdates && $executedServerId == $serverLastLog->getId()) { KalturaLog::log("Sphinx server is initiated and the command already ran synchronously on this machine. Skipping"); } else { $sql = $sphinxLog->getSql(); $affected = $sphinxCon->exec($sql); if (!$affected) { $errorInfo = $sphinxCon->errorInfo(); } } // If the record is an historical record, don't take back the last log id if ($serverLastLog->getLastLogId() < $sphinxLogId) { $serverLastLog->setLastLogId($sphinxLogId); // Clear $handledRecords from before last - gap. foreach ($serverLastLogs as $serverLastLog) { $dc = $serverLastLog->getDc(); $threshold = $serverLastLog->getLastLogId() - $gap; $handledRecords[$dc] = array_filter($handledRecords[$dc], array(new OldLogRecordsFilter($threshold), 'filter')); } } } catch (Exception $e) { KalturaLog::err($e->getMessage()); } } foreach ($lastLogs as $serverLastLog) { $serverLastLog->save(myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_SPHINX_LOG)); } unset($sphinxCon); SphinxLogPeer::clearInstancePool(); } KalturaLog::log('Done');