本文整理汇总了PHP中kEventsManager类的典型用法代码示例。如果您正苦于以下问题:PHP kEventsManager类的具体用法?PHP kEventsManager怎么用?PHP kEventsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kEventsManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateBatchJob
public static function updateBatchJob(BatchJob $batchJob, $status, BatchJob $twinJob = null)
{
$batchJob->setStatus($status);
$batchJob->save();
$event = new kBatchJobStatusEvent($batchJob, $twinJob);
kEventsManager::raiseEvent($event);
$batchJob->reload();
return $batchJob;
}
示例2: updateBatchJob
/**
* @param BatchJob $batchJob
* @param int $status
* @return BatchJob
*/
public static function updateBatchJob(BatchJob $batchJob, $status)
{
$batchJob->setStatus($status);
$changed = $batchJob->save();
if (!$changed) {
return $batchJob;
}
$event = new kBatchJobStatusEvent($batchJob);
kEventsManager::raiseEvent($event);
$batchJob->reload();
return $batchJob;
}
示例3: postUpdate
public function postUpdate(PropelPDO $con = null)
{
$objectDeleted = false;
if ($this->isColumnModified(conversionProfile2Peer::DELETED_AT) && !is_null($this->getDeletedAt())) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例4: postUpdate
public function postUpdate(PropelPDO $con = null)
{
$objectDeleted = false;
if ($this->isColumnModified(AnnotationPeer::STATUS) && $this->getStatus() == AnnotationStatus::ANNOTATION_STATUS_DELETED) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例5: postUpdate
public function postUpdate(PropelPDO $con = null)
{
$objectDeleted = false;
if ($this->isColumnModified(MetadataProfilePeer::STATUS) && $this->getStatus() == self::STATUS_DEPRECATED) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例6: postUpdate
public function postUpdate(PropelPDO $con = null)
{
$objectDeleted = false;
if ($this->isColumnModified(BasesyndicationFeedPeer::STATUS) && $this->getStatus() == self::SYNDICATION_DELETED) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例7: postUpdate
public function postUpdate(PropelPDO $con = null)
{
$objectDeleted = false;
if ($this->isColumnModified(UploadTokenPeer::STATUS) && $this->getStatus() == self::UPLOAD_TOKEN_DELETED) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例8: resumeEvents
private function resumeEvents($flavorAsset)
{
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($syncKey);
$fileSyncList = FileSyncPeer::doSelect($c);
foreach ($fileSyncList as $fileSync) {
// resume file sync added event
kEventsManager::continueEvent(new kObjectAddedEvent($fileSync), 'kVirusScanFlowManager');
}
// resume flavor asset added event consumption
kEventsManager::continueEvent(new kObjectAddedEvent($flavorAsset), 'kVirusScanFlowManager');
}
示例9: postUpdate
public function postUpdate(PropelPDO $con = null)
{
$objectDeleted = false;
if ($this->isColumnModified(flavorAssetPeer::STATUS) && $this->getStatus() == self::FLAVOR_ASSET_STATUS_DELETED || $this->isColumnModified(flavorAssetPeer::DELETED_AT) && !is_null($this->getDeletedAt(null))) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例10: entryDeleted
/**
* @param int $entryId
*/
protected function entryDeleted($entryId)
{
$c = new Criteria();
$c->add(CuePointPeer::ENTRY_ID, $entryId);
CuePointPeer::setUseCriteriaFilter(false);
$cuePoints = CuePointPeer::doSelect($c);
$update = new Criteria();
$update->add(CuePointPeer::STATUS, CuePointStatus::DELETED);
$con = Propel::getConnection(myDbHelper::DB_HELPER_CONN_MASTER);
BasePeer::doUpdate($c, $update, $con);
foreach ($cuePoints as $cuePoint) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($cuePoint));
}
}
示例11: postUpdate
public function postUpdate(PropelPDO $con = null)
{
if ($this->alreadyInSave) {
return parent::postUpdate($con);
}
$objectDeleted = false;
if ($this->isColumnModified(accessControlPeer::DELETED_AT) && !is_null($this->getDeletedAt())) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例12: entryDeleted
/**
* @param int $entryId
*/
protected function entryDeleted($entryId)
{
$c = new Criteria();
$c->add(AnnotationPeer::ENTRY_ID, $entryId);
$c->add(AnnotationPeer::STATUS, AnnotationStatus::ANNOTATION_STATUS_DELETED, Criteria::NOT_EQUAL);
AnnotationPeer::setUseCriteriaFilter(false);
$annotations = AnnotationPeer::doSelect($c);
foreach ($annotations as $annotation) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($annotation));
}
$update = new Criteria();
$update->add(AnnotationPeer::STATUS, AnnotationStatus::ANNOTATION_STATUS_DELETED);
$con = Propel::getConnection(AnnotationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
BasePeer::doUpdate($c, $update, $con);
}
示例13: postUpdate
public function postUpdate(PropelPDO $con = null)
{
if ($this->alreadyInSave) {
return parent::postUpdate($con);
}
$objectDeleted = false;
if ($this->isColumnModified(ShortLinkPeer::STATUS) && $this->getStatus() == ShortLinkStatus::DELETED) {
$objectDeleted = true;
}
$ret = parent::postUpdate($con);
if ($objectDeleted) {
kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
}
return $ret;
}
示例14: addFromUploadedFileAction
/**
* Add new document entry after the specific document file was uploaded and the upload token id exists
*
* @action addFromUploadedFile
* @param KalturaDocumentEntry $documentEntry Document entry metadata
* @param string $uploadTokenId Upload token id
* @return KalturaDocumentEntry The new document entry
*
* @throws KalturaErrors::PROPERTY_VALIDATION_MIN_LENGTH
* @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
* @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
*/
function addFromUploadedFileAction(KalturaDocumentEntry $documentEntry, $uploadTokenId)
{
try {
// check that the uploaded file exists
$entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($uploadTokenId);
} catch (kCoreException $ex) {
if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
}
throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
throw $ex;
}
if (!file_exists($entryFullPath)) {
$remoteDCHost = kUploadTokenMgr::getRemoteHostForUploadToken($uploadTokenId, kDataCenterMgr::getCurrentDcId());
if ($remoteDCHost) {
kFile::dumpApiRequest($remoteDCHost);
} else {
throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
}
}
$dbEntry = $this->prepareEntryForInsert($documentEntry);
$dbEntry->setSource(KalturaSourceType::FILE);
$dbEntry->setSourceLink("file:{$entryFullPath}");
$dbEntry->save();
$te = new TrackEntry();
$te->setEntryId($dbEntry->getId());
$te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
$te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_FILE");
TrackEntry::addTrackEntry($te);
$msg = null;
$flavorAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId(), $msg);
if (!$flavorAsset) {
KalturaLog::err("Flavor asset not created for entry [" . $dbEntry->getId() . "] reason [{$msg}]");
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
} else {
$ext = pathinfo($entryFullPath, PATHINFO_EXTENSION);
KalturaLog::info("Uploaded file extension: {$ext}");
$flavorAsset->setFileExt($ext);
$flavorAsset->save();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($entryFullPath, $syncKey);
kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset));
}
kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
$documentEntry->fromObject($dbEntry);
return $documentEntry;
}
示例15: loadConsumers
protected static function loadConsumers()
{
$cachePath = kConf::get('cache_root_path') . '/EventConsumers.cache';
if (file_exists($cachePath)) {
self::$consumers = unserialize(file_get_contents($cachePath));
return;
}
$coreConsumers = kConf::get('event_consumers');
$pluginConsumers = array();
$pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaEventConsumers');
foreach ($pluginInstances as $pluginInstance) {
foreach ($pluginInstance->getEventConsumers() as $pluginConsumer) {
$pluginConsumers[] = $pluginConsumer;
}
}
$consumers = array_merge($coreConsumers, $pluginConsumers);
$consumersLists = array();
foreach ($consumers as $consumer) {
if (!class_exists($consumer)) {
continue;
}
$clazz = new ReflectionClass($consumer);
$interfaces = $clazz->getInterfaces();
foreach ($interfaces as $interface) {
if ($interface->name == self::BASE_CONSUMER_INTERFACE) {
continue;
}
if (!$interface->implementsInterface(self::BASE_CONSUMER_INTERFACE)) {
continue;
}
if (!isset($consumersLists[$interface->name])) {
$consumersLists[$interface->name] = array();
}
$consumersLists[$interface->name][] = $consumer;
}
}
foreach ($consumersLists as $interfaceName => $interfaceConsumersArray) {
usort($interfaceConsumersArray, array('kEventsManager', 'compareConsumers'));
self::$consumers[$interfaceName] = $interfaceConsumersArray;
}
$cacheDir = dirname($cachePath);
if (!file_exists($cacheDir)) {
kFile::fullMkfileDir($cacheDir, 0777, true);
}
@file_put_contents($cachePath, serialize(self::$consumers));
}