public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $time_offset = $this->getPM("time_offset");
     $entry_ids = $this->getPM("entry_ids");
     $detailed = $this->getP("detailed", false);
     $separator = $this->getP("separator", ",");
     $id_arr = explode($separator, $entry_ids);
     $limit = 50;
     $id_arr = array_splice($id_arr, 0, $limit);
     $entries = entryPeer::retrieveByPKs($id_arr);
     $updated_entries = array();
     if (!$entries) {
         $this->addError(APIErrors::INVALID_ENTRY_IDS, $entry_ids);
     } else {
         foreach ($entries as $entry) {
             if (!myEntryUtils::createThumbnailFromEntry($entry, $entry, $time_offset)) {
                 $this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP [" . $entry->getId() . "]");
                 continue;
             }
             $updated_entries[] = $entry;
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
             $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
             $wrapper->removeFromCache("entry", $entry->getId());
         }
     }
     $this->addMsg("entries", objectWrapperBase::getWrapperClass($updated_entries, objectWrapperBase::DETAIL_LEVEL_REGULAR));
 }
Exemplo n.º 2
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshow_id_to_delete = $this->getPM("kshow_id");
     $kshow_to_delete = kshowPeer::retrieveByPK($kshow_id_to_delete);
     if (!$kshow_to_delete) {
         $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id_to_delete);
         return;
     }
     $kshow_to_delete->delete();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_DELETE, $kshow_to_delete);
     $this->addMsg("deleted_kshow", objectWrapperBase::getWrapperClass($kshow_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR));
 }
