コード例 #1
0
ファイル: Tag.php プロジェクト: DBezemer/server
 public function postUpdate(PropelPDO $con = null)
 {
     parent::postUpdate($con);
     if (!$this->alreadyInSave) {
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($this));
     }
 }
コード例 #2
0
ファイル: kJobsManager.php プロジェクト: richhl/kalturaCE
 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;
 }
コード例 #3
0
 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
0
ファイル: MetadataProfile.php プロジェクト: richhl/kalturaCE
 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;
 }
コード例 #5
0
ファイル: syndicationFeed.php プロジェクト: richhl/kalturaCE
 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;
 }
コード例 #6
0
ファイル: UploadToken.php プロジェクト: richhl/kalturaCE
 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;
 }
コード例 #7
0
ファイル: Annotation.php プロジェクト: richhl/kalturaCE
 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;
 }
コード例 #8
0
ファイル: kJobsManager.php プロジェクト: ace3535/server
 /**
  * @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;
 }
コード例 #9
0
ファイル: asset.php プロジェクト: richhl/kalturaCE
 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;
 }
 /**
  * @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
0
 /**
  * @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);
 }
コード例 #12
0
 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;
 }
コード例 #13
0
 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
0
ファイル: DocumentsService.php プロジェクト: richhl/kalturaCE
 /**
  * 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
0
 /**
  * @param int $objectType
  * @param string $objectId
  */
 protected function deleteMetadataObjects($objectType, $objectId)
 {
     $c = new Criteria();
     $c->add(MetadataPeer::OBJECT_TYPE, $objectType);
     $c->add(MetadataPeer::OBJECT_ID, $objectId);
     $c->add(MetadataPeer::STATUS, Metadata::STATUS_DELETED, Criteria::NOT_EQUAL);
     $peer = null;
     MetadataPeer::setUseCriteriaFilter(false);
     $metadatas = MetadataPeer::doSelect($c);
     foreach ($metadatas as $metadata) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($metadata));
     }
     $update = new Criteria();
     $update->add(MetadataPeer::STATUS, Metadata::STATUS_DELETED);
     $con = Propel::getConnection(MetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     BasePeer::doUpdate($c, $update, $con);
 }
