Skip to content

Commit

Permalink
Merge pull request kaltura#6960 from kaltura/master-merge-Mercury-13.…
Browse files Browse the repository at this point in the history
…17.0

Master merge mercury 13.17.0
  • Loading branch information
MosheMaorKaltura authored Apr 9, 2018
2 parents 973efdb + b48546e commit 7bb3584
Show file tree
Hide file tree
Showing 105 changed files with 3,388 additions and 536 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Mercury-13.16.0
Mercury-13.17.0
1 change: 1 addition & 0 deletions admin_console/configs/lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'Kaltura_Client_Enum_BatchJobType::CLEAR_BEACONS' => 'Clear Beacons',
'Kaltura_Client_Enum_BatchJobType::COPY_CAPTIONS' => 'Copy Caption Assets',
'Kaltura_Client_Enum_BatchJobType::USERS_CSV' => 'Users Csv',
'Kaltura_Client_Enum_BatchJobType::COPY_CUE_POINTS' => 'Copy cue Points',

'Kaltura_Client_Enum_ConversionEngineType::FFMPEG' => 'Convert - FFMpeg',
'Kaltura_Client_Enum_ConversionEngineType::FFMPEG_AUX' => 'Convert - FFMpeg Aux',
Expand Down
10 changes: 8 additions & 2 deletions admin_console/forms/PartnerConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,13 @@ public function init()
'label' => 'Default segment duration (Kaltura Live):',
'filters' => array('StringTrim'),
));


$this->addElement('checkbox', 'enable_self_serve', array(
'label' => 'Self Serve enabled',
'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')), array('HtmlTag', array('tag' => 'dt', 'class' => 'partner_configuration_checkbox_field_only'))),
));


//--------------- Host white list ----------------------------

