本文整理匯總了PHP中myEntryUtils::deleteEntry方法的典型用法代碼示例。如果您正苦於以下問題:PHP myEntryUtils::deleteEntry方法的具體用法?PHP myEntryUtils::deleteEntry怎麽用?PHP myEntryUtils::deleteEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類myEntryUtils
的用法示例。
在下文中一共展示了myEntryUtils::deleteEntry方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteObject
function deleteObject(FileSync $fileSync)
{
$object = kFileSyncUtils::retrieveObjectForFileSync($fileSync);
$key = $object->getSyncKey($fileSync->getObjectSubType());
if ($key->version != $fileSync->getVersion()) {
return;
}
switch ($fileSync->getObjectType()) {
case FileSyncObjectType::UICONF:
$object->setStatus(uiConf::UI_CONF_STATUS_DELETED);
$object->save();
break;
case FileSyncObjectType::ENTRY:
myEntryUtils::deleteEntry($object);
try {
$wrapper = objectWrapperBase::getWrapperClass($object);
$wrapper->removeFromCache("entry", $object->getId());
} catch (Exception $e) {
KalturaLog::err($e);
}
break;
case FileSyncObjectType::ASSET:
$object->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$object->setDeletedAt(time());
$object->save();
break;
case FileSyncObjectType::METADATA:
$object->setStatus(Metadata::STATUS_DELETED);
$object->save();
break;
default:
return;
}
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_LINK) {
return;
}
$criteria = new Criteria();
$criteria->add(FileSyncPeer::DC, $fileSync->getDc());
$criteria->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_LINK);
$criteria->add(FileSyncPeer::LINKED_ID, $fileSync->getId());
$links = FileSyncPeer::doSelect($criteria);
foreach ($links as $link) {
deleteObject($link);
}
}
示例2: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$prefix = $this->getObjectPrefix();
$entry_id_to_delete = $this->getPM("{$prefix}_id");
$kshow_id_for_entry_id_to_delete = $this->getP("kshow_id");
$c = $this->getCriteria();
if ($c == null) {
$entry_to_delete = entryPeer::retrieveByPK($entry_id_to_delete);
} else {
$entry_to_delete = entryPeer::doSelectOne($c);
}
if (!$entry_to_delete) {
$this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id_to_delete);
return;
}
if ($kshow_id_for_entry_id_to_delete != null) {
// match the kshow_id
if ($kshow_id_for_entry_id_to_delete != $entry_to_delete->getKshowId()) {
$this->addError(APIErrors::CANNOT_DELETE_ENTRY, $entry_id_to_delete, $kshow_id_for_entry_id_to_delete);
return;
}
}
myEntryUtils::deleteEntry($entry_to_delete);
/*
All move into myEntryUtils::deleteEntry
$entry_to_delete->setStatus ( entryStatus::DELETED );
// make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE
$entry_to_delete->setModerationStatus ( moderation::MODERATION_STATUS_DELETE );
$entry_to_delete->setModifiedAt( time() ) ;
$entry_to_delete->save();
myNotificationMgr::createNotification( kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE , $entry_to_delete );
*/
$this->addMsg("deleted_" . $prefix, objectWrapperBase::getWrapperClass($entry_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR));
}
示例3: deleteEntry
protected function deleteEntry($entryId, $entryType = null)
{
$entryToDelete = entryPeer::retrieveByPK($entryId);
if (!$entryToDelete || $entryType !== null && $entryToDelete->getType() != $entryType) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
myEntryUtils::deleteEntry($entryToDelete);
try {
$wrapper = objectWrapperBase::getWrapperClass($entryToDelete);
$wrapper->removeFromCache("entry", $entryToDelete->getId());
} catch (Exception $e) {
KalturaLog::err($e);
}
}
示例4: updatedVirusScanFinished
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;
}
示例5: replaceEntry
//.........這裏部分代碼省略.........
}
if ($newAsset->getFlavorParamsId() || $newAsset instanceof flavorAsset) {
$newAssets[$newAsset->getType()][$newAsset->getFlavorParamsId()] = $newAsset;
KalturaLog::info("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
} else {
$newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
KalturaLog::info("Added new asset [" . $newAsset->getId() . "] with no asset params");
}
}
$defaultThumbAssetNew = null;
$defaultThumbAssetOld = null;
foreach ($oldAssets as $oldAsset) {
/* @var $oldAsset asset */
//If the newAssets map contains an asset of the same type and paramsId as the current old asset,
// re-link the old asset to the new asset.
if (isset($newAssets[$oldAsset->getType()]) && isset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()])) {
$newAsset = $newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()];
if ($oldAsset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) {
$newAsset->addTags(array(assetParams::TAG_RECORDING_ANCHOR));
}
/* @var $newAsset asset */
KalturaLog::info("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->linkFromAsset($newAsset);
$oldAsset->save();
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_MPD);
$newFlavorMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($newAsset->getId());
if ($newFlavorMediaInfo) {
$oldFlavorNewMediaInfo = $newFlavorMediaInfo->copy();
$oldFlavorNewMediaInfo->setFlavorAssetId($oldAsset->getId());
$oldFlavorNewMediaInfo->setFlavorAssetVersion($oldAsset->getVersion());
$oldFlavorNewMediaInfo->save();
}
unset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()]);
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $oldAsset;
KalturaLog::info("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
}
} elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
if ($oldAsset instanceof thumbAsset && $oldAsset->keepOnEntryReplacement()) {
KalturaLog::info("KeepManualThumbnails ind is set, manual thumbnail is not deleted [" . $oldAsset->getId() . "]");
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetOld = $oldAsset;
}
} else {
KalturaLog::info("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$oldAsset->setDeletedAt(time());
$oldAsset->save();
}
}
}
foreach ($newAssets as $newAssetsByTypes) {
foreach ($newAssetsByTypes as $newAsset) {
$createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
KalturaLog::info("Copied from new asset [" . $newAsset->getId() . "] to copied asset [" . $createdAsset->getId() . "] for flavor [" . $newAsset->getFlavorParamsId() . "]");
if ($createdAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $newAsset;
KalturaLog::info("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
}
}
}
if ($defaultThumbAssetOld) {
KalturaLog::info("Kepping ThumbAsset [" . $defaultThumbAssetOld->getId() . "] as the default ThumbAsset");
} elseif ($defaultThumbAssetNew) {
kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
KalturaLog::info("Setting ThumbAsset [" . $defaultThumbAssetNew->getId() . "] as the default ThumbAsset");
} else {
KalturaLog::info("No default ThumbAsset found for replacing entry [" . $tempEntry->getId() . "]");
$entry->setThumbnail(".jpg");
// thumbnailversion++
$entry->save();
$tempEntrySyncKey = $tempEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
$realEntrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
kFileSyncUtils::createSyncFileLinkForKey($realEntrySyncKey, $tempEntrySyncKey);
}
self::createIsmManifestFileSyncLinkFromReplacingEntry($tempEntry, $entry);
$entry->setDimensions($tempEntry->getWidth(), $tempEntry->getHeight());
$entry->setLengthInMsecs($tempEntry->getLengthInMsecs());
$entry->setConversionProfileId($tempEntry->getConversionProfileId());
$entry->setConversionQuality($tempEntry->getConversionQuality());
$entry->setReplacingEntryId(null);
$entry->setReplacementStatus(entryReplacementStatus::NONE);
$entry->setReplacementOptions(null);
$entry->setStatus($tempEntry->getStatus());
$entry->save();
//flush deffered events to re-index sphinx before temp entry deletion
kEventsManager::flushEvents();
kBusinessConvertDL::checkForPendingLiveClips($entry);
kEventsManager::raiseEvent(new kObjectReplacedEvent($entry, $tempEntry));
myEntryUtils::deleteEntry($tempEntry, null, true);
$te = new TrackEntry();
$te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_REPLACED_ENTRY);
$te->setEntryId($entry->getId());
$te->setParam1Str($tempEntry->getId());
$te->setDescription(__METHOD__ . "[" . __LINE__ . "]");
TrackEntry::addTrackEntry($te);
}
示例6: deleteErrorEntries
protected static function deleteErrorEntries()
{
$criteria = new Criteria();
$criteria->add(entryPeer::STATUS, array(entryStatus::READY, entryStatus::DELETED), Criteria::NOT_IN);
$criteria->add(entryPeer::UPDATED_AT, self::$errObjectsUpdatedAt, Criteria::LESS_THAN);
$criteria->addSelectColumn('UNIX_TIMESTAMP(MIN(' . entryPeer::UPDATED_AT . '))');
$stmt = entryPeer::doSelectStmt($criteria);
$mins = $stmt->fetchAll(PDO::FETCH_COLUMN);
if (!count($mins)) {
return;
}
$errObjectsUpdatedAtStart = reset($mins);
if (is_null($errObjectsUpdatedAtStart)) {
return;
}
$errObjectsUpdatedAtEnd = min(self::$errObjectsUpdatedAt, $errObjectsUpdatedAtStart + 60 * 60 * 24 * 30);
// month
$criteria = new Criteria();
$criteria->add(entryPeer::STATUS, array(entryStatus::READY, entryStatus::DELETED), Criteria::NOT_IN);
$criteria->add(entryPeer::UPDATED_AT, $errObjectsUpdatedAtStart, Criteria::GREATER_EQUAL);
$criteria->addAnd(entryPeer::UPDATED_AT, $errObjectsUpdatedAtEnd, Criteria::LESS_THAN);
$criteria->addDescendingOrderByColumn(entryPeer::LENGTH_IN_MSECS);
$criteria->setLimit(self::$queryLimit);
$entries = entryPeer::doSelect($criteria);
foreach ($entries as $entry) {
/* @var $entry entry */
KalturaLog::info("Deleting entry [" . $entry->getId() . "]");
try {
myEntryUtils::deleteEntry($entry);
} catch (Exception $e) {
KalturaLog::err($e);
}
}
self::incrementSummary('entry', count($entries));
kMemoryManager::clearMemory();
}
示例7: deleteEntry
protected function deleteEntry($entryId, $entryType = null)
{
$entryToDelete = entryPeer::retrieveByPK($entryId);
if (!$entryToDelete || $entryType !== null && $entryToDelete->getType() != $entryType) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$this->checkIfUserAllowedToUpdateEntry($entryToDelete);
myEntryUtils::deleteEntry($entryToDelete);
/*
All move into myEntryUtils::deleteEntry
$entryToDelete->setStatus(entryStatus::DELETED);
KalturaLog::log("KalturaEntryService::delete Entry [$entryId] Partner [" . $entryToDelete->getPartnerId() . "]");
// make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE
$entryToDelete->setModerationStatus(moderation::MODERATION_STATUS_DELETE);
$entryToDelete->setModifiedAt(time());
$entryToDelete->save();
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE, $entryToDelete);
*/
$wrapper = objectWrapperBase::getWrapperClass($entryToDelete);
$wrapper->removeFromCache("entry", $entryToDelete->getId());
}
示例8: handleEntryReplacement
/**
* @param entry $tempEntry
*/
public static function handleEntryReplacement(entry $tempEntry)
{
$entry = entryPeer::retrieveByPK($tempEntry->getReplacedEntryId());
if (!$entry) {
KalturaLog::err("Real entry id [" . $tempEntry->getReplacedEntryId() . "] not found");
myEntryUtils::deleteEntry($tempEntry, null, true);
return;
}
if ($tempEntry->getStatus() == entryStatus::ERROR_CONVERTING) {
$entry->setReplacementStatus(entryReplacementStatus::FAILED);
$entry->save();
// NOTE: KalturaEntryService::cancelReplace() must be used to reset this status and delete the temp entry
return;
}
switch ($entry->getReplacementStatus()) {
case entryReplacementStatus::APPROVED_BUT_NOT_READY:
KalturaLog::log("status changed to ready");
kEventsManager::raiseEventDeferred(new kObjectReadyForReplacmentEvent($tempEntry));
break;
case entryReplacementStatus::READY_BUT_NOT_APPROVED:
break;
case entryReplacementStatus::NOT_READY_AND_NOT_APPROVED:
$entry->setReplacementStatus(entryReplacementStatus::READY_BUT_NOT_APPROVED);
$entry->save();
break;
case entryReplacementStatus::FAILED:
// Do nothing. KalturaEntryService::cancelReplace() will be used to delete the entry.
break;
case entryReplacementStatus::NONE:
default:
KalturaLog::err("Real entry id [" . $tempEntry->getReplacedEntryId() . "] replacement canceled");
myEntryUtils::deleteEntry($tempEntry, null, true);
break;
}
}
示例9: moderate
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();
}
示例10: replaceEntry
//.........這裏部分代碼省略.........
//If doesn't exist - create a new array for the current asset's type.
if (!isset($newAssets[$newAsset->getType()])) {
$newAssets[$newAsset->getType()] = array();
}
if ($newAsset->getFlavorParamsId() || $newAsset instanceof flavorAsset) {
$newAssets[$newAsset->getType()][$newAsset->getFlavorParamsId()] = $newAsset;
KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
} else {
$newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] with no asset params");
}
}
$saveEntry = false;
$defaultThumbAssetNew = null;
foreach ($oldAssets as $oldAsset) {
/* @var $oldAsset asset */
kFileSyncUtils::clearWAMSDataForKey($oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
//If the newAssets map contains an asset of the same type and paramsId as the current old asset,
// re-link the old asset to the new asset.
if (isset($newAssets[$oldAsset->getType()]) && isset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()])) {
$newAsset = $newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()];
/* @var $newAsset asset */
KalturaLog::debug("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
if ($oldAsset instanceof flavorAsset) {
$oldAsset->setBitrate($newAsset->getBitrate());
$oldAsset->setFrameRate($newAsset->getFrameRate());
$oldAsset->setVideoCodecId($newAsset->getVideoCodecId());
}
$oldAsset->setWidth($newAsset->getWidth());
$oldAsset->setHeight($newAsset->getHeight());
$oldAsset->setContainerFormat($newAsset->getContainerFormat());
$oldAsset->setSize($newAsset->getSize());
$oldAsset->setFileExt($newAsset->getFileExt());
$oldAsset->setTags($newAsset->getTags());
$oldAsset->setDescription($newAsset->getDescription());
$oldAsset->incrementVersion();
$oldAsset->setStatusLocalReady();
$oldAsset->save();
$oldFileSync = $oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$newFileSync = $newAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::createSyncFileLinkForKey($oldFileSync, $newFileSync);
$newFlavorMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($newAsset->getId());
if ($newFlavorMediaInfo) {
$oldFlavorNewMediaInfo = $newFlavorMediaInfo->copy();
$oldFlavorNewMediaInfo->setFlavorAssetId($oldAsset->getId());
$oldFlavorNewMediaInfo->setFlavorAssetVersion($oldAsset->getVersion());
$oldFlavorNewMediaInfo->save();
}
unset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()]);
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $oldAsset;
KalturaLog::debug("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
}
} elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
KalturaLog::debug("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->setStatus(flavorAsset::ASSET_STATUS_DELETED);
$oldAsset->setDeletedAt(time());
$oldAsset->save();
$entry->removeFlavorParamsId($oldAsset->getFlavorParamsId());
$saveEntry = true;
}
}
foreach ($newAssets as $newAssetsByTypes) {
foreach ($newAssetsByTypes as $newAsset) {
$createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
KalturaLog::debug("Copied from new asset [" . $newAsset->getId() . "] to copied asset [" . $createdAsset->getId() . "] for flavor [" . $newAsset->getFlavorParamsId() . "]");
if ($createdAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $newAsset;
KalturaLog::debug("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
}
}
}
if ($defaultThumbAssetNew) {
kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
kalturalog::debug("Setting ThumbAsset [" . $defaultThumbAssetNew->getId() . "] as the default ThumbAsset");
} else {
kalturalog::debug("No default ThumbAsset found for replacing entry [" . $tempEntry->getId() . "]");
$entry->setThumbnail(".jpg");
// thumbnailversion++
$entry->save();
$tempEntrySyncKey = $tempEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
$realEntrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
kFileSyncUtils::createSyncFileLinkForKey($realEntrySyncKey, $tempEntrySyncKey);
}
$entry->setDimensions($tempEntry->getWidth(), $tempEntry->getHeight());
$entry->setLengthInMsecs($tempEntry->getLengthInMsecs());
$entry->setConversionProfileId($tempEntry->getConversionProfileId());
$entry->setConversionQuality($tempEntry->getConversionQuality());
$entry->setReplacingEntryId(null);
$entry->setReplacementStatus(entryReplacementStatus::NONE);
$entry->setStatus($tempEntry->getStatus());
$entry->save();
myEntryUtils::deleteEntry($tempEntry, null, true);
$te = new TrackEntry();
$te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_REPLACED_ENTRY);
$te->setEntryId($entry->getId());
$te->setParam1Str($tempEntry->getId());
$te->setDescription(__METHOD__ . "[" . __LINE__ . "]");
TrackEntry::addTrackEntry($te);
}
示例11: updatedJob
public function updatedJob(BatchJob $dbBatchJob)
{
$dbBatchJobLock = $dbBatchJob->getBatchJobLock();
try {
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED || $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FATAL) {
kJobsManager::abortChildJobs($dbBatchJob);
}
$jobType = $dbBatchJob->getJobType();
switch ($jobType) {
case BatchJobType::IMPORT:
$dbBatchJob = $this->updatedImport($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::EXTRACT_MEDIA:
$dbBatchJob = $this->updatedExtractMedia($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::CONVERT:
$dbBatchJob = $this->updatedConvert($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::POSTCONVERT:
$dbBatchJob = $this->updatedPostConvert($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::BULKUPLOAD:
$dbBatchJob = $this->updatedBulkUpload($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::CONVERT_PROFILE:
$dbBatchJob = $this->updatedConvertProfile($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::BULKDOWNLOAD:
$dbBatchJob = $this->updatedBulkDownload($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::PROVISION_PROVIDE:
$dbBatchJob = $this->updatedProvisionProvide($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::PROVISION_DELETE:
$dbBatchJob = $this->updatedProvisionDelete($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::CONVERT_COLLECTION:
$dbBatchJob = $this->updatedConvertCollection($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::STORAGE_EXPORT:
$dbBatchJob = $this->updatedStorageExport($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::MOVE_CATEGORY_ENTRIES:
$dbBatchJob = $this->updatedMoveCategoryEntries($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::STORAGE_DELETE:
$dbBatchJob = $this->updatedStorageDelete($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::CAPTURE_THUMB:
$dbBatchJob = $this->updatedCaptureThumb($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::DELETE_FILE:
$dbBatchJob = $this->updatedDeleteFile($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::INDEX:
$dbBatchJob = $this->updatedIndex($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::COPY:
$dbBatchJob = $this->updatedCopy($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::DELETE:
$dbBatchJob = $this->updatedDelete($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::CONCAT:
$dbBatchJob = $this->updatedConcat($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::CONVERT_LIVE_SEGMENT:
$dbBatchJob = $this->updatedConvertLiveSegment($dbBatchJob, $dbBatchJob->getData());
break;
case BatchJobType::LIVE_REPORT_EXPORT:
$dbBatchJob = $this->updatedLiveReportExport($dbBatchJob, $dbBatchJob->getData());
break;
default:
break;
}
if ($dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_RETRY) {
if ($dbBatchJobLock && $dbBatchJobLock->getExecutionAttempts() >= BatchJobLockPeer::getMaxExecutionAttempts($jobType)) {
$dbBatchJob = kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FAILED);
}
}
if (in_array($dbBatchJob->getStatus(), BatchJobPeer::getClosedStatusList())) {
$jobEntry = $dbBatchJob->getEntry();
if ($jobEntry && $jobEntry->getMarkedForDeletion()) {
myEntryUtils::deleteEntry($jobEntry, null, true);
}
}
} catch (Exception $ex) {
self::alert($dbBatchJob, $ex);
KalturaLog::err("Error:" . $ex->getMessage());
}
return true;
}
示例12: cancelReplaceAction
/**
* Cancels media replacement
*
* @action cancelReplace
* @param string $entryId Media entry id to cancel
* @return KalturaMediaEntry The canceled media entry
*
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
*/
function cancelReplaceAction($entryId)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::MEDIA_CLIP) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
if ($dbEntry->getReplacingEntryId()) {
$dbTempEntry = entryPeer::retrieveByPK($dbEntry->getReplacingEntryId());
if ($dbTempEntry) {
myEntryUtils::deleteEntry($dbTempEntry);
}
}
$dbEntry->setReplacingEntryId(null);
$dbEntry->setReplacementStatus(entryReplacementStatus::NONE);
$dbEntry->save();
return $this->getEntry($entryId, -1, KalturaEntryType::MEDIA_CLIP);
}
示例13: handleEntryReplacement
/**
* @param entry $tempEntry
*/
public static function handleEntryReplacement(entry $tempEntry)
{
KalturaLog::debug("Handling temp entry id [" . $tempEntry->getId() . "] for real entry id [" . $tempEntry->getReplacedEntryId() . "]");
$entry = entryPeer::retrieveByPK($tempEntry->getReplacedEntryId());
if (!$entry) {
KalturaLog::err("Real entry id [" . $tempEntry->getReplacedEntryId() . "] not found");
myEntryUtils::deleteEntry($tempEntry, null, true);
return;
}
switch ($entry->getReplacementStatus()) {
case entryReplacementStatus::APPROVED_BUT_NOT_READY:
KalturaLog::debug("status changed to ready");
kEventsManager::raiseEventDeferred(new kObjectReadyForReplacmentEvent($tempEntry));
break;
case entryReplacementStatus::READY_BUT_NOT_APPROVED:
break;
case entryReplacementStatus::NOT_READY_AND_NOT_APPROVED:
$entry->setReplacementStatus(entryReplacementStatus::READY_BUT_NOT_APPROVED);
$entry->save();
break;
case entryReplacementStatus::NONE:
default:
KalturaLog::err("Real entry id [" . $tempEntry->getReplacedEntryId() . "] replacement canceled");
myEntryUtils::deleteEntry($tempEntry, null, true);
break;
}
}
示例14: set_time_limit
if ($argc != 2) {
echo "Arguments missing.\n\n";
echo "Usage: php removePartnerEntries.php {partner id}\n";
exit;
}
$partnerId = $argv[1];
set_time_limit(0);
ini_set("memory_limit", "1024M");
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../'));
require_once ROOT_DIR . '/infra/bootstrap_base.php';
require_once ROOT_DIR . '/infra/KAutoloader.php';
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "metadata", "*"));
KAutoloader::setClassMapFilePath('../cache/classMap.cache');
KAutoloader::register();
error_reporting(E_ALL);
KalturaLog::setLogger(new KalturaStdoutLogger());
$typesToDelete = array(entryType::DATA, entryType::DOCUMENT);
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
$c->add(entryPeer::PARTNER_ID, $partnerId);
$c->add(entryPeer::TYPE, $typesToDelete, Criteria::IN);
$entries = entryPeer::doSelect($c);
foreach ($entries as $entry) {
KalturaLog::debug("Deletes entry [" . $entry->getId() . "]");
myEntryUtils::deleteEntry($entry, $partnerId);
}
KalturaLog::debug("Done");
示例15: time
$updatedAt = time() - $daysOld * 24 * 60 * 60;
chdir(dirname(__FILE__));
require_once dirname(__FILE__) . '/../bootstrap.php';
$typesToDelete = array();
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
$c->add(entryPeer::PARTNER_ID, 100, Criteria::GREATER_THAN);
$c->add(entryPeer::UPDATED_AT, $updatedAt, Criteria::LESS_THAN);
if (count($typesToDelete)) {
$c->add(entryPeer::TYPE, $typesToDelete, Criteria::IN);
}
$count = 0;
$entries = entryPeer::doSelect($c);
while ($entries) {
$count += count($entries);
foreach ($entries as $entry) {
kCurrentContext::$ks_partner_id = $entry->getPartnerId();
kCurrentContext::$partner_id = $entry->getPartnerId();
kCurrentContext::$master_partner_id = $entry->getPartnerId();
KalturaLog::debug("Deletes entry [" . $entry->getId() . "]");
KalturaStatement::setDryRun($dryRun);
myEntryUtils::deleteEntry($entry, $entry->getPartnerId());
KalturaStatement::setDryRun(false);
}
kEventsManager::flushEvents();
kMemoryManager::clearMemory();
$entries = entryPeer::doSelect($c);
}
KalturaLog::debug("Deleted [{$count}] entries");