Exemplo n.º 3
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = $this->getObjectPrefix();
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $entry_id = $this->getPM("{$prefix}_id");
     $entry = entryPeer::retrieveByPK($entry_id);
     if (!$entry) {
         $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id);
         return;
     }
     $this->validateInputEntry($entry);
     // TODO - verify the user is allowed to modify the entry
     if (!$this->isOwnedBy($entry, $puser_kuser->getKuserId())) {
         $this->verifyEntryPrivileges($entry);
         // user was granted explicit permissions when initiatd the ks
     }
     // get the new properties for the kuser from the request
     $entry_update_data = new entry();
     // assume the type and media_type of the entry from the DB are the same as those of the one from the user - if not -they will be overriden
     $entry_update_data->setType($entry->getType());
     $entry_update_data->setMediaType($entry->getMediaType());
     $entry_update_data->setId($entry->getId());
     $entry_update_data->setPartnerId($entry->getPartnerId());
     $entry_update_data->setData($entry->getData(), true);
     $obj_wrapper = objectWrapperBase::getWrapperClass($entry_update_data, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $entry_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($entry_update_data) {
             // allow admins to set admin more fields
             baseObjectUtils::fillObjectFromObject($updateable_fields, $entry_update_data, $entry, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $this->validateEntry($entry);
         // TODO - chack to see that the permissions changed, not just any attributes
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_PERMISSIONS, $entry);
         $entry->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     $wrapper->removeFromCache("entry", $entry->getId());
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 /**
  * Adds a new data entry
  * 
  * @action add
  * @param KalturaDataEntry $dataEntry Data entry
  * @return KalturaDataEntry The new data entry
  */
 function addAction(KalturaDataEntry $dataEntry)
 {
     $dbEntry = $dataEntry->toObject(new entry());
     $this->checkAndSetValidUser($dataEntry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($dataEntry);
     $this->validateAccessControlId($dataEntry);
     $this->validateEntryScheduleDates($dataEntry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setStatus(KalturaEntryStatus::READY);
     $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
     $dbEntry->save();
     $dataEntry->fromObject($dbEntry);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     return $dataEntry;
 }
Exemplo n.º 6
0
 public function addNotification($notification_type, $object_data, $partner_id = null, $puser_id = null)
 {
     $index = 1 + count($this->m_not_list);
     $prefix = "not{$index}_";
     @(list($temp_not_id, $temp_not, $temp_url, $temp_params, $temp_serialized_params) = myNotificationMgr::createNotification($notification_type, $object_data, $partner_id, $puser_id, $prefix));
     @(list($not_id, $not, $url, $params, $serialized_params) = array($temp_not_id, $temp_not, $temp_url, $temp_params, $temp_serialized_params));
     $this->m_not_list[] = $not;
     $this->m_not_id_list[] = $not_id;
     if ($this->m_url != null && $this->m_url != $url) {
         // ERROR !
     }
     $this->m_url = $url;
     // assume all URLs are the same
     array_merge($this->m_params, $params);
     // accumulate the params
     $this->m_serialized_params = $serialized_params;
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $entry_id = $this->getPM("entry_id");
     $entry = entryPeer::retrieveByPK($entry_id);
     // TODO - verify the user is allowed to modify the entry
     $source_entry_id = $this->getP("source_entry_id");
     if ($source_entry_id) {
         $source_entry = entryPeer::retrieveByPK($source_entry_id);
         if (!$source_entry) {
             return;
         }
     } else {
         $source_entry = $entry;
     }
     $time_offset = $this->getP("time_offset", -1);
     if (!myEntryUtils::createThumbnailFromEntry($entry, $source_entry, $time_offset)) {
         $this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP");
         return;
     }
     if ($entry->getType() == entryType::MIX) {
         /*			
         		$roughcutPath = myContentStorage::getFSContentRootPath() . $entry->getDataPath(); // replaced__getDataPath
         		$xml_doc = new DOMDocument();
         		$xml_doc->load( $roughcutPath );
         	
         		if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl()))
         			$xml_doc->save($roughcutPath);
         */
         $sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         $xml_doc = new DOMDocument();
         $xml_doc->loadXML(kFileSyncUtils::file_get_contents($sync_key));
         if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl())) {
             $entry->setMetadata(null, $xml_doc->saveXML(), true, null, null);
             //$entry->getVersion() );
         }
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
     }
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     $wrapper->removeFromCache("entry", $entry->getId());
     $this->addMsg("entry", $wrapper);
 }
Exemplo n.º 8
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshow_id = $this->getPM("kshow_id");
     $rank = $this->getPM("rank");
     $kshow = kshowPeer::retrieveByPK($kshow_id);
     if (!$kshow) {
         $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
         return;
     }
     if ($rank > entry::MAX_NORMALIZED_RANK || $rank < 0 || !is_numeric($rank)) {
         $this->addError(APIErrors::INVALID_RANK, $rank);
         return;
     }
     $kuser_id = $puser_kuser->getKuserId();
     $entry_id = $kshow->getShowEntryId();
     $partner = PartnerPeer::retrieveByPK($partner_id);
     if (!$partner->getAllowAnonymousRanking()) {
         // prevent duplicate votes
         $c = new Criteria();
         $c->add(kvotePeer::KUSER_ID, $kuser_id);
         $c->add(kvotePeer::ENTRY_ID, $entry_id);
         $c->add(kvotePeer::KSHOW_ID, $kshow_id);
         $kvote = kvotePeer::doSelectOne($c);
         if ($kvote != NULL) {
             $this->addError(APIErrors::USER_ALREADY_RANKED_KSHOW, $puser_id, $kshow_id);
             return;
         }
     }
     $kvote = new kvote();
     $kvote->setKshowId($kshow_id);
     $kvote->setEntryId($entry_id);
     $kvote->setKuserId($kuser_id);
     $kvote->setRank($rank);
     $kvote->save();
     $statistics_results = $kvote->getStatisticsResults();
     $updated_kshow = @$statistics_results["kshow"];
     if ($updated_kshow) {
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_RANK, $updated_kshow);
         $data = array("kshow_id" => $kshow_id, "uid" => $puser_id, "rank" => $updated_kshow->getRank(), "votes" => $updated_kshow->getVotes());
         //$this->addMsg ( "kshow" , objectWrapperBase::getWrapperClass( $updated_kshow , objectWrapperBase::DETAIL_LEVEL_DETAILED) );
         $this->addMsg("rank", $data);
     }
 }
 /**
  * Adds new live stream entry.
  * The entry will be queued for provision.
  * 
  * @action add
  * @param KalturaLiveStreamAdminEntry $liveStreamEntry Live stream entry metadata  
  * @param KalturaSourceType $sourceType  Live stream source type
  * @return KalturaLiveStreamAdminEntry The new live stream entry
  * 
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  */
 function addAction(KalturaLiveStreamAdminEntry $liveStreamEntry, $sourceType = null)
 {
     //TODO: allow sourceType that belongs to LIVE entries only - same for mediaType
     if ($sourceType) {
         $liveStreamEntry->sourceType = $sourceType;
     } else {
         // default sourceType is AKAMAI_LIVE
         $liveStreamEntry->sourceType = kPluginableEnumsManager::coreToApi('EntrySourceType', $this->getPartner()->getDefaultLiveStreamEntrySourceType());
     }
     // if the given password is empty, generate a random 8-character string as the new password
     if ($liveStreamEntry->streamPassword == null || strlen(trim($liveStreamEntry->streamPassword)) <= 0) {
         $tempPassword = sha1(md5(uniqid(rand(), true)));
         $liveStreamEntry->streamPassword = substr($tempPassword, rand(0, strlen($tempPassword) - 8), 8);
     }
     // if no bitrate given, add default
     if (is_null($liveStreamEntry->bitrates) || !$liveStreamEntry->bitrates->count) {
         $liveStreamBitrate = new KalturaLiveStreamBitrate();
         $liveStreamBitrate->bitrate = self::DEFAULT_BITRATE;
         $liveStreamBitrate->width = self::DEFAULT_WIDTH;
         $liveStreamBitrate->height = self::DEFAULT_HEIGHT;
         $liveStreamEntry->bitrates = new KalturaLiveStreamBitrateArray();
         $liveStreamEntry->bitrates[] = $liveStreamBitrate;
     } else {
         $bitrates = new KalturaLiveStreamBitrateArray();
         foreach ($liveStreamEntry->bitrates as $bitrate) {
             if (is_null($bitrate->bitrate)) {
                 $bitrate->bitrate = self::DEFAULT_BITRATE;
             }
             if (is_null($bitrate->width)) {
                 $bitrate->bitrate = self::DEFAULT_WIDTH;
             }
             if (is_null($bitrate->height)) {
                 $bitrate->bitrate = self::DEFAULT_HEIGHT;
             }
             $bitrates[] = $bitrate;
         }
         $liveStreamEntry->bitrates = $bitrates;
     }
     $dbEntry = $this->insertLiveStreamEntry($liveStreamEntry);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $this->getPartnerId(), null, null, null, $dbEntry->getId());
     $liveStreamEntry->fromObject($dbEntry);
     return $liveStreamEntry;
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $entry_id = $this->getPM("entry_id");
     $entry = entryPeer::retrieveByPK($entry_id);
     // TODO - verify the user is allowed to modify the entry
     if ($entry->getKshowId() === kshow::SANDBOX_ID) {
         $this->addError(APIErrors::SANDBOX_ALERT);
         return;
     }
     $entry->setThumbnail(".jpg");
     $entry->setCreateThumb(false);
     $entry->save();
     if (isset($HTTP_RAW_POST_DATA)) {
         $thumb_data = $HTTP_RAW_POST_DATA;
     } else {
         $thumb_data = file_get_contents("php://input");
     }
     $thumb_data_size = strlen($thumb_data);
     $fileSyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     $fileSync = FileSync::createForFileSyncKey($fileSyncKey);
     kFileSyncUtils::file_put_contents($fileSyncKey, $thumb_data);
     // update the metadata in case of a roughcut
     if ($entry->getType() == entryType::MIX) {
         $sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         $xml_doc = new DOMDocument();
         $xml_doc->loadXML(kFileSyncUtils::file_get_contents($sync_key));
         if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl())) {
             $entry->setMetadata(null, $xml_doc->saveXML(), true, null, null);
             //$entry->getVersion() );
         }
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
     }
     $this->res = $entry->getBigThumbnailUrl();
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $wrapper->removeFromCache("entry", $entry->getId());
     $this->addMsg("entry", $wrapper);
 }
 /**
  * Adds a new data entry
  * 
  * @action add
  * @param KalturaDataEntry $dataEntry Data entry
  * @return KalturaDataEntry The new data entry
  */
 function addAction(KalturaDataEntry $dataEntry)
 {
     $dbEntry = $dataEntry->toObject(new entry());
     $this->checkAndSetValidUserInsert($dataEntry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($dataEntry);
     $this->validateAccessControlId($dataEntry);
     $this->validateEntryScheduleDates($dataEntry, $dbEntry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setStatus(KalturaEntryStatus::READY);
     $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
     $dbEntry->save();
     $trackEntry = new TrackEntry();
     $trackEntry->setEntryId($dbEntry->getId());
     $trackEntry->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
     $trackEntry->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_DATA");
     TrackEntry::addTrackEntry($trackEntry);
     $dataEntry->fromObject($dbEntry);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     return $dataEntry;
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $entry_id = $this->getPM("entry_id");
     $moderation_status = $this->getPM("moderation_status");
     entryPeer::allowDeletedInCriteriaFilter();
     $entry = entryPeer::retrieveByPK($entry_id);
     if ($entry) {
         // when setting the moderation status- propagate to all related moderation objects
         $entry->moderate($moderation_status, true);
         $entry->setModerationCount(0);
         // set the number of unhandled flags to 0
         $entry->save();
         // for  no wodn't add an extra notification - one is sent from within the entry->moderate()
         // TODO - where is the best place to notify ??
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry, null, null, null, null, $entry_id);
     }
     entryPeer::blockDeletedInCriteriaFilter();
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     if ($entry) {
         $wrapper->removeFromCache("entry", $entry->getId());
     }
     $this->addMsg("entry", $wrapper);
 }
Exemplo n.º 13
0
 /**
  * Adds new live stream entry.
  * The entry will be queued for provision.
  * 
  * @action add
  * @param KalturaLiveStreamEntry $liveStreamEntry Live stream entry metadata  
  * @param KalturaSourceType $sourceType  Live stream source type
  * @return KalturaLiveStreamEntry The new live stream entry
  * 
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  */
 function addAction(KalturaLiveStreamEntry $liveStreamEntry, $sourceType = null)
 {
     if ($sourceType) {
         $liveStreamEntry->sourceType = $sourceType;
     } elseif (is_null($liveStreamEntry->sourceType)) {
         // default sourceType is AKAMAI_LIVE
         $liveStreamEntry->sourceType = kPluginableEnumsManager::coreToApi('EntrySourceType', $this->getPartner()->getDefaultLiveStreamEntrySourceType());
     }
     $dbEntry = $this->prepareEntryForInsert($liveStreamEntry);
     $dbEntry->save();
     $te = new TrackEntry();
     $te->setEntryId($dbEntry->getId());
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
     $te->setDescription(__METHOD__ . ":" . __LINE__ . "::" . $dbEntry->getSource());
     TrackEntry::addTrackEntry($te);
     //If a jobData can be created for entry sourceType, add provision job. Otherwise, just save the entry.
     $jobData = kProvisionJobData::getInstance($dbEntry->getSource());
     if ($jobData) {
         /* @var $data kProvisionJobData */
         $jobData->populateFromPartner($dbEntry->getPartner());
         $jobData->populateFromEntry($dbEntry);
         kJobsManager::addProvisionProvideJob(null, $dbEntry, $jobData);
     } else {
         $dbEntry->setStatus(entryStatus::READY);
         $dbEntry->save();
         $liveAssets = assetPeer::retrieveByEntryId($dbEntry->getId(), array(assetType::LIVE));
         foreach ($liveAssets as $liveAsset) {
             /* @var $liveAsset liveAsset */
             $liveAsset->setStatus(asset::ASSET_STATUS_READY);
             $liveAsset->save();
         }
     }
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $this->getPartnerId(), null, null, null, $dbEntry->getId());
     $liveStreamEntry->fromObject($dbEntry, $this->getResponseProfile());
     return $liveStreamEntry;
 }
