-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tucana 20.16.0 plat 24907 update legacy ep partners #12821
base: Tucana-20.17.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
/** | ||
* Set Concurrent Live-Plus streams purchased to 15 for partners with FEATURE_EVENT_PLATFORM_PERMISSION enabled | ||
* | ||
* | ||
* Examples: | ||
* php enableEventPlatformPermissionToPartners.php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not the name of the script |
||
* php enableEventPlatformPermissionToPartners.php realrun | ||
* | ||
* @package Deployment | ||
* @subpackage updates | ||
*/ | ||
|
||
$dryRun = true; | ||
if (in_array('realrun', $argv)) | ||
$dryRun = false; | ||
|
||
$countLimitEachLoop = 500; | ||
$offset = $countLimitEachLoop; | ||
|
||
const FEATURE_EVENT_PLATFORM_PERMISSION = 'FEATURE_EVENT_PLATFORM_PERMISSION'; | ||
const DEFAULT_MAX_OUTPUT_STREAMS = '15'; | ||
|
||
//------------------------------------------------------ | ||
|
||
|
||
require_once(__DIR__ . '/../../../deployment/bootstrap.php'); | ||
|
||
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2); | ||
KalturaStatement::setDryRun($dryRun); | ||
|
||
$c = new Criteria(); | ||
$c->addAscendingOrderByColumn(PartnerPeer::ID); | ||
$c->addAnd(PartnerPeer::ID, 99, Criteria::GREATER_EQUAL); | ||
$c->addAnd(PartnerPeer::STATUS,1, Criteria::EQUAL); | ||
$c->setLimit($countLimitEachLoop); | ||
|
||
$partners = PartnerPeer::doSelect($c, $con); | ||
|
||
while (count($partners)) | ||
{ | ||
foreach ($partners as $partner) | ||
{ | ||
/* @var $partner Partner */ | ||
$eventPlatformPermission = PermissionPeer::getByNameAndPartner(FEATURE_EVENT_PLATFORM_PERMISSION, $partner->getId()); | ||
if ($eventPlatformPermission && $eventPlatformPermission->getStatus() == PermissionStatus::ACTIVE) | ||
{ | ||
updateMaxLiveStreamOutputs($partner, $eventPlatformPermission->getStatus()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont see any reason to pass the status to the funciton, you dont really need it and if we want to have a debug print we can just have it here |
||
|
||
addLiveFlavorsToLiveTranscodingProfile($partner->getId(), $con); | ||
} | ||
} | ||
|
||
kMemoryManager::clearMemory(); | ||
$c = new Criteria(); | ||
$c->addAscendingOrderByColumn(PartnerPeer::ID); | ||
$c->addAnd(PartnerPeer::ID, 99, Criteria::GREATER_EQUAL); | ||
$c->addAnd(PartnerPeer::STATUS,1, Criteria::EQUAL); | ||
$c->setLimit($countLimitEachLoop); | ||
$c->setOffset($offset); | ||
|
||
$partners = PartnerPeer::doSelect($c, $con); | ||
$offset += $countLimitEachLoop; | ||
} | ||
|
||
function updateMaxLiveStreamOutputs($partner, $eventPlatformPermissionStatus): void | ||
{ | ||
$partner->setMaxLiveStreamOutputs(DEFAULT_MAX_OUTPUT_STREAMS); | ||
print("Existing Event Platform permission on partner: [" . $partner->getId(). "] with status [" . $eventPlatformPermissionStatus. "] max output streams set to ". DEFAULT_MAX_OUTPUT_STREAMS . "\n"); | ||
$partner->save(); | ||
} | ||
|
||
function addLiveFlavorsToLiveTranscodingProfile($partnerId, $con) | ||
{ | ||
$conversionProfileCriteria = new Criteria(); | ||
$conversionProfileCriteria->add(conversionProfile2Peer::PARTNER_ID, $partnerId, Criteria::EQUAL); | ||
$conversionProfileCriteria->add(conversionProfile2Peer::SYSTEM_NAME, 'Default_Live', Criteria::EQUAL); | ||
$conversionProfile = conversionProfile2Peer::doSelectOne($conversionProfileCriteria, $con); | ||
|
||
if ($conversionProfile) | ||
{ | ||
$flavorParamsConversionProfileCriteria = new Criteria(); | ||
$flavorParamsConversionProfileCriteria->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId(), Criteria::EQUAL); | ||
$flavorParamsConversionProfileCriteria->add(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, 42, Criteria::EQUAL); | ||
$flavorParamsConversionProfile = flavorParamsConversionProfilePeer::doSelectOne($flavorParamsConversionProfileCriteria, $con); | ||
|
||
if(!$flavorParamsConversionProfile) | ||
{ | ||
$flavorParamsConversionProfile42 = new flavorParamsConversionProfile; | ||
/** @var $flavorParamsConversionProfile $flavorParamsConversionProfile42 */ | ||
$flavorParamsConversionProfile42->setConversionProfileId($conversionProfile->getId()); | ||
$flavorParamsConversionProfile42->setFlavorParamsId(42); | ||
$flavorParamsConversionProfile42->setSystemName('HD/720 - WEB/MBL (H264/1700)'); | ||
$flavorParamsConversionProfile42->save(); | ||
print("flavor 42 added to Conversion Profile 'Cloud transcode' for partner [" . $partnerId . "]\n"); | ||
} | ||
|
||
$flavorParamsConversionProfileCriteria->add(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, 43, Criteria::EQUAL); | ||
$flavorParamsConversionProfile = flavorParamsConversionProfilePeer::doSelectOne($flavorParamsConversionProfileCriteria, $con); | ||
if(!$flavorParamsConversionProfile) | ||
{ | ||
$flavorParamsConversionProfile43 = new flavorParamsConversionProfile; | ||
/** @var $flavorParamsConversionProfile $flavorParamsConversionProfile43 */ | ||
$flavorParamsConversionProfile43->setConversionProfileId($conversionProfile->getId()); | ||
$flavorParamsConversionProfile43->setFlavorParamsId(43); | ||
$flavorParamsConversionProfile43->setSystemName('HD/720 - WEB/MBL (H264/2600)'); | ||
$flavorParamsConversionProfile43->save(); | ||
} | ||
} | ||
else | ||
{ | ||
print("Conversion Profile 'Cloud transcode' for partner [" . $partnerId . "] was not found\n"); | ||
} | ||
} | ||
|
||
print("Done\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will effect all partners so dont change it