当前位置: 首页>>代码示例>>PHP>>正文


PHP entryPeer::doCount方法代码示例

本文整理汇总了PHP中entryPeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::doCount方法的具体用法?PHP entryPeer::doCount怎么用?PHP entryPeer::doCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entryPeer的用法示例。


在下文中一共展示了entryPeer::doCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save(PropelPDO $con = null)
 {
     if ($this->isColumnModified(accessControlPeer::DELETED_AT)) {
         if ($this->isDefault === true) {
             throw new Exception("Default access control profile can't be deleted");
         }
         $c = new Criteria();
         $c->add(entryPeer::ACCESS_CONTROL_ID, $this->getId());
         $entryCount = entryPeer::doCount($c);
         if ($entryCount > 0) {
             throw new Exception("Access control profile is linked with entries and can't be deleted");
         }
     }
     if ($this->isNew()) {
         $c = new Criteria();
         $c->add(accessControlPeer::PARTNER_ID, $this->partner_id);
         $count = accessControlPeer::doCount($c);
         if ($count >= Partner::MAX_ACCESS_CONTROLS) {
             throw new kCoreException("Max number of access control profiles was reached", kCoreException::MAX_NUMBER_OF_ACCESS_CONTROLS_REACHED);
         }
     }
     parent::save($con);
     // set this conversion profile as partners default
     $partner = PartnerPeer::retrieveByPK($this->partner_id);
     if ($partner && $this->isDefault === true) {
         $partner->setDefaultAccessControlId($this->getId());
         $partner->save();
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:29,代码来源:accessControl.php

示例2: executeSphinx

 protected function executeSphinx($index, $wheres, $orderBy, $limit, $maxMatches, $setLimit)
 {
     $sql = "SELECT str_entry_id FROM {$index} {$wheres} {$orderBy} LIMIT {$limit} OPTION max_matches={$maxMatches}";
     //debug query
     //echo $sql."\n"; die;
     $pdo = DbManager::getSphinxConnection();
     $stmt = $pdo->query($sql);
     if (!$stmt) {
         KalturaLog::err("Invalid sphinx query [{$sql}]");
         return;
     }
     $ids = $stmt->fetchAll(PDO::FETCH_COLUMN, 2);
     if (count($this->entryIds)) {
         foreach ($this->entryIds as $comparison => $entryIds) {
             // keeps only ids that appears in both arrays
             if ($comparison == Criteria::IN) {
                 $ids = array_intersect($ids, array_keys($entryIds));
             }
             // removes ids that appears in the comparison array
             if ($comparison == Criteria::NOT_IN) {
                 $ids = array_diff($ids, array_keys($entryIds));
             }
         }
     }
     KalturaLog::debug("Found " . count($ids) . " ids");
     foreach ($this->keyToRemove as $key) {
         KalturaLog::debug("Removing key [{$key}] from criteria");
         $this->remove($key);
     }
     $this->addAnd(entryPeer::ID, $ids, Criteria::IN);
     $this->recordsCount = 0;
     if (!$this->doCount) {
         return;
     }
     if ($setLimit) {
         $this->setOffset(0);
         $sql = "show meta";
         $stmt = $pdo->query($sql);
         $meta = $stmt->fetchAll(PDO::FETCH_NAMED);
         if (count($meta)) {
             foreach ($meta as $metaItem) {
                 KalturaLog::debug("Sphinx query " . $metaItem['Variable_name'] . ': ' . $metaItem['Value']);
                 if ($metaItem['Variable_name'] == 'total_found') {
                     $this->recordsCount = (int) $metaItem['Value'];
                 }
             }
         }
     } else {
         $c = clone $this;
         $c->setLimit(null);
         $c->setOffset(null);
         $this->recordsCount = entryPeer::doCount($c);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:54,代码来源:SphinxEntryCriteria.php

示例3: preSave

 public function preSave(PropelPDO $con = null)
 {
     if ($this->isColumnModified(accessControlPeer::DELETED_AT)) {
         if ($this->isDefault === true) {
             throw new kCoreException("Default access control profile [" . $this->getId() . "] can't be deleted", kCoreException::ACCESS_CONTROL_CANNOT_DELETE_PARTNER_DEFAULT);
         }
         $c = new Criteria();
         $c->add(entryPeer::ACCESS_CONTROL_ID, $this->getId());
         $entryCount = entryPeer::doCount($c);
         if ($entryCount > 0) {
             throw new kCoreException("Default access control profile [" . $this->getId() . "] is linked with [{$entryCount}] entries and can't be deleted", kCoreException::ACCESS_CONTROL_CANNOT_DELETE_USED_PROFILE);
         }
     }
     return parent::preSave($con);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:accessControl.php

示例4: getRoughcutCount

 public function getRoughcutCount()
 {
     if ($this->roughcut_count == -1) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MIX);
         $c->add(entryPeer::KUSER_ID, $this->getId());
         $this->roughcut_count = entryPeer::doCount($c);
     }
     return $this->roughcut_count;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:10,代码来源:kuser.php

示例5: countentrys

 /**
  * Returns the number of related entry objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related entry objects.
  * @throws     PropelException
  */
 public function countentrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(kuserPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collentrys === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(entryPeer::KUSER_ID, $this->id);
             $count = entryPeer::doCount($criteria, false, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return count of the collection.
             $criteria->add(entryPeer::KUSER_ID, $this->id);
             if (!isset($this->lastentryCriteria) || !$this->lastentryCriteria->equals($criteria)) {
                 $count = entryPeer::doCount($criteria, false, $con);
             } else {
                 $count = count($this->collentrys);
             }
         } else {
             $count = count($this->collentrys);
         }
     }
     return $count;
 }
开发者ID:dozernz,项目名称:server,代码行数:45,代码来源:Basekuser.php

示例6: execute

 /**
  * Gives a system applicative snapsot
  */
 public function execute()
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     $this->forceSystemAuthentication();
     $partner_id = $this->getRequestParameter('partner_id', -1);
     if ($partner_id >= 0) {
         myPartnerUtils::applyPartnerFilters($partner_id);
     }
     $this->partner_id = $partner_id;
     $limit = $this->getRequestParameter('limit', '30');
     if ($limit > 300) {
         $limit = 300;
     }
     $bands_only = $this->getRequestParameter("bands", false) != null;
     $modified_only = $this->getRequestParameter("modified", false) != null;
     $this->bands_only = $bands_only;
     $this->modified_only = $modified_only;
     $this->kshows_with_new_entries = $modified_only ? dashboardUtils::getUpdatedKshows() : null;
     $yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
     $lastweek = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
     $query_esterday = date('Y-m-d', $yesterday);
     $query_lastweek = date('Y-m-d', $lastweek);
     $modified_band_ids = $modified_only ? array_keys($this->kshows_with_new_entries) : null;
     if ($modified_only) {
         // TODO - this chunk was copied from the code bellow with minor changes - generalize !
         $c = new Criteria();
         // 			$c->add ( kshowPeer::ID , $modified_band_ids , Criteria::IN ); // search only the given IDs
         $this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
         $this->kshow_count = kshowPeer::doCount($c);
         $criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
         $c->add($criterion);
         $this->kshow_count1 = kshowPeer::doCount($c);
         $criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
         $c->add($criterion);
         $this->kshow_count7 = kshowPeer::doCount($c);
         $c->setLimit($limit);
         //$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
         $c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
         $c->remove(kshowPeer::CREATED_AT);
         $c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
         $this->kshows = kshowPeer::doSelectJoinkuser($c);
         $this->bands_only = $bands_only;
         $this->entry_count = 0;
         $this->entry_count1 = 0;
         $this->entry_count7 = 0;
         $this->entries = array();
         $this->kuser_count = 0;
         $this->kuser_count1 = 0;
         $this->kuser_count7 = 0;
         $this->kusers = array();
         dashboardUtils::updateKshowsRoughcutCount($this->kshows);
         return sfView::SUCCESS;
     }
     $c = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
     $this->kshow_count = kshowPeer::doCount($c);
     $d = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $d, kshowPeer::PARTNER_ID);
     $criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
     $d->add($criterion);
     $this->kshow_count1 = kshowPeer::doCount($d);
     $e = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $e, kshowPeer::PARTNER_ID);
     $criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
     $e->add($criterion);
     $this->kshow_count7 = kshowPeer::doCount($e);
     //$this->kshow_count = kshowPeer::doCount( $c );
     $c->setLimit($limit);
     //$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
     $c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
     $c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
     $this->kshows = kshowPeer::doSelectJoinkuser($c);
     $c = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $c, entryPeer::PARTNER_ID);
     $this->entry_count = entryPeer::doCount($c);
     $d = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $d, entryPeer::PARTNER_ID);
     $criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
     $d->add($criterion);
     $this->entry_count1 = entryPeer::doCount($d);
     $e = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $e, entryPeer::PARTNER_ID);
     $criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
     $e->add($criterion);
     $this->entry_count7 = entryPeer::doCount($e);
     $c->setLimit($limit);
     //$c->hints = array(entryPeer::TABLE_NAME => "created_at_index");
     $c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
     $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
     // we don't want entries that
     //		$c->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
     //	    $c->addJoin(entryPeer::KSHOW_ID, kshowPeer::ID, Criteria::INNER_JOIN);
     $this->entries = entryPeer::doSelectJoinAll($c);
     $c = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $c, kuserPeer::PARTNER_ID);
     $d = new Criteria();
     $this->bandsOnly($bands_only, $modified_band_ids, $d, kuserPeer::PARTNER_ID);