コード例 #16
0
 /**
  * updates entry distribution sun status in the search engine
  *
  * @action updateSunStatus
  */
 function updateSunStatusAction()
 {
     $updatedEntries = array();
     // serach all records that their sun status changed to after sunset
     $criteria = KalturaCriteria::create(EntryDistributionPeer::OM_CLASS);
     $criteria->add(EntryDistributionPeer::STATUS, EntryDistributionStatus::READY);
     $criteria->add(EntryDistributionPeer::SUN_STATUS, EntryDistributionSunStatus::AFTER_SUNSET, Criteria::NOT_EQUAL);
     $crit1 = $criteria->getNewCriterion(EntryDistributionPeer::SUNSET, time(), Criteria::LESS_THAN);
     $criteria->add($crit1);
     $entryDistributions = EntryDistributionPeer::doSelect($criteria);
     foreach ($entryDistributions as $entryDistribution) {
         /* @var $entryDistribution EntryDistribution */
         $entryId = $entryDistribution->getEntryId();
         if (isset($updatedEntries[$entryId])) {
             continue;
         }
         $updatedEntries[$entryId] = true;
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($entryDistribution));
         // raise the updated events to trigger index in search engine (sphinx)
         kEventsManager::flushEvents();
         // save entry changes to sphinx
         kMemoryManager::clearMemory();
     }
     $updatedEntries = array();
     // serach all records that their sun status changed to after sunrise
     $criteria = KalturaCriteria::create(EntryDistributionPeer::OM_CLASS);
     $criteria->add(EntryDistributionPeer::STATUS, EntryDistributionStatus::QUEUED);
     $criteria->add(EntryDistributionPeer::SUN_STATUS, EntryDistributionSunStatus::BEFORE_SUNRISE);
     $criteria->add(EntryDistributionPeer::SUNRISE, time(), Criteria::LESS_THAN);
     $entryDistributions = EntryDistributionPeer::doSelect($criteria);
     foreach ($entryDistributions as $entryDistribution) {
         /* @var $entryDistribution EntryDistribution */
         $entryId = $entryDistribution->getEntryId();
         if (isset($updatedEntries[$entryId])) {
             continue;
         }
         $updatedEntries[$entryId] = true;
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($entryDistribution));
         // raise the updated events to trigger index in search engine (sphinx)
         kEventsManager::flushEvents();
         // save entry changes to sphinx
         kMemoryManager::clearMemory();
     }
 }
 /**
  * updates entry distribution sun status in the search engine
  * 
  * @action updateSunStatus
  */
 function updateSunStatusAction()
 {
     // serach all records that their sun status changed to after sunset
     $criteria = KalturaCriteria::create(EntryDistributionPeer::OM_CLASS);
     $criteria->add(EntryDistributionPeer::SUN_STATUS, EntryDistributionSunStatus::AFTER_SUNSET, Criteria::NOT_EQUAL);
     $crit1 = $criteria->getNewCriterion(EntryDistributionPeer::SUNSET, time(), Criteria::LESS_THAN);
     $criteria->add($crit1);
     $entryDistributions = EntryDistributionPeer::doSelect($criteria);
     foreach ($entryDistributions as $entryDistribution) {
         // raise the updated events to trigger index in search engine (sphinx)
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($entryDistribution));
     }
     // serach all records that their sun status changed to after sunrise
     $criteria = KalturaCriteria::create(EntryDistributionPeer::OM_CLASS);
     $criteria->add(EntryDistributionPeer::SUN_STATUS, EntryDistributionSunStatus::BEFORE_SUNRISE);
     $criteria->add(EntryDistributionPeer::SUNRISE, time(), Criteria::LESS_THAN);
     $entryDistributions = EntryDistributionPeer::doSelect($criteria);
     foreach ($entryDistributions as $entryDistribution) {
         // raise the updated events to trigger index in search engine (sphinx)
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($entryDistribution));
     }
 }
 /**
  * Update content of attachment asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaAttachmentAsset
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED 
  * @validateUser asset::entry id edit
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbAttachmentAsset = assetPeer::retrieveById($id);
     if (!$dbAttachmentAsset || !$dbAttachmentAsset instanceof AttachmentAsset) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbAttachmentAsset->getentry();
     if (!$dbEntry || !in_array($dbEntry->getType(), $this->mediaTypes)) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbAttachmentAsset->getEntryId());
     }
     $previousStatus = $dbAttachmentAsset->getStatus();
     $contentResource->validateEntry($dbAttachmentAsset->getentry());
     $contentResource->validateAsset($dbAttachmentAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbAttachmentAsset, $kContentResource);
     $contentResource->entryHandled($dbAttachmentAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAttachmentAsset));
     $newStatuses = array(AttachmentAsset::ASSET_STATUS_READY, AttachmentAsset::ASSET_STATUS_VALIDATING, AttachmentAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == AttachmentAsset::ASSET_STATUS_QUEUED && in_array($dbAttachmentAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAttachmentAsset));
     }
     $attachmentAsset = new KalturaAttachmentAsset();
     $attachmentAsset->fromObject($dbAttachmentAsset);
     return $attachmentAsset;
 }
コード例 #19
0
ファイル: kCuePointManager.php プロジェクト: dozernz/server
 protected function deleteCuePoints(Criteria $c)
 {
     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);
     CuePointPeer::setUseCriteriaFilter(true);
     foreach ($cuePoints as $cuePoint) {
         $cuePoint->setStatus(CuePointStatus::DELETED);
         $cuePoint->indexToSearchIndex();
         kEventsManager::raiseEvent(new kObjectDeletedEvent($cuePoint));
     }
 }
コード例 #20
0
 /**
  * Code to be run before updating the object in database
  * @param PropelPDO $con
  * @return boolean
  */
 public function preUpdate(PropelPDO $con = null)
 {
     if ($this->isModified()) {
         kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->modifiedColumns));
     }
     return true;
 }
