From 732b2ac9a2df93613df6475885fd5eebe38a2a90 Mon Sep 17 00:00:00 2001 From: Shahbaa Shalan Date: Tue, 8 Oct 2024 00:10:28 +0300 Subject: [PATCH 1/3] SUP-44927 Getting live delivery profiles script --- .../scripts/utils/getLiveDeliveryProfiles.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 alpha/scripts/utils/getLiveDeliveryProfiles.php diff --git a/alpha/scripts/utils/getLiveDeliveryProfiles.php b/alpha/scripts/utils/getLiveDeliveryProfiles.php new file mode 100644 index 00000000000..052a5c147bf --- /dev/null +++ b/alpha/scripts/utils/getLiveDeliveryProfiles.php @@ -0,0 +1,47 @@ +addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_DELETED, Criteria::NOT_EQUAL); + $c->addAnd(PartnerPeer::ID, $lowest_partner_id, Criteria::GREATER_THAN); + $c->addAscendingOrderByColumn(PartnerPeer::ID); + $c->setLimit($bulk_size); + $partners = PartnerPeer::doSelect($c); + $count_queries++; + if (!$partners) + { + KalturaLog::debug( "No more partners." ); + $partners_exists = false; + } + else + { + KalturaLog::debug( "Looping ". count($partners) ." partners" ); + foreach($partners as $partner) + { + $count_pid++; + $pid = $partner->getId(); + KalturaLog::debug("$count_pid Currently processing PID $pid"); + $live_delivery_profile_ids = $partner->getFromCustomData('live_delivery_profile_ids'); + $live_delivery_profile_ids_string = implode(',', $live_delivery_profile_ids); + fputcsv($output_handle, [$pid, $live_delivery_profile_ids_string]); + } + } + $partner = end($partners); + if($partner) + { + $lowest_partner_id = $partner->getId(); + } + unset($partners); + PartnerPeer::clearInstancePool(); +} From b691defba33c4c28cb382d43735884e7073b7401 Mon Sep 17 00:00:00 2001 From: shahbaa123 <129391094+shahbaa123@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:13:31 +0300 Subject: [PATCH 2/3] Update getLiveDeliveryProfiles.php --- alpha/scripts/utils/getLiveDeliveryProfiles.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/alpha/scripts/utils/getLiveDeliveryProfiles.php b/alpha/scripts/utils/getLiveDeliveryProfiles.php index 052a5c147bf..86d946eedb6 100644 --- a/alpha/scripts/utils/getLiveDeliveryProfiles.php +++ b/alpha/scripts/utils/getLiveDeliveryProfiles.php @@ -3,13 +3,12 @@ $output_csv_file = '/output.csv'; $output_handle = fopen($output_csv_file, 'w'); -fputcsv($output_handle, ['PID', 'Live Delivery Profile']); +fputcsv($output_handle, ['PID', 'Live Delivery Profiles']); $partners_exists = true; $bulk_size = 500; $lowest_partner_id = 100; $count_pid = 0; -$count_queries= 0; while($partners_exists) { $c = new Criteria(); @@ -18,7 +17,6 @@ $c->addAscendingOrderByColumn(PartnerPeer::ID); $c->setLimit($bulk_size); $partners = PartnerPeer::doSelect($c); - $count_queries++; if (!$partners) { KalturaLog::debug( "No more partners." ); From df9036c9b0a1a79ed0126b57777f4c0aa81208b7 Mon Sep 17 00:00:00 2001 From: shahbaa123 <129391094+shahbaa123@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:19:25 +0300 Subject: [PATCH 3/3] Update getLiveDeliveryProfiles.php --- alpha/scripts/utils/getLiveDeliveryProfiles.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/alpha/scripts/utils/getLiveDeliveryProfiles.php b/alpha/scripts/utils/getLiveDeliveryProfiles.php index 86d946eedb6..c7770c51788 100644 --- a/alpha/scripts/utils/getLiveDeliveryProfiles.php +++ b/alpha/scripts/utils/getLiveDeliveryProfiles.php @@ -31,8 +31,12 @@ $pid = $partner->getId(); KalturaLog::debug("$count_pid Currently processing PID $pid"); $live_delivery_profile_ids = $partner->getFromCustomData('live_delivery_profile_ids'); - $live_delivery_profile_ids_string = implode(',', $live_delivery_profile_ids); - fputcsv($output_handle, [$pid, $live_delivery_profile_ids_string]); + // Add to the output file only if the PID has a live delivery profile + if (!empty($live_delivery_profile_ids)) + { + $live_delivery_profile_ids_string = implode(',', $live_delivery_profile_ids); + fputcsv($output_handle, [$pid, $live_delivery_profile_ids_string]); + } } } $partner = end($partners);