Exemplo n.º 14
0
 protected function approveEntry($entryId, $entryType = null)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $entryType !== null && $dbEntry->getType() != $entryType) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $dbEntry->setModerationStatus(KalturaEntryModerationStatus::APPROVED);
     $dbEntry->setModerationCount(0);
     $updateOccurred = $dbEntry->save();
     if ($updateOccurred) {
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $dbEntry, null, null, null, null, $dbEntry->getId());
     }
     //		myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_BLOCK , $dbEntry->getId());
     moderationFlagPeer::markAsModeratedByEntryId($this->getPartnerId(), $dbEntry->getId());
 }
Exemplo n.º 15
0
 public static function handleBulkDownloadPending(BatchJob $dbBatchJob, kBulkDownloadJobData $data, BatchJob $twinJob = null)
 {
     $entryIds = explode(',', $data->getEntryIds());
     $flavorParamsId = $data->getFlavorParamsId();
     $jobIsFinished = true;
     foreach ($entryIds as $entryId) {
         $entry = entryPeer::retrieveByPK($entryId);
         if (is_null($entry)) {
             KalturaLog::err("Entry id [{$entryId}] not found.");
         } else {
             if ($entry->hasDownloadAsset($flavorParamsId)) {
                 // why we don't send the notification in case of image is ready?
                 $flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($entryId, $flavorParamsId);
                 if ($flavorAsset && $flavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
                     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                     $downloadUrl = $flavorAsset->getDownloadUrl();
                     $localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                     $downloadUrl = $flavorAsset->getDownloadUrl();
                     $notificationData = array("puserId" => $entry->getPuserId(), "entryId" => $entry->getId(), "entryIntId" => $entry->getIntId(), "entryVersion" => $entry->getVersion(), "fileFormat" => $flavorAsset->getFileExt(), "archivedFile" => $localPath, "downoladPath" => $localPath, "conversionQuality" => $entry->getConversionQuality(), "downloadUrl" => $downloadUrl);
                     $extraData = array("data" => json_encode($notificationData), "partner_id" => $entry->getPartnerId(), "puser_id" => $entry->getPuserId(), "entry_id" => $entry->getId(), "entry_int_id" => $entry->getIntId(), "entry_version" => $entry->getVersion(), "file_format" => $flavorAsset->getFileExt(), "archived_file" => $localPath, "downolad_path" => $localPath, "target" => $localPath, "conversion_quality" => $entry->getConversionQuality(), "download_url" => $downloadUrl, "status" => $entry->getStatus(), "abort" => $dbBatchJob->getAbort(), "progress" => $dbBatchJob->getProgress(), "message" => $dbBatchJob->getMessage(), "description" => $dbBatchJob->getDescription(), "updates_count" => $dbBatchJob->getUpdatesCount(), "job_type" => BatchJobType::DOWNLOAD, "status" => BatchJob::BATCHJOB_STATUS_FINISHED, "progress" => 100, "debug" => __LINE__);
                     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_BATCH_JOB_SUCCEEDED, $dbBatchJob, $dbBatchJob->getPartnerId(), null, null, $extraData, $entryId);
                 }
             } else {
                 $jobIsFinished = false;
                 $entry->createDownloadAsset($dbBatchJob, $flavorParamsId, $data->getPuserId());
             }
         }
     }
     if ($jobIsFinished) {
         // mark the job as finished
         $dbBatchJob = kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
     } else {
         // mark the job as almost done
         $dbBatchJob = kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_ALMOST_DONE);
     }
     return $dbBatchJob;
 }