コード例 #21
0
 /**
  * @param FileSyncKey $key
  * @param $file_root
  * @param $real_path
  * @return SyncFile
  */
 public static function createSyncFileLinkForKey(FileSyncKey $target_key, FileSyncKey $source_key)
 {
     KalturaLog::debug("target_key [{$target_key}], source_key [{$source_key}]");
     // TODO - see that if in strict mode - there are no duplicate keys -> update existing records AND set the other DC's records to PENDING
     $dc = kDataCenterMgr::getCurrentDc();
     $dc_id = $dc["id"];
     // load all source file syncs
     $c = new Criteria();
     $c = FileSyncPeer::getCriteriaForFileSyncKey($source_key);
     $file_sync_list = FileSyncPeer::doSelect($c);
     if (!$file_sync_list) {
         KalturaLog::notice("Warning: no source. target_key [{$target_key}], source_key [{$source_key}] ");
         return null;
     }
     $source_file_syncs = array();
     foreach ($file_sync_list as $file_sync) {
         $file_sync = self::resolve($file_sync);
         // we only want to link to a source and not to a link.
         $source_file_syncs[] = $file_sync;
     }
     // find the current dc file sync
     $current_dc_source_file = null;
     foreach ($source_file_syncs as $source_file_sync) {
         if ($source_file_sync->getDc() == $dc_id) {
             $current_dc_source_file = $source_file_sync;
         }
     }
     if (!$current_dc_source_file) {
         $current_dc_source_file = reset($source_file_syncs);
     }
     // create the remote file syncs
     foreach ($source_file_syncs as $source_file_sync) {
         $remote_dc_file_sync = FileSync::createForFileSyncKey($target_key);
         $remote_dc_file_sync->setDc($source_file_sync->getDc());
         $remote_dc_file_sync->setStatus($source_file_sync->getStatus());
         $remote_dc_file_sync->setOriginal($current_dc_source_file == $source_file_sync);
         $remote_dc_file_sync->setFileSize(-1);
         if ($source_file_sync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
             $remote_dc_file_sync->setFileType(FileSync::FILE_SYNC_FILE_TYPE_URL);
             $remote_dc_file_sync->setFileRoot($source_file_sync->getFileRoot());
             $remote_dc_file_sync->setFilePath($source_file_sync->getFilePath());
         } else {
             $remote_dc_file_sync->setFileType(FileSync::FILE_SYNC_FILE_TYPE_LINK);
         }
         $remote_dc_file_sync->setLinkedId($source_file_sync->getId());
         self::incrementLinkCountForFileSync($source_file_sync);
         $remote_dc_file_sync->setPartnerID($target_key->partner_id);
         $remote_dc_file_sync->save();
         if ($current_dc_source_file == $source_file_sync) {
             $current_dc_target_file = $remote_dc_file_sync;
         } else {
             kEventsManager::raiseEvent(new kObjectAddedEvent($remote_dc_file_sync));
         }
     }
     kEventsManager::raiseEvent(new kObjectAddedEvent($current_dc_target_file));
 }
コード例 #22
0
 protected function addEntryFromFlavorAsset(KalturaBaseEntry $newEntry, entry $srcEntry, flavorAsset $srcFlavorAsset)
 {
     $newEntry->type = $srcEntry->getType();
     if ($newEntry->name === null) {
         $newEntry->name = $srcEntry->getName();
     }
     if ($newEntry->description === null) {
         $newEntry->description = $srcEntry->getDescription();
     }
     if ($newEntry->creditUrl === null) {
         $newEntry->creditUrl = $srcEntry->getSourceLink();
     }
     if ($newEntry->creditUserName === null) {
         $newEntry->creditUserName = $srcEntry->getCredit();
     }
     if ($newEntry->tags === null) {
         $newEntry->tags = $srcEntry->getTags();
     }
     $newEntry->sourceType = KalturaSourceType::SEARCH_PROVIDER;
     $newEntry->searchProviderType = KalturaSearchProviderType::KALTURA;
     $dbEntry = $this->prepareEntryForInsert($newEntry);
     $dbEntry->setSourceId($srcEntry->getId());
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     $msg = null;
     $flavorAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId(), $msg);
     if (!$flavorAsset) {
         KalturaLog::err("Flavor asset not created for entry [" . $dbEntry->getId() . "] reason [{$msg}]");
         if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
             $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
             $dbEntry->save();
         }
         throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED, $msg);
     }
     $srcSyncKey = $srcFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $newSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::createSyncFileLinkForKey($newSyncKey, $srcSyncKey);
     kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset));
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $newEntry->fromObject($dbEntry, $this->getResponseProfile());
     return $newEntry;
 }
コード例 #23
0
 /**
  * Code to be run after updating the object in database
  * @param PropelPDO $con
  */
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->isModified()) {
         kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->tempModifiedColumns));
     }
     $this->tempModifiedColumns = array();
 }
コード例 #24
0
ファイル: Basekshow.php プロジェクト: wzur/server
 /**
  * Code to be run after updating the object in database
  * @param PropelPDO $con
  */
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return;
     }
     if ($this->isModified()) {
         kQueryCache::invalidateQueryCache($this);
         $modifiedColumns = $this->tempModifiedColumns;
         $modifiedColumns[kObjectChangedEvent::CUSTOM_DATA_OLD_VALUES] = $this->oldCustomDataValues;
         kEventsManager::raiseEvent(new kObjectChangedEvent($this, $modifiedColumns));
     }
     $this->tempModifiedColumns = array();
     parent::postUpdate($con);
 }
コード例 #25
0
 /**
  * Code to be run after updating the object in database
  * @param PropelPDO $con
  */
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return;
     }
     if ($this->isModified()) {
         kQueryCache::invalidateQueryCache($this);
         kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->tempModifiedColumns));
     }
     $this->tempModifiedColumns = array();
     parent::postUpdate($con);
 }
