diff --git a/VERSION.txt b/VERSION.txt index 5955dc01d7b..2c3b046077e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -Tucana-20.18.0 +Tucana-20.20.0 diff --git a/admin_console/configs/lang/en.php b/admin_console/configs/lang/en.php index baa1074156e..8177df33464 100644 --- a/admin_console/configs/lang/en.php +++ b/admin_console/configs/lang/en.php @@ -393,6 +393,7 @@ 'Kaltura_Client_Enum_UiConfObjType::WEBCASTING' => 'Kaltura Webcasting Studio', 'Kaltura_Client_Enum_UiConfObjType::CLIPPER' => 'KMC Clipper', 'Kaltura_Client_Enum_UiConfObjType::SAP' => 'Slim Audio Player', + 'Kaltura_Client_Enum_UiConfObjType::REELS' => 'Reels Player', //audit trail 'Kaltura_Client_Enum_AuditTrailObjectType::ACCESS_CONTROL' => 'ACCESS_CONTROL', diff --git a/alpha/apps/kaltura/lib/KSecureEntryHelper.class.php b/alpha/apps/kaltura/lib/KSecureEntryHelper.class.php index a62fdae54ca..a132ef56f76 100644 --- a/alpha/apps/kaltura/lib/KSecureEntryHelper.class.php +++ b/alpha/apps/kaltura/lib/KSecureEntryHelper.class.php @@ -159,7 +159,7 @@ public function validateApiAccessControl() public function validateForPlay($performApiAccessCheck = true) { if ($this->entry->getDisplayInSearch() === EntryDisplayInSearchType::RECYCLED && - !($this->entry->isOwnerActionsAllowed(kCurrentContext::getCurrentKsKuserId()) || $this->isKsAdmin())) + !($this->entry->isOwnerActionsAllowed($this->ks->getKuserId()) || $this->isKsAdmin())) { KExternalErrors::dieError(KExternalErrors::RECYCLED_ENTRY_UNAVAILABLE); } diff --git a/alpha/apps/kaltura/lib/clipconcat/kClipManager.php b/alpha/apps/kaltura/lib/clipconcat/kClipManager.php index 3e535a8ca2f..bec36f080bc 100644 --- a/alpha/apps/kaltura/lib/clipconcat/kClipManager.php +++ b/alpha/apps/kaltura/lib/clipconcat/kClipManager.php @@ -898,7 +898,14 @@ protected function setConversionParamsOnResourcesData(&$resourcesData, $conversi { $imageToVideo = $resourceData[self::IMAGE_TO_VIDEO]; $mediaInfoObj = $resourceData[self::MEDIA_INFO_OBJECT]; - $subtitles = isset($resourceData[self::SUBTITLES_DATA_ARRAY]) && count($resourceData[self::SUBTITLES_DATA_ARRAY]) > 0; + $subtitles = false; + if(isset($resourceData[self::SUBTITLES_DATA_ARRAY])) + { + foreach ($resourceData[self::SUBTITLES_DATA_ARRAY] as $subtitlesArray) + { + $subtitles = $subtitles || count($subtitlesArray) > 0; + } + } $currentConversionParams = array(); $currentConversionParams[self::TARGET_HEIGHT] = $targetHeight; @@ -968,7 +975,7 @@ protected function setConversionParamsOnResourcesData(&$resourcesData, $conversi if($subtitles) { $prevParams = isset($currentConversionParams[self::EXTRA_CONVERSION_PARAMS]) ? $currentConversionParams[self::EXTRA_CONVERSION_PARAMS] : ""; - $currentConversionParams[self::EXTRA_CONVERSION_PARAMS] = $prevParams . " -copyts"; + $currentConversionParams[self::EXTRA_CONVERSION_PARAMS] = "$prevParams -copyts "; } $resourcesData[$key][self::CONVERSION_PARAMS] = json_encode($currentConversionParams, true); diff --git a/alpha/apps/kaltura/lib/db/DbManager.php b/alpha/apps/kaltura/lib/db/DbManager.php index 0de0f956ec9..b0a7cc241ed 100644 --- a/alpha/apps/kaltura/lib/db/DbManager.php +++ b/alpha/apps/kaltura/lib/db/DbManager.php @@ -233,6 +233,12 @@ protected static function getSphinxConnIndexByLastUpdatedAt($dataSources) } list($hostToLag, $hostToIndex) = self::filterLagsAndHosts($dataSources, $lastUpdatedAtPerSphinx); + if(!count($hostToLag)) + { + KalturaLog::debug("failed to map sphinx host to sphinx lag data, no sphinx index will be chosen by updatedAt"); + return false; + } + return self::getPreferredSphinxIndexByWeight($hostToLag, $hostToIndex); } diff --git a/alpha/apps/kaltura/lib/kPermissionManager.php b/alpha/apps/kaltura/lib/kPermissionManager.php index a7cbc058ecc..4ac47f5aaf6 100644 --- a/alpha/apps/kaltura/lib/kPermissionManager.php +++ b/alpha/apps/kaltura/lib/kPermissionManager.php @@ -1093,20 +1093,32 @@ public function objectCreated(BaseObject $object) return true; } - protected static function handlePermissions($object) + protected static function handlePermissions($permission) { - switch ($object->getName()) + switch ($permission->getName()) { case PermissionName::FEATURE_RECYCLE_BIN: - self::handleRecycleBinPermission($object); + self::handleRecycleBinPermission($permission); return; case PermissionName::GAME_PLUGIN_PERMISSION: - self::handleGamePluginPermission($object); + self::handleGamePluginPermission($permission); + return; + + case PermissionName::FEATURE_MEDIA_REPURPOSING_NG_PERMISSION: + self::handleMediaRepurposingNGPermission($permission); return; } } + protected static function handleMediaRepurposingNGPermission($permission) + { + if ($permission->getStatus() == PermissionStatus::ACTIVE) + { + MediaRepurposingHandler::enableMrPermission($permission->getPartnerId()); + } + } + protected static function handleGamePluginPermission($permission) { $partner = PartnerPeer::retrieveByPK($permission->getPartnerId()); @@ -1120,12 +1132,23 @@ protected static function handleRecycleBinPermission($permission) if ($permission->getStatus() == PermissionStatus::ACTIVE) { self::enableRecycleBinScheduledTaskProfile($permission->getPartnerId()); + self::enableRequiredPluginsPermissions($permission->getPartnerId(), PermissionName::SCHEDULEDTASK_PLUGIN_PERMISSION); } elseif ($permission->getStatus() == PermissionStatus::BLOCKED) { self::disableRecycleBinScheduledTaskProfile($permission->getPartnerId()); } } + + protected static function enableRequiredPluginsPermissions($partnerId, $permissionName) + { + $requiredPluginPermission = PermissionPeer::getByNameAndPartner($permissionName, array($partnerId)); + if ($requiredPluginPermission->getStatus() != PermissionStatus::ACTIVE) + { + $requiredPluginPermission->setStatus(PermissionStatus::ACTIVE); + $requiredPluginPermission->save(); + } + } protected static function enableRecycleBinScheduledTaskProfile($partnerId) { diff --git a/alpha/apps/kaltura/lib/microservice/MicroServiceBaseService.php b/alpha/apps/kaltura/lib/microservice/MicroServiceBaseService.php index 6e8777f4d4a..2add7ca6481 100644 --- a/alpha/apps/kaltura/lib/microservice/MicroServiceBaseService.php +++ b/alpha/apps/kaltura/lib/microservice/MicroServiceBaseService.php @@ -47,7 +47,7 @@ private function generateSession($partnerId) * @return string * @throws Exception */ - public static function buildServiceUrl($hostName, $serviceName) + public static function buildServiceUrl($hostName, $serviceName, $isApi = true) { $serviceUrl = kConf::get("microservice_url", 'local', null); if(!$serviceUrl) @@ -61,6 +61,10 @@ public static function buildServiceUrl($hostName, $serviceName) { $serviceUrl = $serviceUrl . '/' . trim($serviceName, "\/"); } + if(!$isApi) + { + return str_replace('/api', '', $serviceUrl); + } return $serviceUrl; } diff --git a/alpha/apps/kaltura/lib/microservice/MicroServiceUnisphereLoader.php b/alpha/apps/kaltura/lib/microservice/MicroServiceUnisphereLoader.php new file mode 100644 index 00000000000..8459e212621 --- /dev/null +++ b/alpha/apps/kaltura/lib/microservice/MicroServiceUnisphereLoader.php @@ -0,0 +1,15 @@ +hostName = self::$host; + parent::__construct(); + } +} diff --git a/alpha/apps/kaltura/lib/myEntryUtils.class.php b/alpha/apps/kaltura/lib/myEntryUtils.class.php index b6d7f541360..e412d0bff93 100644 --- a/alpha/apps/kaltura/lib/myEntryUtils.class.php +++ b/alpha/apps/kaltura/lib/myEntryUtils.class.php @@ -1015,7 +1015,7 @@ public static function resizeEntryImage( entry $entry, $version, $width, $height if (!$success) { - $success = self::captureLocalThumb($entry, $capturedThumbPath, $calc_vid_sec, $cache, $cacheLockKey, $cacheLockKeyProcessing, $flavorAssetId, $fileToDelete); + $success = self::captureLocalThumb($entry, $capturedThumbPath, $calc_vid_sec, $cache, $cacheLockKey, $cacheLockKeyProcessing, $flavorAssetId, -1, -1, $fileToDelete); } } diff --git a/alpha/apps/kaltura/lib/reports/kKavaEventPlatformReports.php b/alpha/apps/kaltura/lib/reports/kKavaEventPlatformReports.php index 67d33f1a487..3d8ae62297e 100644 --- a/alpha/apps/kaltura/lib/reports/kKavaEventPlatformReports.php +++ b/alpha/apps/kaltura/lib/reports/kKavaEventPlatformReports.php @@ -319,6 +319,29 @@ class kKavaEventPlatformReports extends kKavaReportsMgr self::METRIC_UNIQUE_VOD_VIEW_PERIOD_USERS, self::METRIC_VOD_UNIQUE_PERCENTILES_RATIO ) + ), + + ReportType::EP_WEBCAST_ENGAGEMENT_OVER_TIME => array( + self::REPORT_DIMENSION_MAP => array( + 'position' => self::DIMENSION_POSITION + ), + self::REPORT_FILTER => array( + self::DRUID_TYPE => self::DRUID_NOT, + self::DRUID_FILTER => array( + self::DRUID_DIMENSION => self::DIMENSION_POSITION, + self::DRUID_VALUES => array(self::VALUE_UNKNOWN, "0", "") + ) + ), + self::REPORT_JOIN_REPORTS => array( + array( + self::REPORT_UNION_DATA_SOURCES => array(self::DATASOURCE_HISTORICAL, self::DATASOURCE_MEETING_HISTORICAL), + self::REPORT_METRICS => array(self::METRIC_UNIQUE_COMBINED_LIVE_VIEW_PERIOD_USERS, self::METRIC_COMBINED_LIVE_ENGAGED_USERS_RATIO) + ), + array( + self::REPORT_DATA_SOURCE => self::DATASOURCE_CNC_EVENTS, + self::REPORT_METRICS => array(self::EVENT_TYPE_MESSAGE_LIKED, self::EVENT_TYPE_REACTION_CLICKED, self::EVENT_TYPE_GROUP_MESSAGE_SENT) + ) + ) ) ); diff --git a/alpha/apps/kaltura/lib/reports/kKavaReportsMgr.class.php b/alpha/apps/kaltura/lib/reports/kKavaReportsMgr.class.php index 9b47e7b3e1c..572f517771e 100644 --- a/alpha/apps/kaltura/lib/reports/kKavaReportsMgr.class.php +++ b/alpha/apps/kaltura/lib/reports/kKavaReportsMgr.class.php @@ -2833,6 +2833,12 @@ protected static function getEntryKuserDimension($data_source) return in_array($data_source, array(self::DATASOURCE_ENTRY_LIFECYCLE, self::DATASOURCE_STORAGE_USAGE)) ? self::DIMENSION_KUSER_ID : self::DIMENSION_ENTRY_OWNER_ID; } + protected static function getEntryIdDimension($data_source) + { + return $data_source === self::DATASOURCE_CNC_EVENTS ? self::DIMENSION_CONTEXT_ID : self::DIMENSION_ENTRY_ID; + } + + protected static function getDruidFilter($partner_id, $report_def, $input_filter, $object_ids, $response_options) { $druid_filter = array(); @@ -2888,6 +2894,7 @@ protected static function getDruidFilter($partner_id, $report_def, $input_filter ); } + $entry_id_dimension = self::getEntryIdDimension($data_source); $field_dim_map = array( 'categoriesIds' => array(self::DRUID_DIMENSION => self::DIMENSION_CATEGORIES), 'countries' => array(self::DRUID_DIMENSION => self::DIMENSION_LOCATION_COUNTRY), @@ -2906,8 +2913,8 @@ protected static function getDruidFilter($partner_id, $report_def, $input_filter 'cities' => array(self::DRUID_DIMENSION => self::DIMENSION_LOCATION_CITY), 'media_types' => array(self::DRUID_DIMENSION => self::DIMENSION_MEDIA_TYPE), 'source_types' => array(self::DRUID_DIMENSION => self::DIMENSION_SOURCE_TYPE), - 'entries_ids' => array(self::DRUID_DIMENSION => self::DIMENSION_ENTRY_ID), - 'entries_ids_not_in' => array(self::DRUID_DIMENSION => self::DIMENSION_ENTRY_ID, self::DRUID_TYPE => self::DRUID_NOT), + 'entries_ids' => array(self::DRUID_DIMENSION => $entry_id_dimension), + 'entries_ids_not_in' => array(self::DRUID_DIMENSION => $entry_id_dimension, self::DRUID_TYPE => self::DRUID_NOT), 'playback_context_ids' => array(self::DRUID_DIMENSION => self::DIMENSION_PLAYBACK_CONTEXT), 'root_entries_ids' => array(self::DRUID_DIMENSION => self::DIMENSION_ROOT_ENTRY_ID), 'event_var1' => array(self::DRUID_DIMENSION => self::DIMENSION_EVENT_VAR1), @@ -3066,7 +3073,7 @@ protected static function getDruidFilter($partner_id, $report_def, $input_filter if (count($entry_ids_from_db)) { $druid_filter[] = array( - self::DRUID_DIMENSION => self::DIMENSION_ENTRY_ID, + self::DRUID_DIMENSION => $entry_id_dimension, self::DRUID_VALUES => array_values(array_unique($entry_ids_from_db)) ); } diff --git a/alpha/apps/kaltura/lib/v2RedirectUtils.class.php b/alpha/apps/kaltura/lib/v2RedirectUtils.class.php new file mode 100644 index 00000000000..83336c443ae --- /dev/null +++ b/alpha/apps/kaltura/lib/v2RedirectUtils.class.php @@ -0,0 +1,106 @@ + ["playkitscreen", "playkit-js-info"], + "quiz" => ["playkit-ivq", "ivq"], + "moderation" => ["playkit-moderation", "playkit-js-moderation"], + "playlistAPI" => ["playkit-playlist", "playlist"], + "liveStatus" => ["playkit-kaltura-live","kaltura-live"], + "related" => ["playkit-related", "related"], + "dualScreen" => ["playkit-dual-screen", "dualscreen"], + "video360" => ["playkit-vr" ,"vr"], + "raptMedia" => ["rapt", "rapt"], + "transcript" => ["playkit-transcript", "playkit-js-transcript"], + "qna" => ["playkit-qna", "qna"], + "bumper" => [ "playkit-bumper" , "bumper" ], + "infoScreen" => ["playkit-info", "playkit-js-info"]]; + + if(isset($translation[$v2PluginName])) + { + $v7PluginInfo = $translation[$v2PluginName]; + KalturaLog::log("Found " . print_r($v7PluginInfo, true)); + return $v7PluginInfo; + } + else + { + throw new Exception ($v2PluginName); + } + } + + static function addV2toV7plugins($flashvars, &$bundleConfig, &$playerConfig) + { + if(!$flashvars) + { + return; + } + $unHandledPlugins = array(); + + //Merge v7 config + foreach ($flashvars as $key => $value) + { + if(self::isVarPlugin($key)) + { + //get plugin name + KalturaLog::log("V2 to V7 adding plugin: " . $key. " value:" . $value); + if ($value) + { + if (!$bundleConfig) + { + $bundleConfig = []; + } + $key = trim(trim($key, '"'), "'"); + $v2PluginName = explode(".", $key); + try + { + $v7PluginName = self::getV7PluginInfo($v2PluginName[0]); + $bundleConfig = array_merge($bundleConfig, [$v7PluginName[0] => "{latest}"]); + $v7PluginConfig = $v7PluginName[1]; + if (!isset($playerConfig->plugins)) + { + $playerConfig->plugins = new stdClass(); + } + if (!isset($playerConfig->plugins->$v7PluginConfig)) + { + $playerConfig->plugins->$v7PluginConfig = new stdClass(); + } + } + catch (Exception $e){ + $unHandledPlugins[] = $e->getMessage(); + } + } + } + } + if(sizeof($unHandledPlugins)) + { + throw new Exception ("Unhandled plugins: " . implode(", ", $unHandledPlugins)); + } + } + + static function addV2toV7config($flashvars, $uiconfId) + { + $config = []; + if($flashvars) + { foreach ($flashvars as $key => $value) + { + $key = trim(trim($key, '"'), "'"); + $config[$key] = json_decode($value); + } + } + $config["uiconf_id"] = $uiconfId; + return $config; + } + + private static function isVarPlugin($varKeyName) + { + return str_contains($varKeyName, ".plugin"); + } +} diff --git a/alpha/apps/kaltura/modules/extwidget/actions/embedIframeJsAction.class.php b/alpha/apps/kaltura/modules/extwidget/actions/embedIframeJsAction.class.php index 454531a8d5b..101ae10d3bf 100644 --- a/alpha/apps/kaltura/modules/extwidget/actions/embedIframeJsAction.class.php +++ b/alpha/apps/kaltura/modules/extwidget/actions/embedIframeJsAction.class.php @@ -47,7 +47,6 @@ public function execute() $ui_conf_html5_url = $uiConf->getHtml5Url(); - if (array_key_exists($partner_id, $optimizedPlayback)) { // force a specific kdp for the partner @@ -61,6 +60,17 @@ public function execute() $autoEmbed = $this->getRequestParameter('autoembed'); $iframeEmbed = $this->getRequestParameter('iframeembed'); + + //redirect the call to V7 + if( $uiConf->getV2Redirect() && + $uiConf->getV2Redirect()->getV7id() && + ( $uiConf->getV2Redirect()->getIsApproved() || $this->getRequestParameter(v2RedirectUtils::V2REDIRECT_PARAM_NAME) ) + ) + { + $this->redirectToV7($uiConf->getV2Redirect()->getV7id(), $uiconf_id, $partner_id, $uiConf->getV2Redirect()->getTranslatePlugins() ); + } + + $scriptName = ($iframeEmbed) ? 'mwEmbedFrame.php' : 'mwEmbedLoader.php'; if($ui_conf_html5_url && $iframeEmbed) { $ui_conf_html5_url = str_replace('mwEmbedLoader.php', 'mwEmbedFrame.php', $ui_conf_html5_url); @@ -143,4 +153,38 @@ public function execute() header("Location:$url"); KExternalErrors::dieGracefully(); } + + private function redirectToV7($v7Id, $v2UiConfId, $partnerId, $shouldTranslatePlugins) : void + { + //validate all the params are handled + try + { + $config = array(); + $config['bundleConfig'] = null; + $config['playerConfig'] = new stdClass(); + v2RedirectUtils::addV2toV7config($this->getRequestParameter(v2RedirectUtils::FLASHVARS_PARAM_NAME),$v7Id); + if($shouldTranslatePlugins) + { + v2RedirectUtils::addV2toV7plugins( + $this->getRequestParameter(v2RedirectUtils::FLASHVARS_PARAM_NAME), + $config['bundleConfig'], + $config['playerConfig']); + } + } + catch(Exception $e) + { + //if we failed, then should not redirect! + KalturaLog::log('V2toV7 was rejected because: ' . $e->getMessage() . ' v2 id:' . $v2UiConfId. ' v7 id:' . $v2UiConfId); + return; + } + + $shouldTranslatePluginsQueryParam = $shouldTranslatePlugins ? '&' . v2RedirectUtils::SHOULD_TRANSLATE_PLUGINS . '=true' : '' ; + $host = myPartnerUtils::getCdnHost($partnerId, null , 'api'); + $url = $host . '/p/' . $partnerId . '/embedPlaykitJs/uiconf_id/' . $v7Id . '?' + . $_SERVER['QUERY_STRING'] . "&" + . v2RedirectUtils::V2REDIRECT_PARAM_NAME .'=true' + . $shouldTranslatePluginsQueryParam; + header("Location:$url"); + KExternalErrors::dieGracefully(); + } } diff --git a/alpha/apps/kaltura/modules/extwidget/actions/embedPlaykitJsAction.class.php b/alpha/apps/kaltura/modules/extwidget/actions/embedPlaykitJsAction.class.php index e7a2880c809..596648e414d 100644 --- a/alpha/apps/kaltura/modules/extwidget/actions/embedPlaykitJsAction.class.php +++ b/alpha/apps/kaltura/modules/extwidget/actions/embedPlaykitJsAction.class.php @@ -1,5 +1,4 @@ uiConfId = $this->uiconfId; $ks = $this->getRequestParameter(self::KS_PARAM_NAME); - if ($ks) { $config["provider"]->ks = $ks; } $config["targetId"] = $targetId; - $config = json_encode($config); if ($config === false) { KExternalErrors::dieError(KExternalErrors::INVALID_PARAMETER, "Invalid config object"); } + $v2tov7ConfigJs=''; + if($this->getRequestParameter(v2RedirectUtils::V2REDIRECT_PARAM_NAME)) + { + $v2ToV7config = v2RedirectUtils::addV2toV7config($this->getRequestParameter(v2RedirectUtils::FLASHVARS_PARAM_NAME), $this->uiconfId); + $v2tov7ConfigJs = 'config = window.__buildV7Config('.JSON_encode($v2ToV7config).',config)'; + + } + $autoEmbedCode = " try { - var kalturaPlayer = KalturaPlayer.setup($config); + var config=$config; + $v2tov7ConfigJs + var kalturaPlayer = KalturaPlayer.setup(config); $loadContentMethod } catch (e) { console.error(e.message); @@ -543,7 +550,7 @@ private function getIfarmEmbedCode($bundleContent)
- +