//.........这里部分代码省略.........
开发者ID:richhl,项目名称:kalturaCE,代码行数:101,代码来源:viewDashboardAction.class.php

示例7: doCountOnPeer

 public static function doCountOnPeer(Criteria $c)
 {
     return entryPeer::doCount($c);
 }
开发者ID:DBezemer,项目名称:server,代码行数:4,代码来源:entryIndex.php

示例8: deleteAction

 /**
  * Delete Access Control Profile by id
  * 
  * @action delete
  * @param int $id
  */
 function deleteAction($id)
 {
     $dbAccessControl = accessControlPeer::retrieveByPK($id);
     if (!$dbAccessControl) {
         throw new KalturaAPIException(KalturaErrors::ACCESS_CONTROL_ID_NOT_FOUND, $id);
     }
     if ($dbAccessControl->getIsDefault()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DELETE_DEFAULT_ACCESS_CONTROL);
     }
     $c = new Criteria();
     $c->add(entryPeer::ACCESS_CONTROL_ID, $dbAccessControl->getId());
     // move entries to the default access control
     $entryCount = entryPeer::doCount($c);
     if ($entryCount > 0) {
         entryPeer::updateAccessControl($this->getPartnerId(), $id, $this->getPartner()->getDefaultAccessControlId());
     }
     $dbAccessControl->setDeletedAt(time());
     $dbAccessControl->save();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:25,代码来源:AccessControlService.php

