<commit_before><?php

/**
 * Subclass for performing query and update operations on the 'storage_profile' table.
 *
 * 
 *
 * @package Core
 * @subpackage model
 */ 
class StorageProfilePeer extends BaseStorageProfilePeer
{
	protected static $class_types_cache = array(
	);
	
	/**
	 * The returned Class will contain objects of the default type or
	 * objects that inherit from the default.
	 *
	 * @param      array $row PropelPDO result row.
	 * @param      int $colnum Column to examine for OM class information (first is 0).
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function getOMClass($row, $colnum)
	{
		if($row)
		{
			$protocolField = self::translateFieldName(StorageProfilePeer::PROTOCOL, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
			$storageProfileProtocol = $row[$protocolField];
			if(isset(self::$class_types_cache[$storageProfileProtocol]))
				return self::$class_types_cache[$storageProfileProtocol];
				
			$extendedCls = KalturaPluginManager::getObjectClass(parent::OM_CLASS, $storageProfileProtocol);
			if($extendedCls)
			{
				self::$class_types_cache[$storageProfileProtocol] = $extendedCls;
				return $extendedCls;
			}
			self::$class_types_cache[$storageProfileProtocol] = parent::OM_CLASS;
		}
			
		return parent::OM_CLASS;
	}
	
	public static function alternativeCon($con, $queryDB = kQueryCache::QUERY_DB_UNDEFINED)
	{
		if($con === null)
			$con = myDbHelper::alternativeCon($con);
			
		if($con === null)
			$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL3);
		
		return $con;
	}
	
	public static function retrieveAutomaticByPartnerId($partnerId, $con = null)
	{
		$criteria = new Criteria(StorageProfilePeer::DATABASE_NAME);
		$criteria->add(StorageProfilePeer::PARTNER_ID, array(0, $partnerId), Criteria::IN);
		$criteria->add(StorageProfilePeer::STATUS, StorageProfile::STORAGE_STATUS_AUTOMATIC);

		return StorageProfilePeer::doSelect($criteria, $con);
	}
	
	public static function retrieveExternalByPartnerId($partnerId, $ids = null, $con = null)
	{
		$criteria = new Criteria(StorageProfilePeer::DATABASE_NAME);
		$criteria->add(StorageProfilePeer::PARTNER_ID, $partnerId);
		$criteria->add(StorageProfilePeer::STATUS, array(StorageProfile::STORAGE_STATUS_AUTOMATIC, StorageProfile::STORAGE_STATUS_MANUAL), Criteria::IN);
		if (!is_null($ids))
			$criteria->add(StorageProfilePeer::ID, $ids, Criteria::IN);	
		return StorageProfilePeer::doSelect($criteria, $con);
	}
	
	public static function getCacheInvalidationKeys()
	{
		return array(array("storageProfile:id=%s", self::ID), array("storageProfile:partnerId=%s", self::PARTNER_ID));		
	}
}
<commit_msg>qnd: qc 4750 added class types cache for storage profile<commit_after><?php

/**
 * Subclass for performing query and update operations on the 'storage_profile' table.
 *
 * 
 *
 * @package Core
 * @subpackage model
 */ 
class StorageProfilePeer extends BaseStorageProfilePeer
{
	const STORAGE_DEFAULT_OM_CLASS = 'StorageProfile';
	const STORAGE_AMAZON_S3_OM_CLASS = 'AmazonS3StorageProfile';
	
	// cache classes by their type
	protected static $class_types_cache = array(
		StorageProfile::STORAGE_PROTOCOL_FTP => self::STORAGE_DEFAULT_OM_CLASS,
		StorageProfile::STORAGE_PROTOCOL_SCP => self::STORAGE_DEFAULT_OM_CLASS,
		StorageProfile::STORAGE_PROTOCOL_SFTP => self::STORAGE_DEFAULT_OM_CLASS,
		StorageProfile::STORAGE_PROTOCOL_SFTP_CMD => self::STORAGE_DEFAULT_OM_CLASS,
		StorageProfile::STORAGE_PROTOCOL_SFTP_SEC_LIB => self::STORAGE_DEFAULT_OM_CLASS,
		StorageProfile::STORAGE_PROTOCOL_S3 => self::STORAGE_AMAZON_S3_OM_CLASS,
	);
	
	/**
	 * The returned Class will contain objects of the default type or
	 * objects that inherit from the default.
	 *
	 * @param      array $row PropelPDO result row.
	 * @param      int $colnum Column to examine for OM class information (first is 0).
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function getOMClass($row, $colnum)
	{
		if($row)
		{
			$protocolField = self::translateFieldName(StorageProfilePeer::PROTOCOL, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
			$storageProfileProtocol = $row[$protocolField];
			if(isset(self::$class_types_cache[$storageProfileProtocol]))
				return self::$class_types_cache[$storageProfileProtocol];
				
			$extendedCls = KalturaPluginManager::getObjectClass(parent::OM_CLASS, $storageProfileProtocol);
			if($extendedCls)
			{
				self::$class_types_cache[$storageProfileProtocol] = $extendedCls;
				return $extendedCls;
			}
			self::$class_types_cache[$storageProfileProtocol] = parent::OM_CLASS;
		}
			
		return parent::OM_CLASS;
	}
	
	public static function alternativeCon($con, $queryDB = kQueryCache::QUERY_DB_UNDEFINED)
	{
		if($con === null)
			$con = myDbHelper::alternativeCon($con);
			
		if($con === null)
			$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL3);
		
		return $con;
	}
	
	public static function retrieveAutomaticByPartnerId($partnerId, $con = null)
	{
		$criteria = new Criteria(StorageProfilePeer::DATABASE_NAME);
		$criteria->add(StorageProfilePeer::PARTNER_ID, array(0, $partnerId), Criteria::IN);
		$criteria->add(StorageProfilePeer::STATUS, StorageProfile::STORAGE_STATUS_AUTOMATIC);

		return StorageProfilePeer::doSelect($criteria, $con);
	}
	
	public static function retrieveExternalByPartnerId($partnerId, $ids = null, $con = null)
	{
		$criteria = new Criteria(StorageProfilePeer::DATABASE_NAME);
		$criteria->add(StorageProfilePeer::PARTNER_ID, $partnerId);
		$criteria->add(StorageProfilePeer::STATUS, array(StorageProfile::STORAGE_STATUS_AUTOMATIC, StorageProfile::STORAGE_STATUS_MANUAL), Criteria::IN);
		if (!is_null($ids))
			$criteria->add(StorageProfilePeer::ID, $ids, Criteria::IN);	
		return StorageProfilePeer::doSelect($criteria, $con);
	}
	
	public static function getCacheInvalidationKeys()
	{
		return array(array("storageProfile:id=%s", self::ID), array("storageProfile:partnerId=%s", self::PARTNER_ID));		
	}
}

{'fraction_non_alphanumeric': 0.11858290962768575, 'fraction_numerical': 0.002296211251435132, 'mean_word_length': 6.04971098265896, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '5201314', 'n_tokens_mistral': 2097, 'n_tokens_neox': 1919, 'n_words': 370}