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()); }