Exemplo n.º 16
0
 /**
  * Add new entry after the file was recored on the server and the token id exists
  *
  * @action addFromRecordedWebcam
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param string $webcamTokenId Token id for the recored webcam file 
  * @return KalturaMediaEntry The new media entry
  * 
  * @throws KalturaErrors::PROPERTY_VALIDATION_MIN_LENGTH
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  */
 function addFromRecordedWebcamAction(KalturaMediaEntry $mediaEntry, $webcamTokenId)
 {
     // check that the webcam file exists
     $content = myContentStorage::getFSContentRootPath();
     $webcamBasePath = $content . "/content/webcam/" . $webcamTokenId;
     // filesync ok
     $entryFullPath = $webcamBasePath . '.flv';
     if (!file_exists($entryFullPath)) {
         throw new KalturaAPIException(KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND);
     }
     $dbEntry = $this->prepareEntryForInsert($mediaEntry);
     $kshowId = $dbEntry->getKshowId();
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::WEBCAM, "entry_media_type" => $dbEntry->getMediaType(), "webcam_suffix" => $webcamTokenId, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
     $token = $this->getKsUniqueString();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     $dbEntry = $insert_entry_helper->getEntry();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $mediaEntry->fromObject($dbEntry);
     return $mediaEntry;
 }
Exemplo n.º 17
0
 protected function updatedVirusScanFinished(BatchJob $dbBatchJob, kVirusScanJobData $data, BatchJob $twinJob = null)
 {
     $flavorAsset = flavorAssetPeer::retrieveById($data->getFlavorAssetId());
     if (!$flavorAsset) {
         KalturaLog::err('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']');
         throw new Exception('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']');
     }
     switch ($data->getScanResult()) {
         case KalturaVirusScanJobResult::FILE_WAS_CLEANED:
         case KalturaVirusScanJobResult::FILE_IS_CLEAN:
             $this->resumeEvents($flavorAsset);
             break;
         case KalturaVirusScanJobResult::FILE_INFECTED:
             $entry = $flavorAsset->getentry();
             if (!$entry) {
                 KalturaLog::err('Entry not found with id [' . $entry->getId() . ']');
             } else {
                 $entry->setStatus(VirusScanPlugin::getEntryStatusCoreValue(VirusScanEntryStatus::INFECTED));
                 $entry->save();
             }
             // delete flavor asset and entry if defined in virus scan profile
             if ($data->getVirusFoundAction() == KalturaVirusFoundAction::CLEAN_DELETE || $data->getVirusFoundAction() == KalturaVirusFoundAction::DELETE) {
                 $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                 KalturaLog::debug('FlavorAsset [' . $flavorAsset->getId() . '] marked as deleted');
                 $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
                 $flavorAsset->setDeletedAt(time());
                 $flavorAsset->save();
                 KalturaLog::debug('Physically deleting file [' . $filePath . ']');
                 unlink($filePath);
                 if ($entry) {
                     myEntryUtils::deleteEntry($entry);
                 }
             } else {
                 $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
                 $flavorAsset->save();
             }
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
             // do not resume flavor asset added event consumption
             break;
     }
     return $dbBatchJob;
 }
