本文整理汇总了PHP中uiConfPeer::setUseCriteriaFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP uiConfPeer::setUseCriteriaFilter方法的具体用法?PHP uiConfPeer::setUseCriteriaFilter怎么用?PHP uiConfPeer::setUseCriteriaFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uiConfPeer
的用法示例。
在下文中一共展示了uiConfPeer::setUseCriteriaFilter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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(uiConfPeer::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.
uiConfPeer::setUseCriteriaFilter(false);
$stmt = uiConfPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
uiConfPeer::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->collwidgets = null;
$this->lastwidgetCriteria = null;
}
// if (deep)
}
示例3: copyUiConfsByType
public static function copyUiConfsByType(Partner $fromPartner, Partner $toPartner, $uiConfType)
{
KalturaLog::log("Copying uiconfs from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "] with type [" . $uiConfType . "]");
uiConfPeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(uiConfPeer::PARTNER_ID, $fromPartner->getId());
$c->addAnd(uiConfPeer::OBJ_TYPE, $uiConfType);
$c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY);
$uiConfs = uiConfPeer::doSelect($c);
uiConfPeer::setUseCriteriaFilter(true);
foreach ($uiConfs as $uiConf) {
// create a new uiConf, set its partner Id (so that upcoming file_sync will have the new partner's id)
// and clone fileds from current uiConf
$newUiConf = new uiConf();
$newUiConf->setPartnerId($toPartner->getId());
$newUiConf = $uiConf->cloneToNew($newUiConf);
$newUiConf->save();
KalturaLog::log("UIConf [" . $newUiConf->getId() . "] was created");
}
}
示例4: die
$fileSync = kFileSyncUtils::getLocalFileSyncForKey($uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA), false);
if ($fileSync) {
$fileSyncs[] = $fileSync;
}
$fileSync = kFileSyncUtils::getLocalFileSyncForKey($uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_CONFIG), false);
if ($fileSync) {
$fileSyncs[] = $fileSync;
}
$fileSync = kFileSyncUtils::getLocalFileSyncForKey($uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES), false);
if ($fileSync) {
$fileSyncs[] = $fileSync;
}
if (empty($fileSyncs)) {
die("No file_sync found for UI-Conf ID [" . $uiConfId . "]");
}
uiConfPeer::setUseCriteriaFilter(true);
FileSyncPeer::setUseCriteriaFilter(true);
foreach ($fileSyncs as $fileSync) {
if (!file_exists($fileSync->getFullPath())) {
die("UI-Conf file ID [" . $fileSync->getId() . "] file not found");
}
}
foreach ($fileSyncs as $fileSync) {
if (method_exists($fileSync, 'setDeletedId')) {
$fileSync->setDeletedId(0);
}
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
$fileSync->save();
}
$uiConf->setStatus(uiConf::UI_CONF_STATUS_READY);
$uiConf->save();
示例5: postInsert
/**
* Code to be run after inserting to database
* @param PropelPDO $con
*/
public function postInsert(PropelPDO $con = null)
{
uiConfPeer::setUseCriteriaFilter(false);
$this->reload();
uiConfPeer::setUseCriteriaFilter(true);
kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
if ($this->copiedFrom) {
kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
}
}
示例6: 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) {
//.........这里部分代码省略.........
示例7: 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);
}
}