Skip to content
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

Open
wants to merge 3 commits into
base: Tucana-20.17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alpha/lib/model/Partner.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Partner extends BasePartner

const PARTNER_MAX_LIVE_STREAM_INPUTS_DEFAULT = 10;

const PARTNER_MAX_LIVE_STREAM_OUTPUTS_DEFAULT = 10;
const PARTNER_MAX_LIVE_STREAM_OUTPUTS_DEFAULT = 15;
Copy link
Collaborator

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


const CUSTOMER_DATA_RTC_ENV = 'rtc_env_name';

Expand Down
116 changes: 116 additions & 0 deletions alpha/scripts/utils/setConcurrentLivePlusToPartners.php
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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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());
Copy link
Collaborator

Choose a reason for hiding this comment

The 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");