コード例 #1
0
ファイル: getFeed.php プロジェクト: richhl/kalturaCE
<?php

$start = microtime(true);
set_time_limit(0);
require_once dirname(__FILE__) . '/../../alpha/config/sfrootdir.php';
// check cache before loading anything
require_once "../lib/KalturaResponseCacher.php";
$cache = new KalturaResponseCacher(null, "/web/cache/feed/", 86400);
$cache->checkOrStart();
require_once "../bootstrap.php";
KalturaLog::setContext("syndicationFeedRenderer");
KalturaLog::debug(">------------------------------------- syndicationFeedRenderer -------------------------------------");
KalturaLog::info("syndicationFeedRenderer-start ");
$feedId = $_GET['feedId'];
$entryId = @$_GET['entryId'];
try {
    $syndicationFeedRenderer = new KalturaSyndicationFeedRenderer($feedId);
    $syndicationFeedRenderer->addFlavorParamsAttachedFilter();
    if (isset($entryId)) {
        $syndicationFeedRenderer->addEntryAttachedFilter($entryId);
    }
    $syndicationFeedRenderer->execute();
} catch (Exception $ex) {
    header('KalturaSyndication: ' . $ex->getMessage());
    die;
}
$end = microtime(true);
KalturaLog::info("syndicationFeedRenderer-end [" . ($end - $start) . "]");
KalturaLog::debug("<------------------------------------- syndicationFeedRenderer -------------------------------------");
$cache->end();
コード例 #2
0
 /**
  *  request conversion for all entries that doesnt have the required flavor param
  *  returns a comma-separated ids of conversion jobs
  *
  *  @action requestConversion
  *  @param string $feedId
  *  @return string
  */
 public function requestConversionAction($feedId)
 {
     // find entry ids that already converted to the flavor
     $feedRendererWithTheFlavor = new KalturaSyndicationFeedRenderer($feedId);
     $feedRendererWithTheFlavor->addFlavorParamsAttachedFilter();
     $entriesWithTheFlavor = $feedRendererWithTheFlavor->getEntriesIds();
     // create filter of the entries that not converted
     $entryFilter = new entryFilter();
     $entryFilter->setIdNotIn($entriesWithTheFlavor);
     // create feed with the new filter
     $feedRendererToConvert = new KalturaSyndicationFeedRenderer($feedId);
     $feedRendererToConvert->addFilter($entryFilter);
     $createdJobsIds = array();
     $flavorParamsId = $feedRendererToConvert->syndicationFeed->flavorParamId;
     while ($entry = $feedRendererToConvert->getNextEntry()) {
         $originalFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry->getId());
         if (!is_null($originalFlavorAsset)) {
             $err = "";
             $job = kBusinessPreConvertDL::decideAddEntryFlavor(null, $entry->getId(), $flavorParamsId, $err);
             if ($job && is_object($job)) {
                 $createdJobsIds[] = $job->getId();
             }
         }
     }
     return implode(',', $createdJobsIds);
 }
コード例 #3
0
ファイル: getFeed.php プロジェクト: kubrickfr/server
KalturaLog::debug("getFeed Params [" . print_r(requestUtils::getRequestParams(), true) . "]");
kCurrentContext::$host = isset($_SERVER["HOSTNAME"]) ? $_SERVER["HOSTNAME"] : null;
kCurrentContext::$user_ip = requestUtils::getRemoteAddress();
kCurrentContext::$ps_vesion = "ps3";
$feedId = getRequestParameter('feedId');
$entryId = getRequestParameter('entryId');
$limit = getRequestParameter('limit');
$ks = getRequestParameter('ks');
$feedProcessingKey = "feedProcessing_{$feedId}_{$entryId}_{$limit}";
if (function_exists('apc_fetch')) {
    if (apc_fetch($feedProcessingKey)) {
        KExternalErrors::dieError(KExternalErrors::PROCESSING_FEED_REQUEST);
    }
}
try {
    $syndicationFeedRenderer = new KalturaSyndicationFeedRenderer($feedId, $feedProcessingKey, $ks);
    $syndicationFeedRenderer->addFlavorParamsAttachedFilter();
    kCurrentContext::$partner_id = $syndicationFeedRenderer->syndicationFeed->partnerId;
    if (isset($entryId)) {
        $syndicationFeedRenderer->addEntryAttachedFilter($entryId);
    }
    $syndicationFeedRenderer->execute($limit);
} catch (PropelException $pex) {
    KalturaLog::alert($pex->getMessage());
    KExternalErrors::dieError(KExternalErrors::PROCESSING_FEED_REQUEST, 'KalturaSyndication: Database error');
} catch (Exception $ex) {
    KalturaLog::err($ex->getMessage());
    $msg = 'KalturaSyndication: ' . str_replace(array("\n", "\r"), array("\t", ''), $ex->getMessage());
    KExternalErrors::dieError(KExternalErrors::PROCESSING_FEED_REQUEST, $msg);
}
//in KalturaSyndicationFeedRenderer - if the limit does restrict the amount of entries - the entries counter passes the limit's value by one , so it must be decreased back