本文整理汇总了PHP中PartnerPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP PartnerPeer::doSelect方法的具体用法?PHP PartnerPeer::doSelect怎么用?PHP PartnerPeer::doSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartnerPeer
的用法示例。
在下文中一共展示了PartnerPeer::doSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPermission
function addPermission($permissionCfg)
{
// verify obligatory fields
if (!$permissionCfg->name) {
throw new Exception('Permission name must be set');
}
if ((is_null($permissionCfg->partnerId) || $permissionCfg->partnerId === '') && (is_null($permissionCfg->partnerPackages) || $permissionCfg->partnerPackages === '')) {
throw new Exception('Permission partner id or partner package must be set');
}
if (isset($permissionCfg->partnerId) && $permissionCfg->partnerId != '') {
$partnerIds = explode(",", $permissionCfg->partnerId);
foreach ($partnerIds as $partnerId) {
addPermissionToPartner($permissionCfg, $partnerId);
}
}
if (isset($permissionCfg->partnerPackages) && $permissionCfg->partnerPackages != '') {
$countLimitEachLoop = 100;
$offset = $countLimitEachLoop;
$c = new Criteria();
$c->add(PartnerPeer::ID, 0, Criteria::GREATER_THAN);
$c->add(PartnerPeer::PARTNER_PACKAGE, explode(',', $permissionCfg->partnerPackages), Criteria::IN);
$c->setLimit($countLimitEachLoop);
$partners = PartnerPeer::doSelect($c);
while (count($partners)) {
foreach ($partners as $partner) {
addPermissionToPartner($permissionCfg, $partner->getId());
}
$c->setOffset($offset);
PartnerPeer::clearInstancePool();
$partners = PartnerPeer::doSelect($c);
$offset += $countLimitEachLoop;
sleep(1);
}
}
}
示例2: myBatchPartnerUsage
public function myBatchPartnerUsage()
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
// get only free partners
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
TRACE("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
TRACE("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
$start_pos += $bulk_size;
}
}
示例3: myBatchPartnerUsage
public function myBatchPartnerUsage($partnerId = null)
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
if (!is_null($partnerId)) {
$c->addAnd(PartnerPeer::ID, $partnerId);
}
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
// get only free partners
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_DELETED, CRITERIA::NOT_EQUAL);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
KalturaLog::debug("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
KalturaLog::debug("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
PartnerPeer::clearInstancePool();
$start_pos += $bulk_size;
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:myBatchPartnerUsage.class.php
示例4: partnerOptions
public static function partnerOptions($current_value)
{
$options[-1] = "All";
$c = new Criteria();
$partners = PartnerPeer::doSelect($c);
foreach ($partners as $partner) {
$options[$partner->getId()] = $partner->getPartnerName();
}
return dashboardUtils::options($current_value, $options);
}
示例5: execute
public function execute()
{
$this->forceSystemAuthentication();
$hint = $this->getP("hint");
$search_partnerName = $this->getP("p_partnerName", true);
$search_description = $this->getP("p_description", true);
$search_url1 = $this->getP("p_url1", true);
$search_adminName = $this->getP("p_adminName", true);
$search_adminEmail = $this->getP("p_adminEmail", true);
$limit = $this->getP("limit", 300);
$offset = $this->getP("offset", 0);
$text_to_search = "%{$hint}%";
$c = new Criteria();
$crit = $c->getNewCriterion(PartnerPeer::PARTNER_NAME, $text_to_search, Criteria::LIKE);
if ($search_description) {
$crit->addOr($c->getNewCriterion(PartnerPeer::DESCRIPTION, $text_to_search, Criteria::LIKE));
}
if ($search_url1) {
$crit->addOr($c->getNewCriterion(PartnerPeer::URL1, $text_to_search, Criteria::LIKE));
}
if ($search_adminName) {
$crit->addOr($c->getNewCriterion(PartnerPeer::ADMIN_NAME, $text_to_search, Criteria::LIKE));
}
if ($search_adminEmail) {
$crit->addOr($c->getNewCriterion(PartnerPeer::ADMIN_EMAIL, $text_to_search, Criteria::LIKE));
}
$c->addAnd($crit);
// $this->count = PartnerPeer::doCount( $c );
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
if ($hint) {
$this->partner_list = PartnerPeer::doSelect($c);
} else {
$this->partner_list = array();
}
/*
$arr = array();
foreach ( $this->partner_list as $partner )
{
$p = array (
"id" => $partner->getId() ,
"partnerName" => $partner->getPartnerName() ,
"description" => $partner->getDescription() ,
"url1" => $partner->getUrl1() ,
"adminName" => $partner->getAdminName() ,
"adminEmail" => $partner->getAdminEmail() ,
);
$arr[] = $p;
}
*/
$this->hint = $hint;
// return $this->renderText(json_encode ( $arr ) );
}
示例6: getPartners
function getPartners($lastPartner, $partnerLimitEachLoop)
{
PartnerPeer::clearInstancePool();
$c = new Criteria();
$c->add(PartnerPeer::ID, $lastPartner, Criteria::GREATER_THAN);
$c->addAscendingOrderByColumn(PartnerPeer::ID);
$c->setLimit($partnerLimitEachLoop);
PartnerPeer::setUseCriteriaFilter(false);
$partners = PartnerPeer::doSelect($c);
PartnerPeer::setUseCriteriaFilter(true);
return $partners;
}
示例7: execute
public function execute()
{
$email = @$_GET['email'];
$screenName = @$_GET['screen_name'];
$partner_id = $this->getP('partner_id', null);
if ($partner_id === null) {
header("Location: /index.php/kmc/varlogin");
die;
}
sfView::SUCCESS;
$this->me = PartnerPeer::retrieveByPK($this->getP('partner_id', null));
if (!$this->me || $this->me->getPartnerGroupType() != PartnerGroupType::VAR_GROUP) {
die('You are not an wuthorized VAR. If you are a VAR, Please contact us at support@kaltura.com');
}
$ks = kSessionUtils::crackKs($this->getP('ks'));
$user = $ks->user;
$res = kSessionUtils::validateKSession2(kSessionUtils::REQUIED_TICKET_ADMIN, $partner_id, $user, $this->getP('ks'), $ks);
if ($res != ks::OK) {
header("Location: /index.php/kmc/varlogin");
die;
}
$c = new Criteria();
$c->addAnd(PartnerPeer::PARTNER_PARENT_ID, $this->me->getId());
// add extra filtering if required
//$c->addAnd(PartnerPeer::STATUS, 1);
$partners = PartnerPeer::doSelect($c);
$this->partners = array();
$partner_id_param_name = 'pid';
$subpid_param_name = 'subpid';
if ($this->me->getKmcVersion() == 1) {
$partner_id_param_name = 'partner_id';
$subpid_param_name = 'subp_id';
}
$kmc2Query = '?' . $partner_id_param_name . '=' . $this->me->getId() . '&' . $subpid_param_name . '=' . $this->me->getId() * 100 . '&ks=' . $_GET['ks'] . '&email=' . $email . '&screen_name=' . $screenName;
$this->varKmcUrl = 'http://' . kConf::get('www_host') . '/index.php/kmc/kmc' . $this->me->getKmcVersion() . $kmc2Query;
foreach ($partners as $partner) {
$ks = null;
kSessionUtils::createKSessionNoValidations($partner->getId(), $partner->getAdminUserId(), $ks, 30 * 86400, 2, "", "*");
$adminUser_email = $partner->getAdminEmail();
$partner_id_param_name = 'pid';
$subpid_param_name = 'subpid';
if ($partner->getKmcVersion() == 1) {
$partner_id_param_name = 'partner_id';
$subpid_param_name = 'subp_id';
}
$kmc2Query = '?' . $partner_id_param_name . '=' . $partner->getId() . '&' . $subpid_param_name . '=' . $partner->getId() * 100 . '&ks=' . $ks . '&email=' . $adminUser_email . '&screen_name=varAdmin';
//$kmcLink = url_for('index.php/kmc/kmc2'.$kmc2Query);
// $kmcLink = 'http://'.kConf::get('www_host').'/index.php/kmc/kmc'.$partner->getKmcVersion().$kmc2Query;
$kmcLink = 'http://' . kConf::get('www_host') . "/index.php/kmc/extlogin?ks={$ks}&partner_id=" . $partner->getId();
$this->partners[$partner->getId()] = array('name' => $partner->getPartnerName(), 'kmcLink' => $kmcLink);
}
}
示例8: getPartnersArray
private function getPartnersArray($partnerIds)
{
$allowed = array();
$c = new Criteria();
$c->addAnd(PartnerPeer::ID, $partnerIds, Criteria::IN);
$c->addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_ACTIVE, Criteria::EQUAL);
PartnerPeer::setUseCriteriaFilter(false);
$partners = PartnerPeer::doSelect($c);
PartnerPeer::setUseCriteriaFilter(true);
foreach ($partners as $partner) {
if (!in_array($partner->getId(), array(PartnerPeer::GLOBAL_PARTNER, Partner::ADMIN_CONSOLE_PARTNER_ID, Partner::BATCH_PARTNER_ID))) {
$allowed[] = array('id' => $partner->getId(), 'name' => $partner->getName());
}
}
return $allowed;
}
示例9: execute
public function execute()
{
$this->forceSystemAuthentication();
$start = microtime(true);
$limit = 7;
// new partners
$c = new Criteria();
$this->partner_count = PartnerPeer::doCount($c);
// count before setting the limit
$c->setLimit($limit);
$c->addDescendingOrderByColumn(PartnerPeer::CREATED_AT);
$newest_partners = PartnerPeer::doSelect($c);
// $new_partners_ids = self::getIds( $new_partners );
// fetch stats for these partners
// TODO - if new - what statistics could it have ??
// fdb::populateObjects( $newest_partners , new PartnerStatsPeer() , "id" , "partnerStats" , false ,"partnerId");
$exclude = $this->getP("exclude");
if ($exclude) {
self::addToExceludeList($exclude);
}
$exclude_list = self::getExceludeList();
// most viewed
$c = new Criteria();
$c->add(PartnerStatsPeer::PARTNER_ID, $exclude_list, Criteria::NOT_IN);
$c->setLimit($limit);
$c->addDescendingOrderByColumn(PartnerStatsPeer::VIEWS);
$stats_most_views = PartnerStatsPeer::doSelect($c);
$most_views = self::getPartnerListFromStats($stats_most_views);
// most entries
$c = new Criteria();
$c->add(PartnerStatsPeer::PARTNER_ID, $exclude_list, Criteria::NOT_IN);
$c->setLimit($limit);
$c->addDescendingOrderByColumn(PartnerStatsPeer::ENTRIES);
$stats_most_entries = PartnerStatsPeer::doSelect($c);
$most_entries = self::getPartnerListFromStats($stats_most_entries);
$end = microtime(true);
$this->newest_partners = $newest_partners;
$this->most_views = $most_views;
$this->most_entries = $most_entries;
$this->bench = $end - $start;
}
示例10: doMonthlyAggregation
public function doMonthlyAggregation($date)
{
// set the dates
$dateParts = explode('-', $date);
$currentDate = $dateParts;
$currentDate[2] = $currentDate[2] - 3;
if ($currentDate[2] <= 0) {
$currentDate[1] = $currentDate[1] - 1;
if ($currentDate[1] == 0) {
$currentDate[1] = 12;
$currentDate[0] = $currentDate[0] - 1;
}
// if $currentDate[2] before reduction = 3, $currentDate[2] after reduction = 0
// if $currentDate[2] = 0 and last_day_for_month return 30, $currentDate[2] = 30
// if $currentDate[2] before reduction = 2, $currentDate[2] after reduction = -1
// if $currentDate[2] = -1 and last_day_for_month return 30, $currentDate[2] = 30 + (-1) = 29
$currentDate[2] = $this->last_day_for_month($currentDate) + $currentDate[2];
}
if ($currentDate[1] < 10 && strlen($currentDate[1]) == 1) {
$currentDate[1] = '0' . $currentDate[1];
}
if ($currentDate[2] < 10 && strlen($currentDate[2]) == 1) {
$currentDate[2] = '0' . $currentDate[2];
}
$firstOfMonth = $currentDate[0] . '-' . $currentDate[1] . '-01';
$currentDate = implode('-', $currentDate);
KalturaLog::debug("calculating monthly agg. for date {$currentDate}");
// set start points
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
// loop partners
while ($partners_exists) {
// pull bulk of partners
$c = new Criteria();
$c->addAnd(PartnerPeer::CREATED_AT, $currentDate, Criteria::LESS_EQUAL);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
KalturaLog::debug("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
// set flag to exit while loop
$partners_exists = false;
} else {
KalturaLog::debug("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
// loop bulk of partners
foreach ($partners as $partner) {
/*
if ($partner->getId() != 593 && $partner->getId() != 395 && $partner->getId() != 387 )
continue;
KalturaLog::debug("testing... not skiping partner ".$partner->getId());
*/
// get row from partner_activity where date is 1st of current month and type is 6
$partnerActivityCriteria = new Criteria();
$partnerActivityCriteria->addAnd(PartnerActivityPeer::ACTIVITY_DATE, $firstOfMonth);
$partnerActivityCriteria->addAnd(PartnerActivityPeer::ACTIVITY, PartnerActivity::PARTNER_ACTIVITY_MONTHLY_AGGREGATION);
$partnerActivityCriteria->addAnd(PartnerActivityPeer::PARTNER_ID, $partner->getId());
$activityTotal = PartnerActivityPeer::doSelect($partnerActivityCriteria);
if (count($activityTotal) > 1) {
KalturaLog::debug("loaded more than one monthly aggregation row for partner. something went wrong. partner " . $partner->getID());
} elseif (count($activityTotal) == 0 || !$activityTotal) {
// no rows for this month, either today is 1st of month or new partner. adding row for partner
$partnerActivity = new PartnerActivity();
$partnerActivity->setActivity(PartnerActivity::PARTNER_ACTIVITY_MONTHLY_AGGREGATION);
$partnerActivity->setPartnerId($partner->getId());
$partnerActivity->setActivityDate($firstOfMonth);
$storageTotal = $this->getStorageAggregationFor($partner->getId(), $currentDate);
$storageAddition = $storageTotal / date('t', strtotime($currentDate));
$partnerActivity->setAmount1($storageAddition);
$partnerActivity->setAmount2($this->getTrafficFor($partner->getId(), $currentDate));
$total_amount = $partnerActivity->getAmount1() * 1024 + $partnerActivity->getAmount2();
$partnerActivity->setAmount($total_amount);
$partnerActivity->save();
} else {
$currentStorage = $activityTotal[0]->getAmount1();
$storageTotal = $this->getStorageAggregationFor($partner->getId(), $currentDate);
$storageAddition = $storageTotal / date('t', strtotime($currentDate));
$activityTotal[0]->setAmount1($currentStorage + $storageAddition);
$currentTraffic = $activityTotal[0]->getAmount2();
$trafficAddition = $this->getTrafficFor($partner->getId(), $currentDate);
$activityTotal[0]->setAmount2($currentTraffic + $trafficAddition);
// storage is saved in MB, traffic is saved in KB, normalizing storage for correct sum result
$total_amount = $activityTotal[0]->getAmount1() * 1024 + $activityTotal[0]->getAmount2();
$activityTotal[0]->setAmount($total_amount);
$activityTotal[0]->save();
}
unset($partnerActivityCriteria);
unset($activityTotal);
}
}
unset($partners);
$start_pos += $bulk_size;
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:95,代码来源:myNewBatchPartnerUsage.class.php
示例11: listAction
/**
* List partners by filter with paging support
* Current implementation will only list the sub partners of the partner initiating the api call (using the current KS).
* This action is only partially implemented to support listing sub partners of a VAR partner.
* @action list
* @param KalturaPartnerFilter $filter
* @param KalturaFilterPager $pager
* @return KalturaPartnerListResponse
*/
public function listAction(KalturaPartnerFilter $filter = null, KalturaFilterPager $pager = null)
{
if (is_null($filter)) {
$filter = new KalturaPartnerFilter();
}
if (is_null($pager)) {
$pager = new KalturaFilterPager();
}
$partnerFilter = new partnerFilter();
$filter->toObject($partnerFilter);
$c = PartnerPeer::getDefaultCriteria();
$partnerFilter->attachToCriteria($c);
$response = new KalturaPartnerListResponse();
$response->totalCount = PartnerPeer::doCount($c);
$pager->attachToCriteria($c);
$dbPartners = PartnerPeer::doSelect($c);
$partnersArray = KalturaPartnerArray::fromPartnerArray($dbPartners);
$response->objects = $partnersArray;
return $response;
}
示例12: media
echo "Usage:\n";
echo "\tphp " . __FILE__ . " {conversion profile type - media (1) or live (2)} {comma seperated asset params ids (no spaces)}\n";
exit(-1);
}
$additioalFlavorParamsObjects = array();
foreach ($additioalFlavorParamsItems as $additioalFlavorParamsItem) {
/* @var $additioalFlavorParamsItem liveParams */
$additioalFlavorParamsObjects[$additioalFlavorParamsItem->getId()] = $additioalFlavorParamsItem;
}
$partnerCriteria = new Criteria();
$partnerCriterion = $partnerCriteria->getNewCriterion(PartnerPeer::PARTNER_PARENT_ID, 0);
$partnerCriterion->addOr($partnerCriteria->getNewCriterion(PartnerPeer::PARTNER_PARENT_ID, null, Criteria::ISNULL));
$partnerCriteria->add($partnerCriterion);
$partnerCriteria->add(PartnerPeer::PARTNER_GROUP_TYPE, PartnerGroupType::TEMPLATE);
$partnerCriteria->add(PartnerPeer::STATUS, Partner::PARTNER_STATUS_ACTIVE);
$partners = PartnerPeer::doSelect($partnerCriteria);
foreach ($partners as $partner) {
/* @var $partner Partner */
$profileCriteria = new Criteria();
$profileCriteria->add(conversionProfile2Peer::PARTNER_ID, $partner->getId());
$profileCriteria->add(conversionProfile2Peer::TYPE, $conversionProfileType);
$profileCriteria->add(conversionProfile2Peer::STATUS, ConversionProfileStatus::DELETED, Criteria::NOT_EQUAL);
$profiles = conversionProfile2Peer::doSelect($profileCriteria);
foreach ($profiles as $profile) {
/* @var $profile conversionProfile2 */
$flavorParamsConversionProfileIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($profile->getId());
foreach ($additioalFlavorParamsObjects as $additioalFlavorParamsId => $additioalFlavorParamsObject) {
if (in_array($additioalFlavorParamsId, $flavorParamsConversionProfileIds)) {
continue;
}
$flavorParamsConversionProfile = new flavorParamsConversionProfile();
示例13: while
$criteria->setLimit(min($page, $limit));
} else {
$criteria->setLimit($page);
}
$partners = PartnerPeer::doSelect($criteria);
$migrated = 0;
while (count($partners) && (!$limit || $migrated < $limit)) {
KalturaLog::info("Migrating [" . count($partners) . "] partners.");
$migrated += count($partners);
foreach ($partners as $partner) {
/* @var $partner Partner */
$permission = PermissionPeer::getByNameAndPartner($permissionName, array($partner->getId(), 0));
if (!$permission) {
$permission = new Permission();
$permission->setType(PermissionType::SPECIAL_FEATURE);
$permission->setPartnerId($partner->getId());
}
$permission->setStatus(PermissionStatus::ACTIVE);
KalturaStatement::setDryRun($dryRun);
$permission->save();
KalturaStatement::setDryRun(false);
$startUpdatedAt = $partner->getUpdatedAt(null);
$startPartnerId = $partner->getId();
KalturaLog::info("Migrated partner [" . $partner->getId() . "] with updated at [{$startUpdatedAt}: " . $partner->getUpdatedAt() . "].");
}
kMemoryManager::clearMemory();
$nextCriteria = clone $criteria;
$nextCriteria->add(PartnerPeer::ID, $startPartnerId, Criteria::GREATER_THAN);
$partners = PartnerPeer::doSelect($nextCriteria);
}
KalturaLog::info("Done");
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:migrateFreeAccountsPermissions.php
示例14: retrieveByPKs
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(PartnerPeer::DATABASE_NAME);
$criteria->add(PartnerPeer::ID, $pks, Criteria::IN);
$objs = PartnerPeer::doSelect($criteria, $con);
}
return $objs;
}
示例15: getPartners
/**
* Return all partners with $file set as their SERVICE_CONFIG_ID
* @param string $file file name
* @return array of Partner objects
*/
function getPartners($file)
{
$file = substr($file, 3);
PartnerPeer::clearInstancePool();
$c = new Criteria();
$c->addAnd(PartnerPeer::SERVICE_CONFIG_ID, $file, Criteria::EQUAL);
$partners = PartnerPeer::doSelect($c);
return $partners;
}