本文整理汇总了PHP中PartnerPeer::clearInstancePool方法的典型用法代码示例。如果您正苦于以下问题:PHP PartnerPeer::clearInstancePool方法的具体用法?PHP PartnerPeer::clearInstancePool怎么用?PHP PartnerPeer::clearInstancePool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartnerPeer
的用法示例。
在下文中一共展示了PartnerPeer::clearInstancePool方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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($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
示例3: 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;
}
示例4: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
UserRolePeer::clearInstancePool();
PermissionPeer::clearInstancePool();
PermissionItemPeer::clearInstancePool();
kuserPeer::clearInstancePool();
PartnerPeer::clearInstancePool();
$this->client = null;
PermissionItemPeer::setUseCriteriaFilter(false);
foreach ($this->addedPermissionItemIds as $id) {
try {
$obj = PermissionItemPeer::retrieveByPK($id);
if ($obj) {
$obj->delete();
}
} catch (PropelException $e) {
}
}
PermissionItemPeer::setUseCriteriaFilter(true);
$this->addedPermissionItemIds = array();
parent::tearDown();
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:25,代码来源:PermissionItemServiceUnitTest.php
示例5: parameters
$partner->setAccountOwnerKuserId($new_kuser->getId(), false);
}
KalturaLog::log('Saving partner [' . $partner->getId() . '] with account owner kuser ID [' . $partner->getAccountOwnerKuserId() . ']');
$partner->save();
} else {
KalturaLog::log('DRY RUN - records are not being saved: ');
KalturaLog::log('New user_login_data with the following parameters: ');
KalturaLog::log(print_r($new_login_data, true));
KalturaLog::log('Newkuser with the following parameters (login_data_id unknown): ');
KalturaLog::log(print_r($new_kuser, true));
KalturaLog::log('DRY RUN - saving partner [' . $partner->getId() . '] with account owner kuser ID [' . $partner->getAccountOwnerKuserId() . ']');
}
file_put_contents($lastUserFile, $lastUser);
}
kuserPeer::clearInstancePool();
PartnerPeer::clearInstancePool();
UserLogindataPeer::clearInstancePool();
$users = getUsers($lastUser, $userLimitEachLoop);
}
$msg = 'Done - ' . ($dryRun ? 'DRY RUN!' : 'REAL RUN!');
KalturaLog::log($msg);
echo $msg;
function getUsers($lastUser, $userLimitEachLoop)
{
adminKuserPeer::clearInstancePool();
$c = new Criteria();
$c->add(adminKuserPeer::ID, $lastUser, Criteria::GREATER_THAN);
$c->addAscendingOrderByColumn(adminKuserPeer::ID);
$c->setLimit($userLimitEachLoop);
adminKuserPeer::setUseCriteriaFilter(false);
$users = adminKuserPeer::doSelect($c);
示例6: doDelete
/**
* Method perform a DELETE on the database, given a Partner or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Partner object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(PartnerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
PartnerPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Partner) {
// it's a model object
// invalidate the cache for this single object
PartnerPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else {
// it's a primary key, or an array of pks
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(PartnerPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
PartnerPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0;
// initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
PartnerPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
示例7: getOrCreateUserSessionRole
function getOrCreateUserSessionRole($partnerId)
{
PartnerPeer::clearInstancePool();
$partner = PartnerPeer::retrieveByPK($partnerId);
$role = null;
$id = $partner->getUserSessionRoleId();
if ($id) {
$role = UserRolePeer::retrieveByPK($id);
}
if (!$role) {
$role = new UserRole();
$role->setPartnerId($partnerId);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setName('Partner ' . $partnerId . ' user session permission');
$role->setDescription('Partner ' . $partnerId . ' user session permission');
$role->setPermissionNames(PermissionName::USER_SESSION_PERMISSION);
$role->save();
}
return $role;
}
示例8: clearMemory
public static function clearMemory()
{
accessControlPeer::clearInstancePool();
kuserPeer::clearInstancePool();
kshowPeer::clearInstancePool();
entryPeer::clearInstancePool();
// kvotePeer::clearInstancePool();
// commentPeer::clearInstancePool();
// flagPeer::clearInstancePool();
// favoritePeer::clearInstancePool();
// KshowKuserPeer::clearInstancePool();
// MailJobPeer::clearInstancePool();
SchedulerPeer::clearInstancePool();
SchedulerWorkerPeer::clearInstancePool();
SchedulerStatusPeer::clearInstancePool();
SchedulerConfigPeer::clearInstancePool();
ControlPanelCommandPeer::clearInstancePool();
BatchJobPeer::clearInstancePool();
// PriorityGroupPeer::clearInstancePool();
BulkUploadResultPeer::clearInstancePool();
// blockedEmailPeer::clearInstancePool();
// conversionPeer::clearInstancePool();
// flickrTokenPeer::clearInstancePool();
PuserKuserPeer::clearInstancePool();
// PuserRolePeer::clearInstancePool();
PartnerPeer::clearInstancePool();
// WidgetLogPeer::clearInstancePool();
// adminKuserPeer::clearInstancePool();
// notificationPeer::clearInstancePool();
moderationPeer::clearInstancePool();
moderationFlagPeer::clearInstancePool();
roughcutEntryPeer::clearInstancePool();
// widgetPeer::clearInstancePool();
uiConfPeer::clearInstancePool();
// PartnerStatsPeer::clearInstancePool();
// PartnerActivityPeer::clearInstancePool();
ConversionProfilePeer::clearInstancePool();
// ConversionParamsPeer::clearInstancePool();
// KceInstallationErrorPeer::clearInstancePool();
FileSyncPeer::clearInstancePool();
accessControlPeer::clearInstancePool();
mediaInfoPeer::clearInstancePool();
assetParamsPeer::clearInstancePool();
assetParamsOutputPeer::clearInstancePool();
assetPeer::clearInstancePool();
conversionProfile2Peer::clearInstancePool();
flavorParamsConversionProfilePeer::clearInstancePool();
categoryPeer::clearInstancePool();
syndicationFeedPeer::clearInstancePool();
TrackEntryPeer::clearInstancePool();
// SystemUserPeer::clearInstancePool();
StorageProfilePeer::clearInstancePool();
// EmailIngestionProfilePeer::clearInstancePool();
UploadTokenPeer::clearInstancePool();
// invalidSessionPeer::clearInstancePool();
DynamicEnumPeer::clearInstancePool();
UserLoginDataPeer::clearInstancePool();
PermissionPeer::clearInstancePool();
UserRolePeer::clearInstancePool();
PermissionItemPeer::clearInstancePool();
PermissionToPermissionItemPeer::clearInstancePool();
KuserToUserRolePeer::clearInstancePool();
$pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaMemoryCleaner');
foreach ($pluginInstances as $pluginInstance) {
$pluginInstance->cleanMemory();
}
if (function_exists('gc_collect_cycles')) {
// php 5.3 and above
gc_collect_cycles();
}
}
示例9: getLoginPartners
function getLoginPartners()
{
PartnerPeer::clearInstancePool();
$c = new Criteria();
$c1 = $c->getNewCriterion(PartnerPeer::SERVICE_CONFIG_ID, 'services-paramount-mobile.ct');
$c2 = $c->getNewCriterion(PartnerPeer::SERVICE_CONFIG_ID, 'services-disney-mediabowl.ct');
$c1->addOr($c2);
$c->add($c1);
PartnerPeer::setUseCriteriaFilter(false);
$partners = PartnerPeer::doSelect($c);
PartnerPeer::setUseCriteriaFilter(true);
$ids = array();
foreach ($partners as $par) {
$ids[] = $par->getId();
}
return $ids;
}
示例10: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
kuserPeer::clearInstancePool();
PartnerPeer::clearInstancePool();
entryPeer::clearInstancePool();
$this->client = null;
parent::tearDown();
}