Exemplo n.º 18
0
 public function myBatchFlattenServer($script_name)
 {
     $this->script_name = $script_name;
     $this->register($script_name);
     SET_CONTEXT("FS");
     $MAX_ITERATIONS_DUE_TO_PROPEL_MEMORY_LEAK = 10000000;
     self::initDb();
     list($sleep_between_cycles, $number_of_times_to_skip_writing_sleeping) = self::getSleepParams('app_flatten_');
     $last_worker_count = 0;
     $iteration = 0;
     $c = new Criteria();
     $currentDc = kDataCenterMgr::getCurrentDc();
     $c->add(BatchJobPeer::DC, kDataCenterMgr::getCurrentDcId());
     $c->add(BatchJobPeer::JOB_TYPE, BatchJobType::FLATTEN);
     $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PROCESSED);
     $temp_count = 0;
     while (1) {
         self::exitIfDone();
         try {
             sleep($sleep_between_cycles);
             $jobs = BatchJobPeer::doSelect($c);
             foreach ($jobs as $job) {
                 $data = json_decode($job->getData(true), true);
                 $entry_id = $data['entryId'];
                 $entry_int_id = $data['entryIntId'];
                 $entry_version = $data['entryVersion'];
                 $file_format = $data['fileFormat'];
                 $entry = entryPeer::retrieveByPK($entry_id);
                 if (!$entry) {
                     // entry is probably deleted if it is not returned from retrieveByPK
                     // close job as failed
                     $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
                     $job->setDescription("could not retrieve entry, probably deleted");
                     TRACE("could not retrieve entry {$entry_id} , probably deleted");
                     $job->save();
                     continue;
                 }
                 $fileSyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $file_format);
                 $fullFinalPath = kFileSyncUtils::getLocalFilePathForKey($fileSyncKey);
                 $finalPathNoExt = substr($fullFinalPath, 0, strlen($fullFinalPath) - strlen($file_format));
                 myContentStorage::fullMkdir($fullFinalPath);
                 $wildcardFinalPath = $finalPathNoExt . "*";
                 $older_files = glob($wildcardFinalPath);
                 foreach ($older_files as $older_file) {
                     TRACE("removing old file: [{$older_file}]");
                     @unlink($older_file);
                 }
                 TRACE("Downloading: {$fullFinalPath}");
                 kFile::downloadUrlToFile($data["serverUrl"], $fullFinalPath);
                 if (!file_exists($fullFinalPath)) {
                     TRACE("file doesnt exist: " . $data["serverUrl"]);
                     $job->setDescription("file doesnt exist: " . $data["serverUrl"]);
                     $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
                 } else {
                     if (filesize($fullFinalPath) < 100000) {
                         @unlink($fullFinalPath);
                         TRACE("file too small: " . $data["serverUrl"]);
                         $job->setDescription("file too small: " . $data["serverUrl"]);
                         $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
                     } else {
                         if ($data['email']) {
                             $downloadLink = $entry->getDownloadUrl() . '/format/' . $file_format;
                             kJobsManager::addMailJob(null, $entry_id, $entry->getPartnerId(), self::KALTURAS_FLATTEN_READY, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("batch_flatten_video_sender_email"), kConf::get("batch_flatten_video_sender_name"), $data['email'], array($data['email'], $downloadLink));
                         }
                         TRACE("Deleting: " . $data["deleteUrl"]);
                         kFile::downloadUrlToString($data["deleteUrl"]);
                         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
                         $job->setStatus(BatchJob::BATCHJOB_STATUS_FINISHED);
                         $filePath = kFileSyncUtils::getLocalFilePathForKey($fileSyncKey);
                         if (file_exists($filePath)) {
                             try {
                                 kFileSyncUtils::createSyncFileForKey($fileSyncKey);
                             } catch (Exception $ex) {
                                 TRACE("ignore ERROR: " . $ex->getMessage());
                             }
                         } else {
                             TRACE("The file [{$filePath}] doesn't exists, not creating FileSync");
                         }
                     }
                 }
                 $job->save();
             }
         } catch (Exception $ex) {
             TRACE("ERROR: " . $ex->getMessage());
             self::initDb(true);
             self::failed();
         }
         if ($temp_count == 0) {
             TRACE("Ended conversion. sleeping for a while (" . $sleep_between_cycles . " seconds). Will write to the log in (" . $sleep_between_cycles * $number_of_times_to_skip_writing_sleeping . ") seconds");
         }
         $temp_count++;
         if ($temp_count >= $number_of_times_to_skip_writing_sleeping) {
             $temp_count = 0;
         }
     }
 }
 /**
  * add KalturaMediaEntry from email ingestion
  *
  * @action addMediaEntry
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param string $uploadTokenId Upload token id
  * @param int $emailProfId
  * @param string $fromAddress
  * @param string $emailMsgId
  *
  * @return KalturaMediaEntry
  *
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::EMAIL_INGESTION_PROFILE_NOT_FOUND
  *
  */
 function addMediaEntryAction(KalturaMediaEntry $mediaEntry, $uploadTokenId, $emailProfId, $fromAddress, $emailMsgId)
 {
     try {
         // check that the uploaded file exists
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($uploadTokenId);
         if (!file_exists($entryFullPath)) {
             throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
         // get the email profile by the given id
         $existingEIP = EmailIngestionProfilePeer::retrieveByPK($emailProfId);
         if (!$existingEIP) {
             throw new KalturaAPIException(KalturaErrors::EMAIL_INGESTION_PROFILE_NOT_FOUND, $emailProfId);
         }
         $emailIP = new KalturaEmailIngestionProfile();
         $emailIP->fromObject($existingEIP, $this->getResponseProfile());
         // handle defaults for media entry metadata
         $this->changeIfNull($mediaEntry->tags, $emailIP->defaultTags);
         $this->changeIfNull($mediaEntry->adminTags, $emailIP->defaultAdminTags);
         $this->changeIfNull($mediaEntry->conversionProfileId, $emailIP->conversionProfile2Id);
         $this->changeIfNull($mediaEntry->userId, $emailIP->defaultUserId);
         if (is_null($mediaEntry->categories) || is_null(categoryPeer::getByFullNameExactMatch($mediaEntry->categories))) {
             $mediaEntry->categories = $emailIP->defaultCategory;
         }
         // validate the input object
         //$entry->validatePropertyMinLength("name", 1);
         if (!$mediaEntry->name) {
             $mediaEntry->name = $this->getPartnerId() . '_' . time();
         }
         // first copy all the properties to the db entry, then we'll check for security stuff
         $dbEntry = $mediaEntry->toObject(new entry());
         if ($emailIP->moderationStatus == KalturaEntryModerationStatus::PENDING_MODERATION) {
             $dbEntry->setModerate(true);
         }
         $dbEntry->setType(KalturaEntryType::MEDIA_CLIP);
         $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
         $this->checkAndSetValidUserInsert($mediaEntry, $dbEntry);
         $this->checkAdminOnlyInsertProperties($mediaEntry);
         $this->validateAccessControlId($mediaEntry);
         $this->validateEntryScheduleDates($mediaEntry, $dbEntry);
         $dbEntry->setPartnerId($this->getPartnerId());
         $dbEntry->setSubpId($this->getPartnerId() * 100);
         $dbEntry->setSourceId($uploadTokenId);
         $dbEntry->setSourceLink($entryFullPath);
         $dbEntry->setDefaultModerationStatus();
         $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_EMAIL_INGESTION");
         $te->setParam1Str($fromAddress);
         $te->setParam2Str($emailMsgId);
         $te->setParam3Str($emailProfId . '::' . $emailIP->emailAddress . '::' . $emailIP->mailboxId);
         TrackEntry::addTrackEntry($te);
         $kshow = $this->createDummyKShow();
         $kshowId = $kshow->getId();
         myEntryUtils::setEntryTypeAndMediaTypeFromFile($dbEntry, $entryFullPath);
         // setup the needed params for my insert entry helper
         $paramsArray = array("entry_media_source" => KalturaSourceType::FILE, "entry_media_type" => $dbEntry->getMediaType(), "entry_full_path" => $entryFullPath, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
         $token = $this->getKsUniqueString();
         $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
         $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
         $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
         $dbEntry = $insert_entry_helper->getEntry();
         kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
         $mediaEntry->fromObject($dbEntry, $this->getResponseProfile());
         return $mediaEntry;
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
 }
Exemplo n.º 20
0
 /**
  * Add new entry after the file was recored on the server and the token id exists
  *
  * @action addFromRecordedWebcam
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param string $webcamTokenId Token id for the recored webcam file
  * @return KalturaMediaEntry The new media entry
  *
  * @throws KalturaErrors::PROPERTY_VALIDATION_MIN_LENGTH
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  *
  * @deprecated use media.add instead
  */
 function addFromRecordedWebcamAction(KalturaMediaEntry $mediaEntry, $webcamTokenId)
 {
     if ($mediaEntry->conversionQuality && !$mediaEntry->conversionProfileId) {
         $mediaEntry->conversionProfileId = $mediaEntry->conversionQuality;
     }
     // check that the webcam file exists
     $content = myContentStorage::getFSContentRootPath();
     $webcamContentRootDir = $content . "/content/webcam/";
     $webcamBasePath = $webcamContentRootDir . $webcamTokenId;
     // Make sure that the root path of the webcam content is not modified by $webcamTokenId (with the value of "../" for example )
     $webcamContentRootDir = realpath($webcamContentRootDir);
     $webcamBaseRootDir = realpath(dirname($webcamBasePath));
     // Get realpath of target directory
     if (strpos($webcamBaseRootDir, $webcamContentRootDir) !== 0) {
         KalturaLog::err("webcamTokenId [{$webcamTokenId}] points outside of webcam content directory");
         throw new KalturaAPIException(KalturaErrors::INVALID_WEBCAM_TOKEN_ID);
     }
     if (!file_exists("{$webcamBasePath}.flv") && !file_exists("{$webcamBasePath}.f4v") && !file_exists("{$webcamBasePath}.f4v.mp4")) {
         if (kDataCenterMgr::dcExists(1 - kDataCenterMgr::getCurrentDcId())) {
             kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId()));
         }
         throw new KalturaAPIException(KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND);
     }
     $dbEntry = $this->prepareEntryForInsert($mediaEntry);
     $kshowId = $dbEntry->getKshowId();
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::WEBCAM, "entry_media_type" => $dbEntry->getMediaType(), "webcam_suffix" => $webcamTokenId, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
     $token = $this->getKsUniqueString();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     $dbEntry = $insert_entry_helper->getEntry();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $mediaEntry->fromObject($dbEntry, $this->getResponseProfile());
     return $mediaEntry;
 }
Exemplo n.º 21
0
 protected function fixModeration(moderation &$moderation)
 {
     $moderation->setObjectType(moderation::MODERATION_OBJECT_TYPE_ENTRY);
     $entryPartner = $this->getPartner();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_REPORT, $moderation, $entryPartner->getId());
 }
