Skip to content

Commit

Permalink
Merge pull request kaltura#1360 from kaltura/IX-9.17.0-PLAT-1403
Browse files Browse the repository at this point in the history
change filesync subtype of the manifest flavor to ASSET instead ISM
  • Loading branch information
yossipapi committed Jun 23, 2014
2 parents f46d2a3 + add071b commit 53c185c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,20 @@ protected function getFlavorKeyByTag($flavorAssets, $tag, $syncKeyType) {

protected function initSilverLightManifest($flavorAssets)
{
$key = $this->getFlavorKeyByTag($flavorAssets, assetParams::TAG_ISM_MANIFEST, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
$key = $this->getFlavorKeyByTag($flavorAssets, assetParams::TAG_ISM_MANIFEST, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);

if(!$key)
$key = $this->entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);

$localFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);

//To Remove - Until the migration process from asset sub type 3 to asset sub type 1 will be completed we need to support both formats
if(!$localFileSync)
{
$key = $this->getFlavorKeyByTag($flavorAssets, assetParams::TAG_ISM_MANIFEST, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
$localFileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
}

$remoteFileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key);
if ($this->shouldUseLocalFlavors($localFileSync, $remoteFileSync))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ private function getFileSyncKey($objectId, $type)
switch ($type)
{
case 'ism':
if($subType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM)
//To Remove - Until the migration process from asset sub type 3 to asset sub type 1 will be completed we need to support both formats
if($subType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET || $subType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM)
$isAsset = true;
else
$subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM;
Expand Down
15 changes: 12 additions & 3 deletions alpha/lib/model/DeliveryProfileAkamaiSilverLight.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@ protected function doGetFileSyncUrl(FileSync $fileSync)
return parent::doGetFileSyncUrl($fileSync);

$partnerPath = myPartnerUtils::getUrlForPartner($fileSync->getPartnerId(), $fileSync->getPartnerId() * 100);
$objectSubType = $fileSync->getObjectSubType();

if($fileSync->getObjectType() == FileSyncObjectType::ENTRY && $fileSync->getObjectSubType() == entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM)
if($fileSync->getObjectType() == FileSyncObjectType::ENTRY && $objectSubType == entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM)
return $this->doGetServeIsmUrl($fileSync, $partnerPath, $storage);

if($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $fileSync->getObjectSubType() == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM)

//To Remove - Until the migration process from asset sub type 3 to asset sub type 1 will be completed we need to support both formats
if($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $objectSubType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM)
return $this->doGetServeIsmUrl($fileSync, $partnerPath, $storage);

if($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $objectSubType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET)
{
$asset = assetPeer::retrieveById($fileSync->getObjectId());
if($asset->hasTag(assetParams::TAG_ISM_MANIFEST))
return $this->doGetServeIsmUrl($fileSync, $partnerPath, $storage);
}

return parent::doGetFileSyncUrl($fileSync);
}

Expand Down
4 changes: 3 additions & 1 deletion alpha/lib/model/asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ public function generateFileName( $sub_type, $version = null)
{
case self::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET:
$ext = '';
if($this->getFileExt())
if($this->hasTag(assetParams::TAG_ISM_MANIFEST))
$ext = ".ism";
else if($this->getFileExt())
$ext = '.' . $this->getFileExt();
return $fileName . $ext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function doOperation()
$destFileSyncDescArr = array();
$fileSyncDesc = new KalturaDestFileSyncDescriptor();
$fileSyncDesc->fileSyncLocalPath = $ismFilePath;
$fileSyncDesc->fileSyncObjectSubType = 3; //".ism";
$fileSyncDesc->fileSyncObjectSubType = 1; //".ism";
$destFileSyncDescArr[] = $fileSyncDesc;

$fileSyncDesc = new KalturaDestFileSyncDescriptor();
Expand Down
4 changes: 2 additions & 2 deletions plugins/transcoding/ismIndex/lib/kIsmIndexEventsConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function shouldConsumeChangedEvent(BaseObject $object, array $modifiedCol
public function objectChanged(BaseObject $object, array $modifiedColumns)
{
// replacing the ismc file name in the ism file
$ismPrevVersionFileSyncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
$ismPrevVersionFileSyncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$ismContents = kFileSyncUtils::file_get_contents($ismPrevVersionFileSyncKey);

$ismcPrevVersionFileSyncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
Expand All @@ -47,7 +47,7 @@ public function objectChanged(BaseObject $object, array $modifiedColumns)
$tmpPath = kFileSyncUtils::getLocalFilePathForKey($ismPrevVersionFileSyncKey).'.tmp';
file_put_contents($tmpPath, $ismXml->asXML());

kFileSyncUtils::moveFromFile($tmpPath, $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM));
kFileSyncUtils::moveFromFile($tmpPath, $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));

return true;
}
Expand Down

0 comments on commit 53c185c

Please sign in to comment.