本文整理汇总了PHP中kEventsManager::enableDeferredEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP kEventsManager::enableDeferredEvents方法的具体用法?PHP kEventsManager::enableDeferredEvents怎么用?PHP kEventsManager::enableDeferredEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kEventsManager
的用法示例。
在下文中一共展示了kEventsManager::enableDeferredEvents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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) {
//.........这里部分代码省略.........
示例2: copyTemplateContent
public static function copyTemplateContent(Partner $fromPartner, Partner $toPartner, $dontCopyUsers = false)
{
kEventsManager::enableDeferredEvents(false);
$partnerCustomDataArray = $fromPartner->getCustomDataObj()->toArray();
$excludeCustomDataFields = kConf::get('template_partner_custom_data_exclude_fields');
foreach ($partnerCustomDataArray as $customDataName => $customDataValue) {
if (!in_array($customDataName, $excludeCustomDataFields)) {
$toPartner->putInCustomData($customDataName, $customDataValue);
}
}
$toPartner->save();
// copy permssions before trying to copy additional objects such as distribution profiles which are not enabled yet for the partner
self::copyPermissions($fromPartner, $toPartner);
self::copyUserRoles($fromPartner, $toPartner);
kEventsManager::raiseEvent(new kObjectCopiedEvent($fromPartner, $toPartner));
self::copyAccessControls($fromPartner, $toPartner);
self::copyFlavorParams($fromPartner, $toPartner);
self::copyConversionProfiles($fromPartner, $toPartner);
categoryEntryPeer::setUseCriteriaFilter(false);
self::copyCategories($fromPartner, $toPartner);
self::copyEntriesByType($fromPartner, $toPartner, entryType::MEDIA_CLIP, $dontCopyUsers);
self::copyEntriesByType($fromPartner, $toPartner, entryType::PLAYLIST, $dontCopyUsers);
categoryEntryPeer::setUseCriteriaFilter(true);
self::copyUiConfsByType($fromPartner, $toPartner, uiConf::UI_CONF_TYPE_WIDGET);
self::copyUiConfsByType($fromPartner, $toPartner, uiConf::UI_CONF_TYPE_KDP3);
kEventsManager::enableDeferredEvents(true);
}
示例3: chdir
<?php
chdir(dirname(__FILE__));
require_once dirname(__FILE__) . '/../bootstrap.php';
$partnerId = null;
$partnerPackage = 1;
if ($argc > 1 && is_numeric($argv[1])) {
$partnerId = $argv[1];
}
if ($argc > 2 && is_numeric($argv[2])) {
$partnerPackage = $argv[2];
}
if (in_array('dryRun', $argv)) {
KalturaStatement::setDryRun(true);
}
kCurrentContext::$master_partner_id = -2;
kCurrentContext::$uid = "PARTNER USAGE DAEMON";
// Make sure that events will be performed immediately (e.g. creating a new kuser for the given puser)
kEventsManager::enableDeferredEvents(false);
$batchClient = new myBatchPartnerUsage($partnerId, $partnerPackage);
KalturaLog::debug('Done.');