Exemplo n.º 22
0
 /**
  * Delete CategoryEntry
  * 
  * @action delete
  * @param string $entryId
  * @param int $categoryId
  * @throws KalturaErrors::INVALID_ENTRY_ID
  * @throws KalturaErrors::CATEGORY_NOT_FOUND
  * @throws KalturaErrors::CANNOT_REMOVE_ENTRY_FROM_CATEGORY
  * @throws KalturaErrors::ENTRY_IS_NOT_ASSIGNED_TO_CATEGORY
  * 
  */
 function deleteAction($entryId, $categoryId)
 {
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         if (kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
             throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_ID, $entryId);
         }
     }
     $category = categoryPeer::retrieveByPK($categoryId);
     if (!$category && kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $categoryId);
     }
     //validate user is entiteld to remove entry from category
     if (kEntitlementUtils::getEntitlementEnforcement() && $entry->getKuserId() != kCurrentContext::getCurrentKsKuserId() && $entry->getCreatorKuserId() != kCurrentContext::getCurrentKsKuserId()) {
         $kuserIsEntitled = false;
         $kuser = categoryKuserPeer::retrievePermittedKuserInCategory($categoryId, kCurrentContext::getCurrentKsKuserId());
         // First pass: check if kuser is a manager
         if ($kuser) {
             if ($kuser->getPermissionLevel() == CategoryKuserPermissionLevel::MANAGER) {
                 $kuserIsEntitled = true;
             }
         } else {
             $kuser = kuserPeer::retrieveByPK(kCurrentContext::getCurrentKsKuserId());
         }
         // Second pass: check if kuser is a co-publisher
         if (!$kuserIsEntitled && $kuser && $entry->isEntitledKuserPublish($kuser->getKuserId())) {
             $kuserIsEntitled = true;
         }
         if (!$kuserIsEntitled) {
             throw new KalturaAPIException(KalturaErrors::CANNOT_REMOVE_ENTRY_FROM_CATEGORY);
         }
     }
     $dbCategoryEntry = categoryEntryPeer::retrieveByCategoryIdAndEntryId($categoryId, $entryId);
     if (!$dbCategoryEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_IS_NOT_ASSIGNED_TO_CATEGORY);
     }
     $dbCategoryEntry->setStatus(CategoryEntryStatus::DELETED);
     $dbCategoryEntry->save();
     //need to select the entry again - after update
     $entry = entryPeer::retrieveByPK($entryId);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
 }
 public function moderate($new_moderation_status)
 {
     $error_msg = "Moderation status [{$new_moderation_status}] not supported by user object\t";
     switch ($new_moderation_status) {
         case moderation::MODERATION_STATUS_APPROVED:
             throw new Exception($error_msg);
             break;
         case moderation::MODERATION_STATUS_BLOCK:
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_USER_BANNED, $this);
             break;
         case moderation::MODERATION_STATUS_DELETE:
             throw new Exception($error_msg);
             break;
         case moderation::MODERATION_STATUS_PENDING:
             throw new Exception($error_msg);
             break;
         case moderation::MODERATION_STATUS_REVIEW:
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_USER_BANNED, $this);
             //				throw new Exception($error_msg);
             break;
         default:
             throw new Exception($error_msg);
             break;
     }
     $this->save();
 }
