$metadataProfile->setStatus(MetadataProfile::STATUS_ACTIVE); $metadataProfile->setName('Tvinci ingest v' . $version); $metadataProfile->setSystemName('TvinciIngestV' . $version); $metadataProfile->setDescription('Tvinci ingest schema version ' . $version); $metadataProfile->setObjectType(MetadataObjectType::ENTRY); $metadataProfile->setRequiredCopyTemplatePermissions(FEATURE_TVINCI_INGEST_BASE . $version); $metadataProfile->save(); $xsdData = $versionToXsdMap[$version]; $key = $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION); kFileSyncUtils::file_put_contents($key, $xsdData); kMetadataManager::parseProfileSearchFields($metadataProfile->getPartnerId(), $metadataProfile); } // Main $versionToXsdMap = getVersionToXsdMap(); createMetadataProfile(1, $versionToXsdMap); createMetadataProfile(2, $versionToXsdMap); // Version => XSD map function getVersionToXsdMap() { return array(1 => '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="metadata"> <xsd:complexType> <xsd:sequence> <xsd:element id="md_6F31C638-3D3C-CA83-4201-57106E03E97A" name="WorkflowStatus" minOccurs="0" maxOccurs="1"> <xsd:annotation> <xsd:documentation/> <xsd:appinfo> <label>Workflow Status</label> <key>Workflow Status</key> <searchable>true</searchable> <timeControl>false</timeControl>
$eventNotificationParameter->setValue($eventNotificationValue); $contentParameters[] = $eventNotificationParameter; $eventNotificationValue = new kEvalStringField(); $eventNotificationValue->setCode('$scope->getEvent()->getObject()->getName()'); $eventNotificationParameter = new kEventNotificationParameter(); $eventNotificationParameter->setKey('entry_name'); $eventNotificationParameter->setDescription('Entry Name'); $eventNotificationParameter->setValue($eventNotificationValue); $contentParameters[] = $eventNotificationParameter; $emailNotification = new EmailNotificationTemplate(); $emailNotification->setPartnerId(99); $emailNotification->setStatus(EventNotificationTemplateStatus::ACTIVE); $emailNotification->setName('Is Live Entry Still Alive'); $emailNotification->setSystemName('EMAIL_LIVE_ENTRY_NOT_ALIVE'); $emailNotification->setDescription('Email notification template to be sent when a 24/7 live-entry stopped broadcasting.'); $emailNotification->setAutomaticDispatchEnabled(true); $emailNotification->setEventType(EventNotificationEventType::OBJECT_CHANGED); $emailNotification->setObjectType(EventNotificationEventObjectType::ENTRY); $emailNotification->setEventConditions($eventConditions); $emailNotification->setFormat(EmailNotificationFormat::HTML); $emailNotification->setSubject('[Kaltura] - Live-Entry [{partner_id}/{entry_id}] stopped broadcasting.'); $emailNotification->setBody("Partner ID: {partner_id}<br/>\nEntry ID: {entry_id}<br/>\nEntry Name: {entry_name}<br/>\n"); $emailNotification->setFromEmail('{from_email}'); $emailNotification->setFromName('{from_name}'); $emailNotification->setTo($toEmail); $emailNotification->setContentParameters($contentParameters); $emailNotification->setRequiredCopyTemplatePermissions(FEATURE_KALTURA_LIVE_MONITOR); $emailNotification->save(); } createMetadataProfile(); createEmailNotification();