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


PHP PermissionPeer::clearInstancePool方法代码示例

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


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

示例1: 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

示例2: doDelete

 /**
  * Method perform a DELETE on the database, given a Permission or Criteria object OR a primary key value.
  *
  * @param      mixed $values Criteria or Permission 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(PermissionPeer::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.
         PermissionPeer::clearInstancePool();
         // rename for clarity
         $criteria = clone $values;
     } elseif ($values instanceof Permission) {
         // it's a model object
         // invalidate the cache for this single object
         PermissionPeer::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(PermissionPeer::ID, (array) $values, Criteria::IN);
         // invalidate the cache for this object(s)
         foreach ((array) $values as $singleval) {
             PermissionPeer::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);
         PermissionPeer::clearRelatedInstancePool();
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:55,代码来源:BasePermissionPeer.php

示例3: die

DbManager::setConfig($dbConf);
DbManager::initialize();
if ($argc !== 3) {
    die('usage: php ' . $_SERVER['SCRIPT_NAME'] . " [sub partner] [master partner]" . PHP_EOL);
}
$subPartnerId = $argv[1];
$masterPartnerId = $argv[2];
$subPartner = PartnerPeer::retrieveByPK($subPartnerId);
if (!$subPartner) {
    die("no such sub partner [{$subPartner}]." . PHP_EOL);
}
$masterPartner = PartnerPeer::retrieveByPK($masterPartnerId);
if (!$masterPartner) {
    die("no such master partner [{$subPartner}]." . PHP_EOL);
}
PermissionPeer::clearInstancePool();
$c = new Criteria();
$c->addAnd(PermissionPeer::PARTNER_ID, $masterPartner->getId(), Criteria::EQUAL);
$c->addAnd(PermissionPeer::TYPE, PermissionType::PARTNER_GROUP, Criteria::EQUAL);
$c->addAnd(PermissionPeer::STATUS, PermissionStatus::ACTIVE, Criteria::EQUAL);
$permission = PermissionPeer::doSelectOne($c);
if (!$permission) {
    die("Master partner group doesnot exists" . PHP_EOL);
}
$group = $permission->getPartnerGroup();
$groupPartners = explode(',', $group);
$newGroupArr = array();
foreach ($groupPartners as $groupPartner) {
    if ($groupPartner != $subPartnerId) {
        $newGroupArr[] = $groupPartner;
    }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:removePartnerFromPartnerGroup.php

示例4: init

 /**
  * Init with allowed permissions for the user in the given KS or kCurrentContext if not KS given
  * kCurrentContext::init should have been executed before!
  * @param string $ks KS to extract user and partner IDs from instead of kCurrentContext
  * @param boolean $useCache use cache or not
  * @throws TODO: add all exceptions
  */
 public static function init($useCache = null)
 {
     // verify that kCurrentContext::init has been executed since it must be used to init current context permissions
     if (!kCurrentContext::$ksPartnerUserInitialized) {
         KalturaLog::crit('kCurrentContext::initKsPartnerUser must be executed before initializing kPermissionManager');
         throw new Exception('kCurrentContext has not been initialized!', null);
     }
     // can be initialized more than once to support multirequest with different kCurrentContext parameters
     self::$initialized = false;
     self::$useCache = $useCache ? true : false;
     // copy kCurrentContext parameters (kCurrentContext::init should have been executed before)
     self::$requestedPartnerId = !self::isEmpty(kCurrentContext::$partner_id) ? kCurrentContext::$partner_id : null;
     self::$ksPartnerId = !self::isEmpty(kCurrentContext::$ks_partner_id) ? kCurrentContext::$ks_partner_id : null;
     self::$ksUserId = !self::isEmpty(kCurrentContext::$ks_uid) ? kCurrentContext::$ks_uid : null;
     self::$ksString = kCurrentContext::$ks ? kCurrentContext::$ks : null;
     self::$adminSession = !self::isEmpty(kCurrentContext::$is_admin_session) ? kCurrentContext::$is_admin_session : false;
     // clear instance pools
     //TODO: may not be needed
     UserRolePeer::clearInstancePool();
     PermissionPeer::clearInstancePool();
     PermissionItemPeer::clearInstancePool();
     PermissionToPermissionItemPeer::clearInstancePool();
     kuserPeer::clearInstancePool();
     // if ks defined - check that it is valid
     self::errorIfKsNotValid();
     // init partner, user, and role objects
     self::initPartnerUserObjects();
     // throw an error if KS partner (operating partner) is blocked
     self::errorIfPartnerBlocked();
     // init role ids
     self::initRoleIds();
     // init permissions map
     self::initPermissionsMap();
     // initialization done
     self::$initialized = true;
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:44,代码来源:kPermissionManager.php

示例5: getOrCreatePartnerGroupPermission

/**
 * Create a special partner group permission for given partner id, or get an existing one
 * @param int $partnerId
 * @param string $partnerGroup
 */
function getOrCreatePartnerGroupPermission($partnerId, $partnerGroup)
{
    $permissionName = 'PARTNER_' . $partnerId . '_GROUP_' . $partnerGroup . '_PERMISSION';
    PermissionPeer::clearInstancePool();
    $c = new Criteria();
    $c->addAnd(PermissionPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
    $c->addAnd(PermissionPeer::NAME, $permissionName, Criteria::EQUAL);
    $c->addAnd(PermissionPeer::TYPE, PermissionType::PARTNER_GROUP, Criteria::EQUAL);
    $permission = PermissionPeer::doSelectOne($c);
    if (!$permission) {
        // create permission if not yet created
        $permission = new Permission();
        $permission->setPartnerId($partnerId);
        $permission->setName($permissionName);
        $permission->setFriendlyName('Partner ' . $partnerId . ' permission for group ' . $partnerGroup);
        $permission->setDescription('Partner ' . $partnerId . ' permission for group ' . $partnerGroup);
        $permission->setType(PermissionType::PARTNER_GROUP);
        $permission->setPartnerGroup($partnerGroup);
        $permission->setStatus(PermissionStatus::ACTIVE);
        $permission->save();
    } else {
        if ($permission->getPartnerGroup() != $partnerGroup) {
            $msg = '***** ERROR - Permission id [' . $permission->getId() . '] partner group [' . $permission->getPartnerGroup() . '] is different from the required partner group [' . $partnerGroup . ']';
            KalturaLog::alert($msg);
            echo $msg . PHP_EOL;
        }
    }
    return $permission;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:34,代码来源:02_add_special_partner_permissions.php

示例6: 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();
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:71,代码来源:kMemoryManager.php


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