示例9: execute

 /**
  * Will investigate a single entry
  */
 public function execute()
 {
     $partial = $this->getP("partial");
     $this->widget = null;
     $this->forceSystemAuthentication();
     //		myDbHelper::$use_alternative_con = null;
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     // dont' filter out anything
     entryPeer::setUseCriteriaFilter(false);
     $partner_id = $this->getP("partner_id");
     $this->entries = $this->widget_id = null;
     $this->count = 0;
     $this->page = $this->getP("page", 0);
     $this->page_size = $this->getP("page_size", 25);
     $this->ready_only = $this->getP("ready_only", 0);
     $this->gte_int_id = $this->getP("gte_int_id", null);
     $this->widget_id = $this->getP("widget_id");
     $this->ui_conf_id = $this->getP("ui_conf_id");
     $this->is_playlist = $this->getP("is_playlist");
     $this->playlist_id = $this->getP("playlist_id");
     $offset = $this->page * $this->page_size;
     if ($partner_id !== null) {
         $c = new Criteria();
         if ($partner_id != "ALL") {
             // is is a special backdoor word for viewing all partners
             $c->add(entryPeer::PARTNER_ID, $partner_id);
         }
         if ($this->ready_only) {
             $c->add(entryPeer::STATUS, 2);
         }
         if ($entry_ids = $this->getP("entry_ids")) {
             $entry_id_arr = explode(",", $entry_ids);
             $c->Add(entryPeer::ID, $entry_id_arr, Criteria::IN);
         }
         $search_text = $this->getP("filter__like_search_text");
         if ($search_text) {
             $c->add(entryPeer::SEARCH_TEXT, "%{$search_text}%", Criteria::LIKE);
         }
         if ($this->gte_int_id) {
             $c->add(entryPeer::INT_ID, $this->gte_int_id, Criteria::GREATER_EQUAL);
         }
         if ($this->getP("filter__in_type_all")) {
         } else {
             $media_type_arr = array($this->getP("filter__in_type_1"), $this->getP("filter__in_type_2"), $this->getP("filter__in_type_5"), $this->getP("filter__in_type_6"));
             $c->add(entryPeer::MEDIA_TYPE, $media_type_arr, Criteria::IN);
         }
         if ($this->getP("filter__in_status_all")) {
         } else {
             $status_arr = array($this->getP("filter__in_type_0"), $this->getP("filter__in_type_1"), $this->getP("filter__in_type_2"), $this->getP("filter__in_type_3"), $this->getP("filter__in_type_6"));
             if ($this->getP("filter__in_status_err")) {
                 $status_arr[] = -1;
                 $status_arr[] = -2;
             }
             $c->add(entryPeer::STATUS, $status_arr, Criteria::IN);
         }
         if ($this->getP("filter__gte_created_at")) {
             $c->addAnd(entryPeer::CREATED_AT, $this->getP("filter__gte_created_at"), Criteria::GREATER_EQUAL);
         }
         if ($this->getP("filter__lte_created_at")) {
             $to_date = $this->getP("filter__lte_created_at");
             $timeStamp = strtotime($to_date);
             $timeStamp += 24 * 60 * 60;
             // inc one day
             $to_date_str = date("Y-m-d", $timeStamp);
             $c->addAnd(entryPeer::CREATED_AT, $to_date_str, Criteria::LESS_EQUAL);
         }
         $this->count = entryPeer::doCount($c);
         $c->addAscendingOrderByColumn(entryPeer::INT_ID);
         $c->setLimit($this->page_size);
         $c->setOffset($offset);
         $this->entries = entryPeer::doSelect($c);
         if (!$partial) {
             // no need for widget if displaying partial page
             $d = new Criteria();
             $d->add(widgetPeer::PARTNER_ID, $partner_id);
             if ($this->widget_id) {
                 $d->add(widgetPeer::ID, $this->widget_id);
             } else {
                 $d->add(widgetPeer::SOURCE_WIDGET_ID, "");
             }
             $this->widget = widgetPeer::doSelectOne($d);
             if (!$this->widget) {
                 $d = new Criteria();
                 $d->add(widgetPeer::PARTNER_ID, $partner_id);
                 $d->addAscendingOrderByColumn(widgetPeer::CREATED_AT);
                 $this->widget = widgetPeer::doSelectOne($d);
             }
         }
     }
     if ($this->entries == null) {
         $this->entries = array();
     }
     $this->partner_id = $partner_id;
     if ($partial) {
         return "PartialSuccess";
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:100,代码来源:galleryAction.class.php

示例10: doCountOnPeer

 protected function doCountOnPeer(Criteria $c)
 {
     return entryPeer::doCount($c);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:4,代码来源:SphinxEntryCriteria.php

示例11: doCountOnSourceTable

 public static function doCountOnSourceTable(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 {
     return entryPeer::doCount($criteria, $distinct, $con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:4,代码来源:SearchEntryPeer.php

示例12: deleteEntry

 public static function deleteEntry(entry $entry)
 {
     $kshow = $entry->getkshow();
     if ($kshow) {
         $v = $kshow->getEntries();
         self::dec($v);
         $kshow->setEntries($v);
         $c = new Criteria();
         myCriteria::addComment($c, __METHOD__);
         $c->add(entryPeer::KSHOW_ID, $entry->getKshowId());
         $c->add(entryPeer::KUSER_ID, $entry->getKuserId());
         $c->setLimit(2);
         $res = entryPeer::doCount($c);
         if ($res == 1) {
             // if $res > 1 -  this kuser contributed more than one entry, deleting this one should still leave him a contributor
             // if $res < 1 -  this kuser never contributed - strange! but no need to dec the contributors
             // kuser did contribute to this kshow - decrement
             $v = $kshow->getContributors();
             self::dec($v);
             $kshow->setContributors($v);
         }
         $kuser = $entry->getkuser();
         if ($kuser) {
             $v = $kuser->getEntries();
             self::dec($v);
             $kuser->setEntries($v);
         }
         self::add($kshow);
         self::add($kuser);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:myStatisticsMgr.class.php

示例13: validateTemplatePartner

 /**
  * Validate the amount of core and plugin objects found on the template partner.
  * @param Partner $templatePartner
  */
 private function validateTemplatePartner(Partner $templatePartner)
 {
     //access control profiles
     $c = new Criteria();
     $c->add(accessControlPeer::PARTNER_ID, $templatePartner->getId());
     $count = accessControlPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_ac_profiles')) {
         throw new kCoreException("Template partner's number of [accessControlProfiles] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     //categories
     categoryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(categoryPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(categoryPeer::STATUS, CategoryStatus::ACTIVE);
     $count = categoryPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_categories')) {
         throw new kCoreException("Template partner's number of [category] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     categoryPeer::setUseCriteriaFilter(true);
     //conversion profiles
     $c = new Criteria();
     $c->add(conversionProfile2Peer::PARTNER_ID, $templatePartner->getId());
     $count = conversionProfile2Peer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_conversion_profiles')) {
         throw new kCoreException("Template partner's number of [conversionProfile] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     //entries
     entryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(entryPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
     $c->addAnd(entryPeer::STATUS, entryStatus::READY);
     $count = entryPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_entries')) {
         throw new kCoreException("Template partner's number of MEDIA_CLIP objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     entryPeer::setUseCriteriaFilter(true);
     //playlists
     entryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(entryPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(entryPeer::TYPE, entryType::PLAYLIST);
     $c->addAnd(entryPeer::STATUS, entryStatus::READY);
     $count = entryPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_playlists')) {
         throw new kCoreException("Template partner's number of PLAYLIST objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     entryPeer::setUseCriteriaFilter(true);
     //flavor params
     $c = new Criteria();
     $c->add(assetParamsPeer::PARTNER_ID, $templatePartner->getId());
     $count = assetParamsPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_flavor_params')) {
         throw new kCoreException("Template partner's number of [flavorParams] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     //uiconfs
     uiConfPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(uiConfPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(uiConfPeer::OBJ_TYPE, array(uiConf::UI_CONF_TYPE_KDP3, uiConf::UI_CONF_TYPE_WIDGET), Criteria::IN);
     $c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY);
     $count = uiConfPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_ui_confs')) {
         throw new kCoreException("Template partner's number of [uiconf] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     uiConfPeer::setUseCriteriaFilter(true);
     //user roles
     UserRolePeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(UserRolePeer::PARTNER_ID, $templatePartner->getId(), Criteria::EQUAL);
     $c->addAnd(UserRolePeer::STATUS, UserRoleStatus::ACTIVE, Criteria::EQUAL);
     $count = UserRolePeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_user_roles')) {
         throw new kCoreException("Template partner's number of [userRole] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     UserRolePeer::setUseCriteriaFilter(true);
     $validatorPlugins = KalturaPluginManager::getPluginInstances('IKalturaObjectValidator');
     foreach ($validatorPlugins as $validatorPlugins) {
         $validatorPlugins->validateObject($templatePartner, IKalturaObjectValidator::OPERATION_COPY);
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:85,代码来源:myPartnerRegistration.class.php

示例14: applyFilters

 public function applyFilters()
 {
     $this->criteriasLeft = 0;
     KalturaLog::debug("Applies " . count($this->filters) . " filters");
     foreach ($this->filters as $index => $filter) {
         KalturaLog::debug("Applies filter {$index}");
         $this->applyFilter($filter);
     }
     // attach all default criteria from peer
     entryPeer::getCriteriaFilter()->applyFilter($this);
     // go over all criterions and try to move them to the solr
     foreach ($this->getMap() as $field => $criterion) {
         if (!$criterion instanceof SolrEntryCriterion) {
             KalturaLog::debug("Criterion [" . $criterion->getColumn() . "] is not solr criteria");
             $this->criteriasLeft++;
             continue;
         }
         if ($criterion->apply($this->whereClause)) {
             KalturaLog::debug("Criterion [" . $criterion->getColumn() . "] attached");
             $this->keyToRemove[] = $field;
         } else {
             KalturaLog::debug("Criterion [" . $criterion->getColumn() . "] failed");
             $this->criteriasLeft++;
         }
     }
     KalturaLog::debug("Applied " . count($this->whereClause) . " matches, " . count($this->whereClause) . " clauses, " . count($this->keyToRemove) . " keys removed, {$this->criteriasLeft} keys left");
     $wheres = '';
     if (count($this->whereClause)) {
         $wheres = "";
         foreach ($this->whereClause as $where) {
             $c = @$where[0];
             $wheres .= ($c == "-" || $c == "+" ? " " : " +") . $where;
         }
     }
     $orderBy = '';
     $orderByColumns = $this->getOrderByColumns();
     $orderByColumns = array_unique($orderByColumns);
     $setLimit = true;
     if (count($orderByColumns)) {
         $replace = self::$solrOrderFields;
         $search = array_keys($replace);
         $orders = array();
         foreach ($orderByColumns as $orderByColumn) {
             $arr = explode(' ', $orderByColumn);
             $orderField = $arr[0];
             if (isset($replace[$orderField])) {
                 KalturaLog::debug("Add sort field[{$orderField}] copy from [{$orderByColumn}]");
                 $orders[] = str_replace($search, $replace, $orderByColumn);
             } else {
                 KalturaLog::debug("Skip sort field[{$orderField}] from [{$orderByColumn}] limit won't be used in solr query");
                 $setLimit = false;
             }
         }
         if (count($orders)) {
             $orderBy = 'sort=' . implode(',', $orders);
         }
     }
     $limit = self::SOLR_MAX_RECORDS;
     if ($this->criteriasLeft) {
         $setLimit = false;
     }
     $offset = 0;
     if ($setLimit && $this->getLimit()) {
         $limit = $this->getLimit();
         if ($this->getOffset()) {
             $offset = $this->getOffset();
         }
     }
     $query = "{$wheres} {$orderBy}";
     echo $query . "\n";
     die;
     $solr = kSolrSearchManager::createSolrService();
     $response = $solr->search($query, $offset, $limit);
     if (!$response) {
         KalturaLog::err("Invalid solr query [{$sql}]");
         return;
     }
     $response = json_decode($response);
     $response = $response['response'];
     $docs = $response['docs'];
     $ids = $array();
     foreach ($docs as $doc) {
         $ids[] = $doc["id"];
     }
     KalturaLog::debug("Found " . count($ids) . " ids");
     foreach ($this->keyToRemove as $key) {
         KalturaLog::debug("Removing key [{$key}] from criteria");
         $this->remove($key);
     }
     $this->addAnd(entryPeer::ID, $ids, Criteria::IN);
     $this->recordsCount = 0;
     if ($setLimit) {
         $this->recordsCount = $response['numFound'];
     } else {
         $c = clone $this;
         $c->setLimit(null);
         $c->setOffset(null);
         $this->recordsCount = entryPeer::doCount($c);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:100,代码来源:SolrEntryCriteria.php

示例15: chdir

<?php

/**
 * @package deployment
 * @subpackage base.permissions
 *
 * Adds all system default permissions
 */
chdir(__DIR__);
require_once __DIR__ . '/../../bootstrap.php';
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_MASTER;
$criteria = new Criteria();
$criteria->add(entryPeer::PARTNER_ID, 99);
$templateEntries = entryPeer::doCount($criteria);
if ($templateEntries) {
    KalturaLog::info("Content already ingested.");
    exit(0);
}
$dirPath = __DIR__ . '/init_content';
$scriptPath = realpath(__DIR__ . '/../../../') . '/tests/standAloneClient/exec.php';
KalturaLog::info("Adding content from directory [{$dirPath}]");
$dir = dir($dirPath);
/* @var $dir Directory */
$fileNames = array();
while (false !== ($fileName = $dir->read())) {
    $filePath = realpath("{$dirPath}/{$fileName}");
    if ($fileName[0] == '.' || is_dir($filePath) || preg_match('/template.xml$/', $fileName)) {
        continue;
    }
    $fileNames[] = $fileName;
}
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:insertContent.php


注:本文中的entryPeer::doCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。