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

playsViews - fix default value + add optimization to executePlaylist #8068

Merged
merged 2 commits into from Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion alpha/apps/kaltura/lib/myPlaylistUtils.class.php
Expand Up @@ -194,7 +194,8 @@ public static function executePlaylist ( $partner_id , $playlist , $filter = nu

// Clear the context for next time
self::$playlistContext = null;

entryPeer::fetchPlaysViewsData($entryObjectsArray);

return $entryObjectsArray;
}

Expand Down
2 changes: 1 addition & 1 deletion alpha/lib/model/entry.php
Expand Up @@ -4209,7 +4209,7 @@ protected function getValueFromPlaysViewsData($key)
{
return $this->playsViewsData[$key];
}
return null;
return 0;
}

public function getPlays()
Expand Down
12 changes: 11 additions & 1 deletion alpha/lib/model/entryPeer.php
Expand Up @@ -863,10 +863,15 @@ public static function filterEntriesByPartnerOrKalturaNetwork(array $entryIds, $

public static function fetchPlaysViewsData($entries)
{
if (!$entries)
{
return;
}

$cache = kCacheManager::getSingleLayerCache(kCacheManager::CACHE_TYPE_PLAYS_VIEWS);
if (!$cache)
{
return $entries;
return;
}

$keys = array();
Expand All @@ -879,6 +884,11 @@ public static function fetchPlaysViewsData($entries)
$keys[] = entry::PLAYSVIEWS_CACHE_KEY_PREFIX . $entry->getId();
}

if (!$keys)
{
return;
}

$data = $cache->multiGet($keys);
foreach ($entries as $entry)
{
Expand Down