<commit_before><?php
/**
 * Enable entry content distribution ingestion from XML bulk upload
 * @package plugins.contentDistribution
 */
class ContentDistributionBulkUploadXmlPlugin extends KalturaPlugin implements IKalturaPending, IKalturaSchemaContributor
{
	const PLUGIN_NAME = 'contentDistributionBulkUploadXml';
	const BULK_UPLOAD_XML_PLUGIN_NAME = 'bulkUploadXml';

	/* (non-PHPdoc)
	 * @see IKalturaPlugin::getPluginName()
	 */
	public static function getPluginName()
	{
		return self::PLUGIN_NAME;
	}
	
	/* (non-PHPdoc)
	 * @see IKalturaPending::dependsOn()
	 */
	public static function dependsOn()
	{
		$bulkUploadXmlDependency = new KalturaDependency(self::BULK_UPLOAD_XML_PLUGIN_NAME);
		$contentDistributionDependency = new KalturaDependency(ContentDistributionPlugin::getPluginName());
		
		return array($bulkUploadXmlDependency, $contentDistributionDependency);
	}

	/* (non-PHPdoc)
	 * @see IKalturaSchemaContributor::contributeToSchema()
	 */
	public static function contributeToSchema($type)
	{
		$coreType = kPluginableEnumsManager::apiToCore('SchemaType', $type);
		if(
			$coreType != BulkUploadXmlPlugin::getSchemaTypeCoreValue(XmlSchemaType::BULK_UPLOAD_XML)
			&&
			$coreType != BulkUploadXmlPlugin::getSchemaTypeCoreValue(XmlSchemaType::BULK_UPLOAD_RESULT_XML)
		)
			return null;
	
		$xsd = '
		
	<!-- ' . self::getPluginName() . ' -->
	
	<xs:complexType name="T_distribution">
		<xs:sequence>
			<xs:choice minOccurs="1" maxOccurs="1">
				<xs:element name="distributionProvider" minOccurs="1" maxOccurs="1" type="KalturaDistributionProviderType">
					<xs:annotation>
						<xs:documentation>The provider (Distribution Partner) that the entry is distributed to</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="distributionProfileId" minOccurs="1" maxOccurs="1" type="xs:int">
					<xs:annotation>
						<xs:documentation>The identifier of the distribution profile to use for entry distribution</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="distributionProfile" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>The system name of the distribution profile to use for entry distribution</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="120"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
			</xs:choice>
			<xs:element name="sunrise" minOccurs="0" maxOccurs="1" type="xs:dateTime">
				<xs:annotation>
					<xs:documentation>
						The date and time that the entry becomes available on the remote site.<br/>
						If not specified, the entry scheduling date and time are used.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="sunset" minOccurs="0" maxOccurs="1" type="xs:dateTime">
				<xs:annotation>
					<xs:documentation>
						The date and time that the entry becomes unavailable on the remote site.<br/>
						If not specified, the entry scheduling date and time are used.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="flavorAssetIds" minOccurs="0" maxOccurs="1" type="xs:string">
				<xs:annotation>
					<xs:documentation>
						Comma-separated list of existing flavor asset IDs for the distribution destination.<br/>
						Used only for an existing entry.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="thumbAssetIds" minOccurs="0" maxOccurs="1" type="xs:string">
				<xs:annotation>
					<xs:documentation>
						Comma-separated list of existing thumbnail asset IDs for the distribution destination.<br/>
						Used only for an existing entry.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		
			<xs:element ref="distribution-extension" minOccurs="0" maxOccurs="unbounded" />
			
		</xs:sequence>
		
		<xs:attribute name="entryDistributionId" use="required" type="xs:int">
			<xs:annotation><commit_msg>def: 1246 distorbution via bulk upload didn't work when entryDistributionId isn't given<commit_after><?php
/**
 * Enable entry content distribution ingestion from XML bulk upload
 * @package plugins.contentDistribution
 */
class ContentDistributionBulkUploadXmlPlugin extends KalturaPlugin implements IKalturaPending, IKalturaSchemaContributor
{
	const PLUGIN_NAME = 'contentDistributionBulkUploadXml';
	const BULK_UPLOAD_XML_PLUGIN_NAME = 'bulkUploadXml';

	/* (non-PHPdoc)
	 * @see IKalturaPlugin::getPluginName()
	 */
	public static function getPluginName()
	{
		return self::PLUGIN_NAME;
	}
	
	/* (non-PHPdoc)
	 * @see IKalturaPending::dependsOn()
	 */
	public static function dependsOn()
	{
		$bulkUploadXmlDependency = new KalturaDependency(self::BULK_UPLOAD_XML_PLUGIN_NAME);
		$contentDistributionDependency = new KalturaDependency(ContentDistributionPlugin::getPluginName());
		
		return array($bulkUploadXmlDependency, $contentDistributionDependency);
	}

	/* (non-PHPdoc)
	 * @see IKalturaSchemaContributor::contributeToSchema()
	 */
	public static function contributeToSchema($type)
	{
		$coreType = kPluginableEnumsManager::apiToCore('SchemaType', $type);
		if(
			$coreType != BulkUploadXmlPlugin::getSchemaTypeCoreValue(XmlSchemaType::BULK_UPLOAD_XML)
			&&
			$coreType != BulkUploadXmlPlugin::getSchemaTypeCoreValue(XmlSchemaType::BULK_UPLOAD_RESULT_XML)
		)
			return null;
	
		$xsd = '
		
	<!-- ' . self::getPluginName() . ' -->
	
	<xs:complexType name="T_distribution">
		<xs:sequence>
			<xs:choice minOccurs="1" maxOccurs="1">
				<xs:element name="distributionProvider" minOccurs="1" maxOccurs="1" type="KalturaDistributionProviderType">
					<xs:annotation>
						<xs:documentation>The provider (Distribution Partner) that the entry is distributed to</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="distributionProfileId" minOccurs="1" maxOccurs="1" type="xs:int">
					<xs:annotation>
						<xs:documentation>The identifier of the distribution profile to use for entry distribution</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="distributionProfile" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>The system name of the distribution profile to use for entry distribution</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="120"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
			</xs:choice>
			<xs:element name="sunrise" minOccurs="0" maxOccurs="1" type="xs:dateTime">
				<xs:annotation>
					<xs:documentation>
						The date and time that the entry becomes available on the remote site.<br/>
						If not specified, the entry scheduling date and time are used.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="sunset" minOccurs="0" maxOccurs="1" type="xs:dateTime">
				<xs:annotation>
					<xs:documentation>
						The date and time that the entry becomes unavailable on the remote site.<br/>
						If not specified, the entry scheduling date and time are used.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="flavorAssetIds" minOccurs="0" maxOccurs="1" type="xs:string">
				<xs:annotation>
					<xs:documentation>
						Comma-separated list of existing flavor asset IDs for the distribution destination.<br/>
						Used only for an existing entry.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="thumbAssetIds" minOccurs="0" maxOccurs="1" type="xs:string">
				<xs:annotation>
					<xs:documentation>
						Comma-separated list of existing thumbnail asset IDs for the distribution destination.<br/>
						Used only for an existing entry.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		
			<xs:element ref="distribution-extension" minOccurs="0" maxOccurs="unbounded" />
			
		</xs:sequence>
		
		<xs:attribute name="entryDistributionId" use="optional" type="xs:int">
			<xs:annotation>
{'fraction_non_alphanumeric': 0.12356034051076614, 'fraction_numerical': 0.005508262393590386, 'mean_word_length': 4.563370473537605, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 123, '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': '7251241', 'n_tokens_mistral': 2984, 'n_tokens_neox': 2416, 'n_words': 552}