<commit_before><?php


/**
 * Skeleton subclass for performing query and update operations on the 'sphinx_log' table.
 *
 * 
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package plugins.sphinxSearch
 * @subpackage model
 */
class SphinxLogPeer extends BaseSphinxLogPeer {

	public static function alternativeCon($con, $queryDB = kQueryCache::QUERY_DB_UNDEFINED)
	{
		return myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_SPHINX_LOG);
	}


	/**
	 * Retrieve all records larger than the id
	 *
	 * @param      array $servers<SphinxLogServer>
	 * @param	   int $type
	 * @param	   int $gap
	 * @param      int $limit
	 * @param	   array $handledEntries	
	 * @param      PropelPDO $con the connection to use
	 * @return     SphinxLog
	 */
	public static function retrieveByLastId(array $servers, $gap = 0, $limit = 1000, array $handledEntries = null, PropelPDO $con = null, $type = SphinxLogType::SPHINX)
	{
		$criteria = new Criteria();
		$criterions = null;
		if(count($servers))
			$criterions = $criteria->getNewCriterion(SphinxLogPeer::ID, null, Criteria::ISNULL);
		
		foreach($servers as $server)
		{
			$dc = $server->getDc();
			$crit = $criteria->getNewCriterion(SphinxLogPeer::ID, $server->getLastLogId() - $gap, Criteria::GREATER_THAN);
			$crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::DC, $dc));
			if(!is_null($handledEntries)) {
				$crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::ID, $handledEntries[$dc], Criteria::NOT_IN));
			}
			$criterions->addOr($crit);
		}
		
		if($criterions)
			$criteria->addAnd($criterions);

		$disabledPartnerIds = array();
		if ($type == SphinxLogType::SPHINX)
		{
			$disabledPartnerIds = kConf::get('disable_sphinx_indexing_partners', 'local', array());
		}
		else if ($type == SphinxLogType::ELASTIC)
		{
			$disabledPartnerIds = kConf::get('disable_elastic_populate_indexing_partners', 'local', array());
		}

		if ($disabledPartnerIds)
		{
			$criteria->add(SphinxLogPeer::PARTNER_ID, $disabledPartnerIds, Criteria::NOT_IN);
		}

		$types = array($type);
		$criteria->add(SphinxLogPeer::TYPE, $types, Criteria::IN);
		$criteria->addAscendingOrderByColumn(SphinxLogPeer::ID);
		$criteria->setLimit($limit);

		return SphinxLogPeer::doSelect($criteria, $con);
	}
	
} // SphinxLogPeer
<commit_msg>PLAT-10341: If connection provided and its sphinx log connection use it instead of creating a new one to the master<commit_after><?php


/**
 * Skeleton subclass for performing query and update operations on the 'sphinx_log' table.
 *
 * 
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package plugins.sphinxSearch
 * @subpackage model
 */
class SphinxLogPeer extends BaseSphinxLogPeer {

	public static function alternativeCon($con, $queryDB = kQueryCache::QUERY_DB_UNDEFINED)
	{
		if($con && in_array($con->getConnectionName(), array(myDbHelper::DB_HELPER_CONN_SPHINX_LOG_READ, myDbHelper::DB_HELPER_CONN_SPHINX_LOG)))
		{
			return $con;
		}
		
		return myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_SPHINX_LOG);
	}


	/**
	 * Retrieve all records larger than the id
	 *
	 * @param      array $servers<SphinxLogServer>
	 * @param	   int $type
	 * @param	   int $gap
	 * @param      int $limit
	 * @param	   array $handledEntries	
	 * @param      PropelPDO $con the connection to use
	 * @return     SphinxLog
	 */
	public static function retrieveByLastId(array $servers, $gap = 0, $limit = 1000, array $handledEntries = null, PropelPDO $con = null, $type = SphinxLogType::SPHINX)
	{
		$criteria = new Criteria();
		$criterions = null;
		if(count($servers))
			$criterions = $criteria->getNewCriterion(SphinxLogPeer::ID, null, Criteria::ISNULL);
		
		foreach($servers as $server)
		{
			$dc = $server->getDc();
			$crit = $criteria->getNewCriterion(SphinxLogPeer::ID, $server->getLastLogId() - $gap, Criteria::GREATER_THAN);
			$crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::DC, $dc));
			if(!is_null($handledEntries)) {
				$crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::ID, $handledEntries[$dc], Criteria::NOT_IN));
			}
			$criterions->addOr($crit);
		}
		
		if($criterions)
			$criteria->addAnd($criterions);

		$disabledPartnerIds = array();
		if ($type == SphinxLogType::SPHINX)
		{
			$disabledPartnerIds = kConf::get('disable_sphinx_indexing_partners', 'local', array());
		}
		else if ($type == SphinxLogType::ELASTIC)
		{
			$disabledPartnerIds = kConf::get('disable_elastic_populate_indexing_partners', 'local', array());
		}

		if ($disabledPartnerIds)
		{
			$criteria->add(SphinxLogPeer::PARTNER_ID, $disabledPartnerIds, Criteria::NOT_IN);
		}

		$types = array($type);
		$criteria->add(SphinxLogPeer::TYPE, $types, Criteria::IN);
		$criteria->addAscendingOrderByColumn(SphinxLogPeer::ID);
		$criteria->setLimit($limit);

		return SphinxLogPeer::doSelect($criteria, $con);
	}
	
} // SphinxLogPeer

{'fraction_non_alphanumeric': 0.13640805159273012, 'fraction_numerical': 0.00293140512018761, 'mean_word_length': 4.770011273957159, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2390070', 'n_tokens_mistral': 1934, 'n_tokens_neox': 1757, 'n_words': 365}