Exemplo n.º 24
0
 public static function updateAllMetadataVersionsRelevantForEntry($entry)
 {
     // TODO - null entry
     $kshow = $entry->getKshow();
     if (!$kshow) {
         return null;
     }
     // TODO - null kshow
     $show_entry = $kshow->getShowEntry();
     if (!$show_entry) {
         return null;
     }
     $show_entry->decInCustomData("pending_entries");
     $show_entry->save();
     // entries can be os status ENTRY_STATUS_READY or ENTRY_STATUS_ERROR_CONVERTING
     $status = $entry->getStatus();
     KalturaLog::log("updateAllMetadataVersionsRelevantForEntry [" . $entry->getId() . "] with status [" . $status . "]");
     $metadata = $show_entry->getMetadata();
     if ($metadata) {
         $new_metadata = myMetadataUtils::addEntryToMetadata($metadata, $entry);
         if ($new_metadata) {
             $show_entry->setDataContent($new_metadata);
             $show_entry->save();
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
         }
     }
     KalturaLog::log("updateAllMetadataVersionsRelevantForEntry [" . $entry->getId() . "]  created a new version");
     return true;
 }
 /**
  * Generic add entry using an uploaded file, should be used when the uploaded entry type is not known.
  *
  * @action addFromUploadedFile
  * @param KalturaBaseEntry $entry
  * @param string $uploadTokenId
  * @param KalturaEntryType $type
  * @return KalturaBaseEntry
  */
 function addFromUploadedFileAction(KalturaBaseEntry $entry, $uploadTokenId, $type = -1)
 {
     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);
         }
     }
     // validate the input object
     //$entry->validatePropertyMinLength("name", 1);
     if (!$entry->name) {
         $entry->name = $this->getPartnerId() . '_' . time();
     }
     // first copy all the properties to the db entry, then we'll check for security stuff
     $dbEntry = $entry->toInsertableObject(new entry());
     $dbEntry->setType($type);
     $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
     $this->checkAndSetValidUserInsert($entry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($entry);
     $this->validateAccessControlId($entry);
     $this->validateEntryScheduleDates($entry, $dbEntry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setSourceId($uploadTokenId);
     $dbEntry->setSourceLink($entryFullPath);
     myEntryUtils::setEntryTypeAndMediaTypeFromFile($dbEntry, $entryFullPath);
     $dbEntry->setDefaultModerationStatus();
     // hack due to KCW of version  from KMC
     if (!is_null(parent::getConversionQualityFromRequest())) {
         $dbEntry->setConversionQuality(parent::getConversionQualityFromRequest());
     }
     $dbEntry->save();
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::FILE, "entry_media_type" => $dbEntry->getMediaType(), "entry_full_path" => $entryFullPath, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
     $token = $this->getKsUniqueString();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     $dbEntry = $insert_entry_helper->getEntry();
     kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $entry->fromObject($dbEntry);
     return $entry;
 }
Exemplo n.º 26
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshows_from_db = null;
     // works in one of 2 ways:
     // 1. get no requested name - will create a new kshow and return its details
     // 2. get some name - tries to fetch by name. if already exists - return it
     // get the new properties for the kuser from the request
     $kshow = new kshow();
     $allow_duplicate_names = $this->getP("allow_duplicate_names", true, true);
     if ($allow_duplicate_names === "false" || $allow_duplicate_names === 0) {
         $allow_duplicate_names = false;
     }
     $return_metadata = $this->getP("metadata", false);
     $detailed = $this->getP("detailed", false);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $obj_wrapper = objectWrapperBase::getWrapperClass($kshow, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kshow, "kshow_", $obj_wrapper->getUpdateableFields());
     // check that mandatory fields were set
     // TODO
     $kshow->setName(trim($kshow->getName()));
     // ASSUME - the name is UNIQUE per partner_id !
     if ($kshow->getName()) {
         if (myPartnerUtils::shouldForceUniqueKshow($partner_id, $allow_duplicate_names)) {
             // in this case willsearch for an existing kshow with this name and return with an error if found
             $kshows_from_db = kshowPeer::getKshowsByName(trim($kshow->getName()));
             if ($kshows_from_db) {
                 $kshow_from_db = $kshows_from_db[0];
                 $this->addDebug("already_exists_objects", count($kshows_from_db));
                 $this->addError(APIErrors::DUPLICATE_KSHOW_BY_NAME, $kshow->getName());
                 // This field in unique. Please change ");
                 if (myPartnerUtils::returnDuplicateKshow($partner_id)) {
                     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
                 }
                 return;
             }
         }
     }
     // the first kuser to create this kshow will be it's producer
     $producer_id = $puser_kuser->getKuserId();
     $kshow->setProducerId($producer_id);
     // moved to the update - where there is
     $kshow->setPartnerId($partner_id);
     $kshow->setSubpId($subp_id);
     $kshow->setViewPermissions(kshow::KSHOW_PERMISSION_EVERYONE);
     // by default the permissions should be public
     if ($kshow->getPermissions() === null) {
         $kshow->setPermissions(myPrivilegesMgr::PERMISSIONS_PUBLIC);
     }
     // have to save the kshow before creating the default entries
     $kshow->save();
     $show_entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $producer_id, "&auto_edit.jpg", $kshow->getName());
     // roughcut
     $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_VIDEO, $producer_id);
     // intro
     /*
     		$sample_text = $kshow->getName();
     		$host = requestUtils::getHost();
     */
     $sample_text = "";
     myEntryUtils::modifyEntryMetadataWithText($show_entry, $sample_text, "");
     // set the roughcut to false so the update iwll override with better data
     $kshow->setHasRoughcut(false);
     $kshow->initFromTemplate($producer_id, $sample_text);
     $kshow->save();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_ADD, $kshow);
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow, $level));
     if ($return_metadata) {
         $this->addMsg("metadata", $kshow->getMetadata());
     }
     $this->addDebug("added_fields", $fields_modified);
     if ($kshows_from_db) {
         $this->addDebug("already_exists_objects", count($kshows_from_db));
     }
 }
 private function updateConvertedEntry($ok, $entry, kConversionResult $conv_res)
 {
     $file_before_conversion = $conv_res->conv_cmd->source_file;
     $file_after_conversion = $conv_res->conv_cmd->target_file;
     // TODO -get all targets
     if ($ok == true) {
         // TODO - write all targets not only primary one
         KalturaLog::debug("File [{$file_before_conversion}] converted OK to [{$file_after_conversion}]");
         try {
             // TODO - do we need to create the helpers eagerly ??
             //				$this->createFlvWrappersForTargets( $conv_res );
         } catch (Exception $ex) {
             KalturaLog::debug("Error while creating helper files for [{$file_after_conversion}]");
         }
         $entry->setStatusReady();
     } else {
         KalturaLog::debug("Problem converting file [{$file_before_conversion}]");
         $entry->setStatus(entryStatus::ERROR_CONVERTING);
     }
     $this->updateConversionInDb($entry, $conv_res);
     // loop until the file is really ready - sometimes the size of the file or the mtime is wrong
     for ($i = 0; $i < 15; $i++) {
         clearstatcache();
         if (!file_exists($file_after_conversion) || filesize($file_after_conversion) == 0) {
             //				KalturaLog::debug ( "Entry id [" . $entry->getId() . "] printing file stats: " . print_r( stat ($file_after_conversion ) , true ) );
             KalturaLog::debug("Entry id [" . $entry->getId() . "]. no such file [{$file_after_conversion}]. Sleeping for 1 second for the [{$i}] time.");
             sleep(2);
         } else {
             break;
         }
     }
     KalturaLog::debug("Entry id [" . $entry->getId() . "] setting duration");
     $entry->setLengthInMsecs(kConversionHelper::getFlvDuration($file_after_conversion));
     KalturaLog::debug("Entry id [" . $entry->getId() . "] duration [" . $entry->getLengthInMsecs() . "]");
     // how could it be otherwise ??
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO) {
         // TODO - move out of this function if the partner is required for more configurations
         $partner = PartnerPeer::retrieveByPK($entry->getPartnerId());
         // TODO - make sure the width & height of the target are part of the kConversionReulst
         //			if ( $conversion_info ) $entry->setDimensions ( $conversion_info->video_width , $conversion_info->video_height );
         $offset = $entry->getBestThumbOffset($partner->getDefThumbOffset());
         KalturaLog::debug("Entry id [" . $entry->getId() . "] Thumb offset: [{$offset}]");
         // first create the thumb for the entry
         myEntryUtils::createThumbnailFromEntry($entry, $entry, $offset);
         // 	then make sure it will propage to the roughcut if needed
         myEntryUtils::createRoughcutThumbnailFromEntry($entry, false);
         $entry->updateVideoDimensions();
         KalturaLog::debug("Entry id [" . $entry->getId() . "] dimensions: [" . $entry->getWidth() . "x" . $entry->getHeight() . "]");
     }
     // send notification - regardless its status
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
     $entry->save();
 }
 protected function prepare(KalturaBatchJob $job, KalturaWebcamPrepareJobData $data)
 {
     DbManager::setConfig(kConf::getDB());
     DbManager::initialize();
     $dbEntry = entryPeer::retrieveByPK($job->entryId);
     $webcamTokenId = $data->webcamTokenId;
     $dbEntry->setStatus(entryStatus::PRECONVERT);
     $dbEntry->save();
     // check that the webcam file exists
     $content = myContentStorage::getFSContentRootPath();
     $this->webcam_basePath = $content . "/content/webcam/" . $webcamTokenId;
     $this->entryFullPath = $this->webcam_basePath . '.flv';
     if (!file_exists($this->entryFullPath)) {
         $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
         $dbEntry->save();
         return $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, null, "Error: " . self::MSG_ERROR_FILE_NOT_EXISTS, KalturaBatchJobStatus::FAILED);
     }
     $duration = myFlvStaticHandler::getLastTimestamp($this->entryFullPath);
     $this->fixFlv();
     $kWAMSWebcam = new kWAMSWebcam($this->webcam_basePath);
     if ($kWAMSWebcam->prepare()) {
         $this->entryFullPath = $kWAMSWebcam->getOutputFilePath();
     } else {
         $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
         $dbEntry->save();
         return $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, null, "Error: " . self::MSG_ERROR_WAMS_FAIL, KalturaBatchJobStatus::FAILED);
     }
     $kshowId = $dbEntry->getKshowId();
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::WEBCAM, "entry_media_type" => $dbEntry->getMediaType(), "webcam_suffix" => $webcamTokenId, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags(), "duration" => $duration);
     $token = $this->getClient()->getKs();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($job->partnerId, $job->partnerId * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     return $this->closeJob($job, null, null, '', KalturaBatchJobStatus::FINISHED, $data);
 }
