本文整理汇总了PHP中entryPeer::setUseCriteriaFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::setUseCriteriaFilter方法的具体用法?PHP entryPeer::setUseCriteriaFilter怎么用?PHP entryPeer::setUseCriteriaFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryPeer
的用法示例。
在下文中一共展示了entryPeer::setUseCriteriaFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Will investigate a single entry
*/
public function execute()
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
$this->forceSystemAuthentication();
entryPeer::setUseCriteriaFilter(false);
$this->result = NULL;
$kshow_ids = @$_REQUEST["kshow_ids"];
$this->kshow_ids = $kshow_ids;
$this->kshow = NULL;
$entry_ids = @$_REQUEST["entry_ids"];
$this->entry_ids = $entry_ids;
$this->entry = NULL;
$this->show_entry = null;
$show_entry_list = array();
if (!empty($kshow_ids)) {
$ids_arr = explode(",", $kshow_ids);
$kshows = kshowPeer::retrieveByPKs($ids_arr);
if (!$kshows) {
$this->result = "No kshows [{$kshow_ids}] in DB";
return;
}
foreach ($kshows as $kshow) {
$show_entry = $kshow->getShowEntry();
$show_entry_list[] = $show_entry;
}
} else {
if (empty($entry_ids)) {
$this->result = "Submit an entry_id of a kshow_id to fix";
return;
}
$ids_arr = explode(",", $entry_ids);
$entries = entryPeer::retrieveByPKs($ids_arr);
if (!$entries) {
$this->result = "No entries [{$entry_ids}] in DB";
return;
}
foreach ($entries as $entry) {
if ($entry->getType() != entryType::MIX) {
continue;
}
$show_entry_list[] = $entry;
}
}
$fixed_data_list = array();
foreach ($show_entry_list as $show_entry) {
$fix_data = new fixData();
$fix_data->show_entry = $show_entry;
if ($show_entry->getType() != entryType::MIX) {
$fix_data->error = "Entry is not a roughcut";
} else {
$fix_data->old_content = $show_entry->getMetadata();
$fix_data->old_duration = $show_entry->getLengthInMsecs();
$fix_data->fixed_content = $show_entry->fixMetadata(false);
$fix_data->fixed_duration = $show_entry->getLengthInMsecs();
}
$fixed_data_list[] = $fix_data;
}
$this->fixed_data_list = $fixed_data_list;
}
示例2: retrieveObject
/**
*
* @param int $objectType
* @param string $objectId
* @return ISyncableFile
*/
public static function retrieveObject($objectType, $objectId)
{
$object = null;
switch ($objectType) {
case FileSyncObjectType::ENTRY:
entryPeer::setUseCriteriaFilter(false);
$object = entryPeer::retrieveByPK($objectId);
entryPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::UICONF:
uiConfPeer::setUseCriteriaFilter(false);
$object = uiConfPeer::retrieveByPK($objectId);
uiConfPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::BATCHJOB:
BatchJobPeer::setUseCriteriaFilter(false);
$object = BatchJobPeer::retrieveByPK($objectId);
BatchJobPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::FLAVOR_ASSET:
assetPeer::setUseCriteriaFilter(false);
$object = assetPeer::retrieveById($objectId);
assetPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::SYNDICATION_FEED:
syndicationFeedPeer::setUseCriteriaFilter(false);
$object = syndicationFeedPeer::retrieveByPK($objectId);
syndicationFeedPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::CONVERSION_PROFILE:
conversionProfile2Peer::setUseCriteriaFilter(false);
$object = conversionProfile2Peer::retrieveByPK($objectId);
conversionProfile2Peer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::FILE_ASSET:
conversionProfile2Peer::setUseCriteriaFilter(false);
$object = FileAssetPeer::retrieveByPK($objectId);
conversionProfile2Peer::setUseCriteriaFilter(true);
break;
}
if ($object == null) {
$object = KalturaPluginManager::loadObject('ISyncableFile', $objectType, array('objectId' => $objectId));
}
if ($object == null) {
$error = __METHOD__ . " Cannot find object type [" . $objectType . "] with object_id [" . $objectId . "]";
KalturaLog::err($error);
throw new kFileSyncException($error);
}
return $object;
}
示例3: execute
/**
* Will display errornous entries
*/
public function execute()
{
$this->forceSystemAuthentication();
entryPeer::setUseCriteriaFilter(false);
// find entries with status error
$c = new Criteria();
$c->add(entryPeer::STATUS, entryStatus::ERROR_CONVERTING);
$this->error_converting = entryPeer::doSelect($c);
$date_format = 'Y-m-d H:i:s';
$this->several_minutes_ago = time() - 5 * 60;
// 5 minutes ago //mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$start_date = date($date_format, $this->several_minutes_ago);
$c = new Criteria();
$c->add(entryPeer::STATUS, array(entryStatus::IMPORT, entryStatus::PRECONVERT), Criteria::IN);
$c->add(entryPeer::UPDATED_AT, $start_date, Criteria::LESS_THAN);
$this->error_waiting_too_long = entryPeer::doSelect($c);
$this->start_date = $start_date;
}
示例4: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
// TODO - verify permissions for viewing lists
$detailed = $this->getP("detailed", false);
$limit = $this->getP("page_size", 10);
$page = $this->getP("page", 1);
//$order_by = int( $this->getP ( "order_by" , -1 ) );
$puser_kuser = null;
$use_filter_puser_id = $this->getP("use_filter_puser_id", 1);
if ($use_filter_puser_id == "false") {
$use_filter_puser_id = false;
}
$offset = ($page - 1) * $limit;
kuserPeer::setUseCriteriaFilter(false);
entryPeer::setUseCriteriaFilter(false);
$c = new Criteria();
// filter
$filter = new kshowFilter();
$fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
$this->setExtraFilters($filter);
if ($use_filter_puser_id) {
// if so - assume the producer_id is infact a puser_id and the kuser_id should be retrieved
$target_puser_id = $filter->get("_eq_producer_id");
//$this->getP ( "filter__eq_producer_id" );
if ($target_puser_id) {
// TODO - shoud we use the subp_id to retrieve the puser_kuser ?
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $target_puser_id, false);
if ($puser_kuser) {
$filter->set("_eq_producer_id", $puser_kuser->getkuserId());
//$this->setP ( "filter__eq_producer_id" , $puser_kuser->getkuserId() );
}
}
}
$filter->attachToCriteria($c);
//if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
$count = kshowPeer::doCount($c);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
if ($detailed) {
$list = kshowPeer::doSelectJoinAll($c);
$level = objectWrapperBase::DETAIL_LEVEL_DETAILED;
// will have to populate the show_entry before according to the ids
fdb::populateObjects($list, new entryPeer(), "showentryid", "showentry", false);
} else {
$list = kshowPeer::doSelect($c);
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
// will have to populate the show_entry before according to the ids - we display the thumbnail from the showentry
fdb::populateObjects($list, new entryPeer(), "showentryid", "showentry", false);
}
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$wrapper = objectWrapperBase::getWrapperClass($list, $level);
$this->addMsg("kshows", $wrapper);
if ($use_filter_puser_id) {
$this->addMsg("user", objectWrapperBase::getWrapperClass($puser_kuser, objectWrapperBase::DETAIL_LEVEL_REGULAR));
}
/*
$i=0;
foreach ( $list as $kshow )
{
$i++;
$wrapper = objectWrapperBase::getWrapperClass( $kshow , $level );
$this->addMsg ( "kshow$i" , $wrapper ) ;
}
*/
// echo "bbb count: " . count ($list );
// echo "ccc";
//$this->addMsg ( "kshows" , $wrapper ) ;
}
示例5: execute
/**
* Will investigate a single entry
*/
public function execute()
{
$this->forceSystemAuthentication();
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
entryPeer::setUseCriteriaFilter(false);
$this->result = NULL;
$fast = $this->getRequestParameter("fast", "") != "";
$this->fast = $fast;
$kshow_id = $this->getRequestParameter("kshow_id");
$this->kshow_id = $kshow_id;
$this->kshow = NULL;
$entry_id = $this->getRequestParameter("entry_id");
$this->entry_id = $entry_id;
$this->entry = NULL;
$this->error = $this->getRequestParameter("error");
$this->bg_entry = NULL;
if (!empty($kshow_id)) {
$c = new Criteria();
$c->add(kshowPeer::ID, $kshow_id);
$kshows = kshowPeer::doSelect($c);
$kshow = new kshow();
if (!$kshows) {
$this->result = "No kshow [{$kshow_id}] in DB";
return;
}
$kshow_original = $kshows[0];
$kshow_original->getShowEntry();
// pre fetch
$kshow_original->getIntro();
// pre fetch
$this->kshow_original = $kshows[0];
$this->kshow = new genericObjectWrapper($this->kshow_original, true);
$alredy_exist_entries = array();
$alredy_exist_entries[] = $kshow_original->getShowEntryId();
if ($kshow_original->getIntroId()) {
$alredy_exist_entries[] = $kshow_original->getIntroId();
}
$skin_obj = $this->kshow_original->getSkinObj();
$bg_entry_id = $skin_obj->get("bg_entry_id");
if ($bg_entry_id) {
$alredy_exist_entries[] = $bg_entry_id;
$this->bg_entry = new genericObjectWrapper(entryPeer::retrieveByPK($bg_entry_id), true);
}
$c = new Criteria();
$c->add(entryPeer::ID, $alredy_exist_entries, Criteria::NOT_IN);
$c->setLimit(100);
$this->kshow_entries = $this->kshow_original->getEntrysJoinKuser($c);
return;
//return "KshowSuccess";
}
if (empty($entry_id)) {
return;
}
entryPeer::setUseCriteriaFilter(false);
// from entry table
$c = new Criteria();
$c->add(entryPeer::ID, $entry_id);
//$entries = entryPeer::doSelectJoinAll ( $c );
$entries = entryPeer::doSelect($c);
if (!$entries) {
$this->result = "No entry [{$entry_id}] in DB";
return;
}
$this->entry = new genericObjectWrapper($entries[0], true);
// from conversion table
$c = new Criteria();
$c->add(conversionPeer::ENTRY_ID, $entry_id);
$original_conversions = conversionPeer::doSelect($c);
//$this->conversions = array() ; //
$this->conversions = $original_conversions;
//new genericObjectWrapper( $original_conversions );
// find all relevant batches in DB
// from batch_job table
$c = new Criteria();
//$c->add ( BatchJobPeer::DATA , "%\"entryId\";i:" . $entry_id . ";%" , Criteria::LIKE );
$c->add(BatchJobPeer::ENTRY_ID, $entry_id);
$original_batch_jobs = BatchJobPeer::doSelect($c);
$this->batch_jobs = $original_batch_jobs;
// new genericObjectWrapper( $original_batch_jobs );
// use this as a refernece of all the directories
// myBatchFileConverterServer::init( true );
$entry_patttern = "/" . $entry_id . "\\..*/";
$getFileData_method = array('kFile', 'getFileData');
$getFileDataWithContent_method = array('kFile', 'getFileDataWithContent');
// find all relevant files on disk
$c = new Criteria();
$c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ENTRY);
$c->add(FileSyncPeer::OBJECT_ID, $entry_id);
// order by OBJECT SUB TYPE
$c->addAscendingOrderByColumn(FileSyncPeer::OBJECT_SUB_TYPE);
$this->file_syncs = FileSyncPeer::doSelect($c);
$file_sync_links = array();
$flavors = assetPeer::retrieveFlavorsByEntryId($entry_id);
$flavor_ids = array();
$this->flavors = array();
foreach ($flavors as $f) {
$flavor_ids[] = $f->getId();
//.........这里部分代码省略.........
示例6: postInsert
/**
* Code to be run after inserting to database
* @param PropelPDO $con
*/
public function postInsert(PropelPDO $con = null)
{
entryPeer::setUseCriteriaFilter(false);
$this->reload();
entryPeer::setUseCriteriaFilter(true);
kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
if ($this->copiedFrom) {
kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
}
}
示例7: getEntryByIdNoFilter
private function getEntryByIdNoFilter($entryId)
{
entryPeer::setUseCriteriaFilter(false);
$entry = entryPeer::retrieveByPK($entryId);
entryPeer::setUseCriteriaFilter(true);
return $entry;
}
示例8: pollConverted
private function pollConverted($write_to_log = true)
{
list($full_conv_res_path, $file_name, $in_proc) = $this->getFileFromConvertion($write_to_log);
if (!$full_conv_res_path) {
return;
}
$entry_id = self::getEntryIdFromFileName($file_name);
KalturaLog::debug("Updating entry [" . $entry_id . "]");
entryPeer::setUseCriteriaFilter(false);
// update the entry even if it's deleted
// $c = new Criteria();
// $c->add(entryPeer::ID, $entry_id);
// $entry = entryPeer::doSelectOne( $c );
$entry = entryPeer::retrieveByPK($entry_id);
// fetch file from the conversion server and store it in the correct place - content/entry/data/...
// using the ame logic as in contribute/insertEntryAction & myContentStorage...
$this->removeInProc($in_proc);
if ($entry == NULL) {
// TODO - entry does not exist in DB - what to do ?
// move file to some directory
return;
}
// the target of the entry was already set at time of sentToCenversion
$conv_res = kConversionResult::fromFile($full_conv_res_path);
KalturaLog::debug(print_r($conv_res, true));
// sleep a while for synching data on the disk
sleep(3);
$this->markFileSyncAsReady($entry);
$this->updateConvertedEntry($conv_res->status_ok, $entry, $conv_res);
// flag a success to break the row of faliures (is any)
self::succeeded();
}
示例9: copyEntry
public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
{
KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
$newEntry = $entry->copy();
$newEntry->setIntId(null);
$newEntry->setCategories(null);
$newEntry->setCategoriesIds(null);
if ($toPartner instanceof Partner) {
$newEntry->setPartnerId($toPartner->getId());
$newEntry->setSubpId($toPartner->getId() * 100);
$newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
}
$newKuser = null;
if (!$dontCopyUsers) {
// copy the kuser (if the same puser id exists its kuser will be used)
kuserPeer::setUseCriteriaFilter(false);
$kuser = $entry->getKuser();
$newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
$newEntry->setKuserId($newKuser->getId());
$newEntry->setCreatorKuserId($newKuser->getId());
kuserPeer::setUseCriteriaFilter(true);
}
// copy the kshow
kshowPeer::setUseCriteriaFilter(false);
$kshow = $entry->getKshow();
if ($kshow) {
$newKshow = $kshow->copy();
$newKshow->setIntId(null);
$newKshow->setPartnerId($toPartner->getId());
$newKshow->setSubpId($toPartner->getId() * 100);
if ($newKuser) {
$newKshow->setProducerId($newKuser->getId());
}
$newKshow->save();
$newEntry->setKshowId($newKshow->getId());
}
kshowPeer::setUseCriteriaFilter(true);
// reset the statistics
myEntryUtils::resetEntryStatistics($newEntry);
// set the new partner id into the default category criteria filter
$defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
$oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
// save the entry
$newEntry->save();
// restore the original partner id in the default category criteria filter
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
// for any type that does not require assets:
$shouldCopyDataForNonClip = true;
if ($entry->getType() == entryType::MEDIA_CLIP) {
$shouldCopyDataForNonClip = false;
}
if ($entry->getType() == entryType::PLAYLIST) {
$shouldCopyDataForNonClip = false;
}
$shouldCopyDataForClip = false;
// only images get their data copied
if ($entry->getType() == entryType::MEDIA_CLIP) {
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
$shouldCopyDataForClip = true;
}
}
//if entry is a static playlist, link between it and its new child entries
if ($entry->getType() == entryType::PLAYLIST) {
switch ($entry->getMediaType()) {
case entry::ENTRY_MEDIA_TYPE_TEXT:
$from = $entry->getDataContent();
KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
$fromEntryIds = explode(",", $from);
$toEntryIds = array();
foreach ($fromEntryIds as $fromEntryId) {
$toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
}
$newEntry->setDataContent(implode(",", $toEntryIds));
break;
case entry::ENTRY_MEDIA_TYPE_XML:
list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
$toPlaylistXml = new SimpleXMLElement("<playlist/>");
$toPlaylistXml->addChild("total_results", $totalResults);
$toFiltersXml = $toPlaylistXml->addChild("filters");
foreach ($fromFiltersList as $filterXML) {
$entryFilter = new entryFilter();
$entryFilter->fillObjectFromXml($filterXML, "_");
if (isset($entryFilter->fields["_matchand_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
}
if (isset($entryFilter->fields["_matchor_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
//.........这里部分代码省略.........
示例10: reload
/**
* Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
*
* This will only work if the object has been saved and has a valid primary key set.
*
* @param boolean $deep (optional) Whether to also de-associated any related objects.
* @param PropelPDO $con (optional) The PropelPDO connection to use.
* @return void
* @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
*/
public function reload($deep = false, PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("Cannot reload a deleted object.");
}
if ($this->isNew()) {
throw new PropelException("Cannot reload an unsaved object.");
}
if ($con === null) {
$con = Propel::getConnection(entryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool.
entryPeer::setUseCriteriaFilter(false);
$criteria = $this->buildPkeyCriteria();
entryPeer::addSelectColumns($criteria);
$stmt = BasePeer::doSelect($criteria, $con);
entryPeer::setUseCriteriaFilter(true);
$row = $stmt->fetch(PDO::FETCH_NUM);
$stmt->closeCursor();
if (!$row) {
throw new PropelException('Cannot find matching row in the database to reload object values.');
}
$this->hydrate($row, 0, true);
// rehydrate
if ($deep) {
// also de-associate any related objects?
$this->akuser = null;
$this->collLiveChannelSegmentsRelatedByChannelId = null;
$this->lastLiveChannelSegmentRelatedByChannelIdCriteria = null;
$this->collLiveChannelSegmentsRelatedByEntryId = null;
$this->lastLiveChannelSegmentRelatedByEntryIdCriteria = null;
$this->collkvotes = null;
$this->lastkvoteCriteria = null;
$this->collconversions = null;
$this->lastconversionCriteria = null;
$this->collWidgetLogs = null;
$this->lastWidgetLogCriteria = null;
$this->collmoderationFlags = null;
$this->lastmoderationFlagCriteria = null;
$this->collroughcutEntrysRelatedByRoughcutId = null;
$this->lastroughcutEntryRelatedByRoughcutIdCriteria = null;
$this->collroughcutEntrysRelatedByEntryId = null;
$this->lastroughcutEntryRelatedByEntryIdCriteria = null;
$this->collwidgets = null;
$this->lastwidgetCriteria = null;
$this->collassetParamsOutputs = null;
$this->lastassetParamsOutputCriteria = null;
$this->collUserEntrys = null;
$this->lastUserEntryCriteria = null;
}
// if (deep)
}
示例11: executeImpl
/**
* This is not a regular service.
* Because the caller is not a partner but rather a 3rd party provider that wishs to query our system,
* The security is slightly different and the respons is in the format of mRss which is related to entries only.
*/
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
header("Content-Type: text/xml; charset=utf-8");
// TODO - verify permissions for viewing lists
// validate the ks of the caller
$code = $this->getP("code");
if ($code != 'fsalh5423a43g') {
return "<xml></xml>";
die;
}
$detailed = $this->getP("detailed", false);
$limit = $this->getP("page_size", 100);
$limit = $this->maxPageSize($limit);
$operated_partner_id = $this->getP("operated_partner_id");
$page = $this->getP("page", 1);
$offset = ($page - 1) * $limit;
// kuserPeer::setUseCriteriaFilter( false );
if ($operated_partner_id) {
entryPeer::setUseCriteriaFilter(true);
} else {
entryPeer::setUseCriteriaFilter(false);
}
// FOR now - display only 2 partners
// 2460 - dorimedia
$partner_list = array(593, 2460);
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->addAnd(entryPeer::STATUS, entryStatus::READY);
// for now display only entries that are part of the kaltura network
// $c->addAnd ( entryPeer::DISPLAY_IN_SEARCH , mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK );
// filter
$filter = new entryFilter();
$fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
$this->setExtraFilters($filter);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
$filter->attachToCriteria($c);
//if ($order_by != -1) entryPeer::setOrder( $c , $order_by );
$c->addAnd(entryPeer::PARTNER_ID, $partner_list, Criteria::IN);
$start_1 = microtime(true);
if ($detailed) {
// for some entry types - there are no kshow or kusers - don't join even when detailed
if ($this->joinOnDetailed()) {
$list = entryPeer::doSelectJoinAll($c);
} else {
$list = entryPeer::doSelect($c);
}
$level = objectWrapperBase::DETAIL_LEVEL_DETAILED;
} else {
$list = entryPeer::doSelect($c);
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
}
$count = $c->getRecordsCount();
$end_1 = microtime(true);
KalturaLog::log("benchmark db: [" . ($end_1 - $start_1) . "]");
$result_count = count($list);
$start_2 = microtime(true);
$mrss_renderer = new kalturaRssRenderer(kalturaRssRenderer::TYPE_TABOOLA);
$str = $mrss_renderer->renderMrssFeed($list, $page, $result_count);
$end_2 = microtime(true);
KalturaLog::log("benchmark render: [" . ($end_2 - $start_2) . "]");
echo $str;
// don't return to the rest of the implementation - the base class manipulates the content.
die;
}
示例12: getObject
/**
* @return BaseObject
*/
public function getObject()
{
switch ($this->getObjectType()) {
case BatchJobObjectType::ENTRY:
entryPeer::setUseCriteriaFilter(false);
$object = entryPeer::retrieveByPK($this->getObjectId());
entryPeer::setUseCriteriaFilter(true);
return $object;
case BatchJobObjectType::ASSET:
assetPeer::setUseCriteriaFilter(false);
$object = assetPeer::retrieveById($this->getObjectId());
assetPeer::setUseCriteriaFilter(true);
return $object;
case BatchJobObjectType::CATEGORY:
categoryPeer::setUseCriteriaFilter(false);
$object = categoryPeer::retrieveByPK($this->getObjectId());
categoryPeer::setUseCriteriaFilter(true);
return $object;
case BatchJobObjectType::FILE_SYNC:
FileSyncPeer::setUseCriteriaFilter(false);
$object = FileSyncPeer::retrieveByPK($this->getObjectId());
FileSyncPeer::setUseCriteriaFilter(true);
return $object;
default:
// TODO implement IBatchable in relevant plugins
return KalturaPluginManager::loadObject('IBatchable', $this->getObjectId());
}
return $this->aRootJob;
}
示例13: getAllPusersInEntry
/**
*
* Gets all the pusers from the entry table
* @param int $lastEntryDate - the last entry date
* @param int $limit - the limit for the query
*/
private function getAllPusersInEntry($lastEntryDate, $limit)
{
$pusers = array();
entryPeer::clearInstancePool();
$c = new Criteria();
$c->add(entryPeer::CREATED_AT, $lastEntryDate, Criteria::GREATER_THAN);
$c->addAnd(entryPeer::PUSER_ID, null, Criteria::NOT_EQUAL);
$c->addAnd(entryPeer::PUSER_ID, "", Criteria::NOT_EQUAL);
if ($this->partnerId) {
$c->addAnd(entryPeer::PARTNER_ID, $this->partnerId, Criteria::EQUAL);
}
$c->addAnd(entryPeer::PARTNER_ID, $this->ignorePartners, Criteria::NOT_IN);
$c->addAscendingOrderByColumn(entryPeer::CREATED_AT);
$c->setLimit($limit);
entryPeer::setUseCriteriaFilter(false);
$entries = entryPeer::doSelect($c);
entryPeer::setUseCriteriaFilter(true);
foreach ($entries as $entry) {
// $this->printToLog("Found entry with puser [{$entry->getPuserId()}], partner [{$entry->getPartnerId()}]");
$pusers[] = new puserDetails($entry->getPuserId(), $entry->getPartnerId());
file_put_contents($this->lastEntryFile, $entry->getCreatedAt());
}
return $pusers;
}
示例14: serveWebVTTAction
/**
* Serves caption by its id converting it to segmented WebVTT
*
* @action serveWebVTT
* @param string $captionAssetId
* @param int $segmentDuration
* @param int $segmentIndex
* @param int $localTimestamp
* @return file
*
* @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
*/
public function serveWebVTTAction($captionAssetId, $segmentDuration = 30, $segmentIndex = null, $localTimestamp = 10000)
{
$captionAsset = $this->validateForDownload($captionAssetId);
if (!$segmentIndex) {
entryPeer::setUseCriteriaFilter(false);
$entry = entryPeer::retrieveByPK($captionAsset->getEntryId());
if (!$entry) {
throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ENTRY_ID_NOT_FOUND, $captionAsset->getEntryId());
}
entryPeer::setUseCriteriaFilter(true);
return new kRendererString(kWebVTTGenerator::buildWebVTTM3U8File($segmentDuration, (int) $entry->getDuration()), 'application/x-mpegurl');
}
$syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$content = kFileSyncUtils::file_get_contents($syncKey, true, false, self::MAX_SERVE_WEBVTT_FILE_SIZE);
if (!$content) {
throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_FILE_NOT_FOUND, $captionAssetId);
}
$captionsContentManager = kCaptionsContentManager::getCoreContentManager($captionAsset->getContainerFormat());
if (!$captionsContentManager) {
throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_INVALID_FORMAT, $captionAssetId);
}
$parsedCaption = $captionsContentManager->parse($content);
if (!$parsedCaption) {
throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_PARSING_FAILED, $captionAssetId);
}
return new kRendererString(kWebVTTGenerator::buildWebVTTSegment($parsedCaption, $segmentIndex, $segmentDuration, $localTimestamp), 'text/vtt');
}
示例15: init
protected static function init()
{
kEventsManager::enableDeferredEvents(false);
MetadataProfilePeer::setUseCriteriaFilter(false);
MetadataPeer::setUseCriteriaFilter(false);
entryPeer::setUseCriteriaFilter(false);
uiConfPeer::setUseCriteriaFilter(false);
assetPeer::setUseCriteriaFilter(false);
PartnerPeer::setUseCriteriaFilter(false);
FileSyncPeer::setUseCriteriaFilter(false);
$options = getopt('hrl:p:o:b:e:', array('real-run', 'error-objects', 'old-versions', 'blocked-partners', 'files'));
if (isset($options['h'])) {
self::failWrongInputs();
}
if (isset($options['blocked-partners'])) {
self::$deleteDeletedPartnersFileSyncs = true;
}
if (isset($options['error-objects'])) {
self::$deleteErrorObjects = true;
}
if (isset($options['old-versions'])) {
self::$deleteOldVersions = true;
}
if (isset($options['files'])) {
self::$purgeDeletedFileSyncs = true;
}
if (isset($options['r']) || isset($options['real-run'])) {
self::$dryRun = false;
}
KalturaStatement::setDryRun(self::$dryRun);
$cacheFilePath = kConf::get('cache_root_path') . '/scripts/deleteOldContent.cache';
if (file_exists($cacheFilePath)) {
$cache = unserialize(file_get_contents($cacheFilePath));
if (isset($cache['oldVersionsStartUpdatedAt'])) {
self::$oldVersionsStartUpdatedAt = $cache['oldVersionsStartUpdatedAt'];
}
if (isset($cache['purgeStartUpdatedAt'])) {
self::$purgeStartUpdatedAt = $cache['purgeStartUpdatedAt'];
}
}
if (!self::$purgeStartUpdatedAt) {
$criteria = new Criteria();
$criteria->add(FileSyncPeer::UPDATED_AT, 0, Criteria::GREATER_THAN);
$criteria->add(FileSyncPeer::DC, kDataCenterMgr::getCurrentDcId());
$criteria->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_DELETED);
$criteria->addSelectColumn('UNIX_TIMESTAMP(MIN(' . FileSyncPeer::UPDATED_AT . '))');
$stmt = FileSyncPeer::doSelectStmt($criteria);
$mins = $stmt->fetchAll(PDO::FETCH_COLUMN);
if (count($mins)) {
self::$purgeStartUpdatedAt = reset($mins);
}
}
if (is_null(self::$purgeStartUpdatedAt)) {
self::$purgeStartUpdatedAt = 0;
}
self::$purgeNextStartUpdatedAt = self::$purgeStartUpdatedAt;
$oldVersionsUpdatedAtPeriod = 30;
// days
if (isset($options['o'])) {
if (!is_numeric($options['o']) || $options['o'] < 0) {
self::failWrongInputs("Period of old versions to delete must be positive numeric of days");
}
$oldVersionsUpdatedAtPeriod = $options['o'];
}
foreach (self::$oldVersionsStartUpdatedAt as $objectType => $oldVersionsStartUpdatedAt) {
self::$oldVersionsEndUpdatedAt[$objectType] = $oldVersionsStartUpdatedAt + $oldVersionsUpdatedAtPeriod * 60 * 60 * 24;
}
// days
$purgeUpdatedAtPeriod = 30;
// days
if (isset($options['p'])) {
if (!is_numeric($options['p']) || $options['p'] < 0) {
self::failWrongInputs("Period of purge must be positive numeric of days");
}
$purgeUpdatedAtPeriod = $options['p'];
}
self::$purgeEndUpdatedAt = self::$purgeStartUpdatedAt + $purgeUpdatedAtPeriod * 60 * 60 * 24;
// days
$oldPartnersUpdatedAtPeriod = 24;
// months
if (isset($options['b'])) {
if (!is_numeric($options['b']) || $options['b'] < 0) {
self::failWrongInputs("Period of blocked partners to delete must be positive numeric of months");
}
$oldPartnersUpdatedAtPeriod = $options['b'];
}
self::$oldPartnersUpdatedAt = time() - $oldPartnersUpdatedAtPeriod * 60 * 60 * 24 * 30;
// months
$errObjectsUpdatedAtPeriod = 24;
// months
if (isset($options['e'])) {
if (!is_numeric($options['e']) || $options['e'] < 0) {
self::failWrongInputs("Period of error objects to delete must be positive numeric of months");
}
$errObjectsUpdatedAtPeriod = $options['e'];
}
self::$errObjectsUpdatedAt = time() - $errObjectsUpdatedAtPeriod * 60 * 60 * 24 * 30;
// months
if (isset($options['l'])) {
if (!is_numeric($options['l']) || $options['l'] < 0) {
//.........这里部分代码省略.........