コード例 #26
0
ファイル: kFlowHelper.php プロジェクト: richhl/kalturaCE
 /**
  * @param BatchJob $dbBatchJob
  * @param kImportJobData $data
  * @param BatchJob $twinJob
  * @return BatchJob
  */
 public static function handleImportFinished(BatchJob $dbBatchJob, kImportJobData $data, BatchJob $twinJob = null)
 {
     KalturaLog::debug("Import finished, with file: " . $data->getDestFileLocalPath());
     if ($dbBatchJob->getAbort()) {
         return $dbBatchJob;
     }
     if (!$twinJob) {
         if (!file_exists($data->getDestFileLocalPath())) {
             throw new APIException(APIErrors::INVALID_FILE_NAME, $data->getDestFileLocalPath());
         }
     }
     $msg = null;
     $flavorAsset = kFlowHelper::createOriginalFlavorAsset($dbBatchJob->getPartnerId(), $dbBatchJob->getEntryId(), $msg);
     if (!$flavorAsset) {
         KalturaLog::err("Flavor asset not created for entry [" . $dbBatchJob->getEntryId() . "]");
         kBatchManager::updateEntry($dbBatchJob, entryStatus::ERROR_CONVERTING);
         $dbBatchJob->setMessage($msg);
         $dbBatchJob->setDescription($dbBatchJob->getDescription() . "\n" . $msg);
         return $dbBatchJob;
     }
     $syncKey = null;
     if ($twinJob) {
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         // copy file sync
         $twinData = $twinJob->getData();
         if ($twinData instanceof kImportJobData) {
             $twinFlavorAsset = flavorAssetPeer::retrieveById($twinData->getFlavorAssetId());
             if ($twinFlavorAsset) {
                 $twinSyncKey = $twinFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 if ($twinSyncKey && kFileSyncUtils::file_exists($twinSyncKey)) {
                     kFileSyncUtils::softCopy($twinSyncKey, $syncKey);
                 }
             }
         }
     } else {
         $ext = pathinfo($data->getDestFileLocalPath(), PATHINFO_EXTENSION);
         KalturaLog::info("Imported file extension: {$ext}");
         $flavorAsset->setFileExt($ext);
         $flavorAsset->save();
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey);
     }
     // set the path in the job data
     $data->setDestFileLocalPath(kFileSyncUtils::getLocalFilePathForKey($syncKey));
     $data->setFlavorAssetId($flavorAsset->getId());
     $dbBatchJob->setData($data);
     $dbBatchJob->save();
     kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset));
     return $dbBatchJob;
 }
コード例 #27
0
 /**
  * Code to be run after persisting the object
  * @param PropelPDO $con
  */
 public function postSave(PropelPDO $con = null)
 {
     kEventsManager::raiseEvent(new kObjectSavedEvent($this));
     $this->oldColumnsValues = array();
     parent::postSave($con);
 }
コード例 #28
0
ファイル: CuePoint.php プロジェクト: kubrickfr/server
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return parent::postUpdate($con);
     }
     $objectUpdated = $this->isModified();
     $objectDeleted = false;
     if ($this->isColumnModified(CuePointPeer::STATUS) && $this->getStatus() == CuePointStatus::DELETED) {
         $objectDeleted = true;
     }
     $ret = parent::postUpdate($con);
     if ($objectDeleted) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
         $parent = $this->getParent();
         if ($parent) {
             $parent->decreaseChildrenCountAndSave();
         }
     }
     if ($objectUpdated) {
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($this));
     }
     return $ret;
 }
コード例 #29
0
ファイル: entry.php プロジェクト: AdiTal/server
 public function postInsert(PropelPDO $con = null)
 {
     if (!$this->wasObjectSaved()) {
         return;
     }
     parent::postInsert($con);
     if (!$this->alreadyInSave) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($this));
     }
 }
コード例 #30
0
 public static function copyTemplateContent(Partner $fromPartner, Partner $toPartner, $dontCopyUsers = 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);
         }
     }
     // 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);
     self::copyCategories($fromPartner, $toPartner);
     self::copyUiConfsByType($fromPartner, $toPartner, uiConf::UI_CONF_TYPE_WIDGET);
     self::copyUiConfsByType($fromPartner, $toPartner, uiConf::UI_CONF_TYPE_KDP3);
     // Launch a batch job that will copy the heavy load as an async operation
     kJobsManager::addCopyPartnerJob($fromPartner->getId(), $toPartner->getId());
 }