Skip to content

Commit

Permalink
PLAT-8235: enable file encryption in Trasform metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
david-winder-kaltura committed Nov 29, 2017
1 parent 963b7d4 commit 3b28d8a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion alpha/apps/kaltura/lib/batch2/kJobsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ public static function addExportLiveReportJob($reportType, KalturaLiveReportExpo
return self::addJob( $job, $jobData, BatchJobType::LIVE_REPORT_EXPORT, $reportType);
}

protected static function getFileContainer(FileSyncKey $syncKey)
public static function getFileContainer(FileSyncKey $syncKey)
{

$fileSync = kFileSyncUtils::getResolveLocalFileSyncForKey($syncKey);
Expand Down
4 changes: 2 additions & 2 deletions infra/content/kXsd.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,13 @@ public static function transformXmlFile($xmlPath, $xsdPath, $xslPath)
* @param string $xslPath
* @return bool:string false if failed, xml text if succeed
*/
public static function transformXmlData($xml, $xsdPath, $xslPath)
public static function transformXmlData($xml, $xsdPath, $xslStr)
{
$from = new KDOMDocument();
$from->loadXML($xml);

$xsl = new KDOMDocument();
$xsl->load($xslPath);
$xsl->loadXML($xslStr);

$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private function upgrade(KalturaBatchJob $job, KalturaTransformMetadataJobData $
foreach($transformList->objects as $object)
{
/* @var $object KalturaMetadata */
$xml = kXsd::transformXmlData($object->xml, $data->destXsdPath, $data->srcXslPath);
$xslStr = $data->srcXsl;
$xml = kXsd::transformXmlData($object->xml, $data->destXsdPath, $xslStr);
if($xml)
{
self::$kClient->metadata->update($object->id, $xml, $object->version);
Expand Down
6 changes: 3 additions & 3 deletions plugins/metadata/lib/api/KalturaTransformMetadataJobData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
class KalturaTransformMetadataJobData extends KalturaJobData
{
/**
* @var string
* @var KalturaFileContainer
*/
public $srcXslPath;
public $srcXsl;

/**
* @var int
Expand All @@ -32,7 +32,7 @@ class KalturaTransformMetadataJobData extends KalturaJobData

private static $map_between_objects = array
(
"srcXslPath" ,
"srcXsl" ,
"srcVersion" ,
"destVersion" ,
"metadataProfileId" ,
Expand Down
16 changes: 8 additions & 8 deletions plugins/metadata/lib/batch/model/kTransformMetadataJobData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
class kTransformMetadataJobData extends kJobData
{
/**
* @var string
* @var FileContainer
*/
private $srcXslPath;
private $srcXsl;

/**
* @var int
Expand All @@ -32,11 +32,11 @@ class kTransformMetadataJobData extends kJobData


/**
* @return the $srcXslPath
* @return FileContainer $srcXsl
*/
public function getSrcXslPath()
public function getSrcXsl()
{
return $this->srcXslPath;
return $this->srcXsl;
}

/**
Expand Down Expand Up @@ -64,11 +64,11 @@ public function getMetadataProfileId()
}

/**
* @param $srcXslPath the $srcXslPath to set
* @param FileContainer $srcXsl
*/
public function setSrcXslPath($srcXslPath)
public function setSrcXsl($srcXsl)
{
$this->srcXslPath = $srcXslPath;
$this->srcXsl = $srcXsl;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions plugins/metadata/lib/kMetadataFlowManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function updatedTransformMetadata(BatchJob $dbBatchJob, kTransformMeta

protected function updatedTransformMetadataPending(BatchJob $dbBatchJob, kTransformMetadataJobData $data)
{
if($data->getSrcXslPath())
if($data->getSrcXsl())
{
$metadataProfile = MetadataProfilePeer::retrieveByPK($data->getMetadataProfileId());
if($metadataProfile)
Expand All @@ -59,7 +59,7 @@ protected function updatedTransformMetadataPending(BatchJob $dbBatchJob, kTransf

protected function updatedTransformMetadataFinished(BatchJob $dbBatchJob, kTransformMetadataJobData $data)
{
if($data->getSrcXslPath())
if($data->getSrcXsl())
{
$metadataProfile = MetadataProfilePeer::retrieveByPK($data->getMetadataProfileId());
if($metadataProfile)
Expand All @@ -81,7 +81,7 @@ protected function updatedTransformMetadataFailed(BatchJob $dbBatchJob, kTransfo
if(!$metadataProfile)
return $dbBatchJob;

if($data->getSrcXslPath())
if($data->getSrcXsl())
{
$metadataProfile->setStatus(MetadataProfile::STATUS_DEPRECATED);
$metadataProfile->save();
Expand Down
4 changes: 1 addition & 3 deletions plugins/metadata/lib/kMetadataManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,7 @@ private static function addTransformMetadataJob($partnerId, $metadataProfileId,
$job->save();
$key = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_CONFIG);
kFileSyncUtils::file_put_contents($key, $xsl);

$xslPath = kFileSyncUtils::getLocalFilePathForKey($key);
$data->setSrcXslPath($xslPath);
$data->setSrcXsl(kJobsManager::getFileContainer($key));
}

$data->setMetadataProfileId($metadataProfileId);
Expand Down

0 comments on commit 3b28d8a

Please sign in to comment.