Exemplo n.º 29
0
 public function moderate($new_moderation_status, $fix_moderation_objects = false)
 {
     $error_msg = "Moderation status [{$new_moderation_status}] not supported by entry";
     switch ($new_moderation_status) {
         case moderation::MODERATION_STATUS_APPROVED:
             // a new notification that is sent when an entry was founc to be ok after moderation
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $this);
             break;
         case moderation::MODERATION_STATUS_BLOCK:
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_BLOCK, $this->getid());
             break;
         case moderation::MODERATION_STATUS_DELETE:
             // physical disk deletion
             myEntryUtils::deleteEntry($this);
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_BLOCK, $this->getid());
             break;
         case moderation::MODERATION_STATUS_PENDING:
             //				$this->setStatus(entryStatus::MODERATE);
             //				throw new Exception($error_msg);
             break;
         case moderation::MODERATION_STATUS_REVIEW:
             // in this case the status of the entry should not change
             //				throw new Exception($error_msg);
             break;
         default:
             throw new Exception($error_msg);
             break;
     }
     $this->setModerationStatus($new_moderation_status);
     // TODO - fix loop of updating from entry ot moderation back to entry ...
     if ($fix_moderation_objects) {
         myModerationMgr::updateModerationsForObject($this, $new_moderation_status);
     }
     $this->save();
 }
Exemplo n.º 30
0
 public static function deleteEntry(entry $entry, $partner_id = null)
 {
     if ($entry->getStatus() == entryStatus::DELETED || $entry->getStatus() == entryStatus::BLOCKED) {
         return;
     }
     // don't do this twice !
     KalturaLog::log("myEntryUtils::delete Entry [" . $entry->getId() . "] Partner [" . $entry->getPartnerId() . "]");
     kJobsManager::abortEntryJobs($entry->getId());
     $media_type = $entry->getMediaType();
     $need_to_fix_roughcut = false;
     $thumb_template_file = "&deleted_image.jpg";
     KalturaLog::log("media type [{$media_type}]");
     switch ($media_type) {
         case entry::ENTRY_MEDIA_TYPE_AUDIO:
             $template_file = "&deleted_audio.flv";
             $need_to_fix_roughcut = true;
             break;
         case entry::ENTRY_MEDIA_TYPE_IMAGE:
             $template_file = "&deleted_image.jpg";
             $need_to_fix_roughcut = false;
             // no need to add a batch job for images
             break;
         case entry::ENTRY_MEDIA_TYPE_VIDEO:
             $template_file = "&deleted_video.flv";
             $need_to_fix_roughcut = true;
             break;
         case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_FLASH:
         case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_WINDOWS_MEDIA:
         case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_REAL_MEDIA:
         case entry::ENTRY_MEDIA_TYPE_LIVE_STREAM_QUICKTIME:
             kJobsManager::addProvisionDeleteJob(null, $entry);
             break;
         case entry::ENTRY_MEDIA_TYPE_SHOW:
         default:
             $template_file = "&deleted_rc.xml";
             $need_to_fix_roughcut = false;
             break;
     }
     // in this case we'll need some batch job to fix all related roughcuts for this entry
     // use the batch_job mechanism to indicate there is a deleted entry to handle
     if ($need_to_fix_roughcut) {
         //			Should use a different job type
         //			BatchJob::createDeleteEntryJob ( $entry );
     }
     $entry->putInCustomData("deleted_original_data", $entry->getData());
     $entry->putInCustomData("deleted_original_thumb", $entry->getThumbnail());
     $content_path = myContentStorage::getFSContentRootPath();
     //		Remarked by Tan-Tan 27/09/2010
     //		Handled by kObjectDeleteHandler
     //		$currentDataKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); // replaced__getDataPath
     //		$currentDataEditKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT); // replaced__getDataPathEdit
     //		$currentThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB); // replaced__getThumbnailPath
     $entry->setData($entry->getData());
     // once to increment the verions
     $entry->setData($template_file);
     // the other to set the template
     $entry->setThumbnail($entry->getThumbnail());
     // once to increment the verions
     $entry->setThumbnail($thumb_template_file);
     // the other to set the template
     //		Remarked by Tan-Tan 27/09/2010
     //		Handled by kObjectDeleteHandler
     //		// move file so there will be no access to it
     //		$deleted_content = kFileSyncUtils::deleteSyncFileForKey($currentDataKey);
     //		$deleted_content .= "|" . kFileSyncUtils::deleteSyncFileForKey($currentDataEditKey,false); // for some entries there may not be an edit version
     //		$deleted_content .= "|" . kFileSyncUtils::deleteSyncFileForKey($currentThumbKey,false); // for some entries (empty mix / audio) there may not be a thumb FileSync
     //		Remarked by Tan-Tan 27/09/2010
     //		$deleted_content is always null anyway
     //		$entry->putInCustomData( "deleted_file_path" , $deleted_content ? $deleted_content : serialize($currentDataKey) ) ;
     $entry->setStatus(entryStatus::DELETED);
     $entry->setCategories("");
     // make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE
     $entry->setModerationStatus(moderation::MODERATION_STATUS_DELETE);
     $entry->setModifiedAt(time());
     $entry->save();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE, $entry, null, null, null, null, $entry->getId());
 }