$this->addElement('text', 'cdn_host_white_list', array(
Expand Down Expand Up @@ -958,7 +964,7 @@ public function addAllDisplayGroups($permissionNames)

$this->addDisplayGroup(
array_merge(
array('default_live_stream_entry_source_type', 'live_stream_provision_params', 'default_live_stream_segment_duration'),
array('default_live_stream_entry_source_type', 'live_stream_provision_params', 'default_live_stream_segment_duration', 'enable_self_serve'),
array('crossLine')),
'liveStreamConfig',
array('legend' => 'Live Stream Config')
Expand Down
8 changes: 6 additions & 2 deletions alpha/apps/kaltura/lib/batch2/kJobsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1037,20 +1037,24 @@ public static function addConvertLiveSegmentJob(BatchJob $parentJob = null, live
$batchJob->setObjectType(BatchJobObjectType::ENTRY);
return self::addJob($batchJob, $jobData, BatchJobType::CONVERT_LIVE_SEGMENT);
}

/**
* @param BatchJob $parentJob
* @param flavorAsset $asset
* @param array $files
* @param bool $shouldSort
* @param null $offset
* @param null $duration
* @return BatchJob
*/
public static function addConcatJob(BatchJob $parentJob = null, flavorAsset $asset, array $files, $offset = null, $duration = null)
public static function addConcatJob(BatchJob $parentJob = null, flavorAsset $asset, array $files, $shouldSort = true , $offset = null, $duration = null)
{
$jobData = new kConcatJobData();
$jobData->setSrcFiles($files);
$jobData->setFlavorAssetId($asset->getId());
$jobData->setOffset($offset);
$jobData->setDuration($duration);
$jobData->setShouldSort($shouldSort);

$entry = $asset->getentry();
if($entry && $entry->getStatus() != entryStatus::READY)
Expand Down
140 changes: 140 additions & 0 deletions alpha/apps/kaltura/lib/batch2/model/kClipConcatJobData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?php
/**
* @package Core
* @subpackage model.data
*/

class kClipConcatJobData extends kJobData
{
/**$destEntryId
* @var string
*/
private $destEntryId;

/**$tempEntryId
* @var string
*/
private $tempEntryId;

/**sourceEntryId
* @var string
*/
private $sourceEntryId;

/** $partnerId
* @var int
*/
private $partnerId;

/** $priority
* @var int
*/
private $priority;


/** clip operations
* @var array $operationAttributes
*/
private $operationAttributes;

/**
* @return string $entryId
*/
public function getDestEntryId()
{
return $this->destEntryId;
}

/**
* @param string $entryId
*/
public function setDestEntryId($entryId)
{
$this->destEntryId = $entryId;
}

/**
* @return string $entryId
*/
public function getTempEntryId()
{
return $this->tempEntryId;
}

/**
* @param string $sourceEntryId
*/
public function setSourceEntryId($sourceEntryId)
{
$this->sourceEntryId = $sourceEntryId;
}

/**
* @return string $sourceEntryId
*/
public function getSourceEntryId()
{
return $this->sourceEntryId;
}

/**
* @param string $entryId
*/
public function setTempEntryId($entryId)
{
$this->tempEntryId = $entryId;
}

/**
* @return string $partnerId
*/
public function getPartnerId()
{
return $this->partnerId;
}

/**
* @param string $partnerId
*/
public function setPartnerId($partnerId)
{
$this->partnerId = $partnerId;
}


/**
* @return string $priority
*/
public function getPriority()
{
return $this->priority;
}

/**
* @param string $priority
*/
public function setPriority($priority)
{
$this->priority = $priority;
}


/**
* @return kOperationAttributes[] $operationAttributes
*/
public function getOperationAttributes()
{
return $this->operationAttributes;
}

/**
* @param kOperationAttributes[] $operationAttributes
*/
public function setOperationAttributes($operationAttributes)
{
$this->operationAttributes = $operationAttributes;
}



}
25 changes: 23 additions & 2 deletions alpha/apps/kaltura/lib/batch2/model/kConcatJobData.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ class kConcatJobData extends kJobData
* @var string
*/
private $flavorAssetId;

/**
* @var float
*/
private $offset;

/**
* @var float
*/
private $duration;

/**
* @var bool
*/
private $shouldSort;

/**
* duration of the concated video
* @var float
Expand Down Expand Up @@ -131,4 +136,20 @@ public function setConcatenatedDuration($concatenatedDuration)
{
$this->concatenatedDuration = $concatenatedDuration;
}

/**
* @return bool $sortNeeded
*/
public function getShouldSort()
{
return $this->shouldSort;
}

/**
* @param bool $shouldSort
*/
public function setShouldSort($shouldSort)
{
$this->shouldSort = $shouldSort;
}
}
43 changes: 40 additions & 3 deletions alpha/apps/kaltura/lib/cache/kApiCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class kApiCache extends kApiCacheBase
protected $_responseMetadata = null;
protected $_cacheId = null; // the cache id ensures that the conditions are in sync with the response buffer
protected $_cacheModes = null;
protected $_monitorEvents = array(); // holds monitor events that happen before monitorApiStart is called
protected static $_cacheWarmupInitiated = false;
protected static $_cacheHeaderCount = 0;

Expand Down Expand Up @@ -501,15 +502,35 @@ protected function validateSqlQueries($sqlConditions)
if (!isset($dataSources[$configKey]['connection']['dsn']))
return false;

$dsn = $dataSources[$configKey]['connection']['dsn'];

$connStart = microtime(true);
try
{
$pdo = new PDO(
$dataSources[$configKey]['connection']['dsn'], null, null, array(PDO::ATTR_TIMEOUT => 1));
$pdo = new PDO($dsn, null, null, array(PDO::ATTR_TIMEOUT => 1));
}
catch(PDOException $e)
{
return false;
}
$connTook = microtime(true) - $connStart;

$this->_monitorEvents[] = array(array('KalturaMonitorClient', 'monitorConnTook'), array($dsn, $connTook));

// get the host name from the dsn
list($mysql, $connection) = explode(':', $dsn);
$arguments = explode(';', $connection);

$hostName = null;
foreach($arguments as $argument)
{
list($argumentName, $argumentValue) = explode('=', $argument);
if(strtolower($argumentName) == 'host')
{
$hostName = $argumentValue;
break;
}
}

foreach ($queries as $query)
{
Expand All @@ -519,12 +540,16 @@ protected function validateSqlQueries($sqlConditions)
$comment .= "[{$this->_cacheKey}]";
$sql = str_replace(self::KALTURA_COMMENT_MARKER, $comment, $sql);

$sqlStart = microtime(true);
$stmt = $pdo->query($sql);
if(!$stmt)
{
return false;
}

$sqlTook = microtime(true) - $sqlStart;

$this->_monitorEvents[] = array(array('KalturaMonitorClient', 'monitorDatabaseAccess'), array($sql, $sqlTook, $hostName));

if ($query['fetchStyle'] == PDO::FETCH_COLUMN)
$result = $stmt->fetchAll($query['fetchStyle'], $query['columnIndex']);
else
Expand Down Expand Up @@ -745,6 +770,18 @@ public function checkCache($cacheHeaderName = 'X-Kaltura', $cacheHeader = 'cache
$action = $this->_params['service'] . '.' . $this->_params['action'];

KalturaMonitorClient::monitorApiStart($result !== false, $action, $this->_partnerId, $this->getCurrentSessionType(), $this->clientTag, $isInMultiRequest);

foreach ($this->_monitorEvents as $event)
{
list($func, $params) = $event;

call_user_func_array($func, $params);
}

if ($result !== false)
{
KalturaMonitorClient::flushPacket();
}
}

return $result;
Expand Down
Loading

0 comments on commit 7bb3584

Please sign in to comment.