本文整理匯總了PHP中asset::setStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP asset::setStatus方法的具體用法?PHP asset::setStatus怎麽用?PHP asset::setStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類asset
的用法示例。
在下文中一共展示了asset::setStatus方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addImportJob
public static function addImportJob(BatchJob $parentJob = null, $entryId, $partnerId, $entryUrl, asset $asset = null, $subType = null, kImportJobData $jobData = null, $keepCurrentVersion = false)
{
$entryUrl = str_replace('//', '/', $entryUrl);
$entryUrl = preg_replace('/^((https?)|(ftp)|(scp)|(sftp)):\\//', '$1://', $entryUrl);
if (is_null($subType)) {
if (stripos($entryUrl, 'sftp:') === 0) {
$subType = kFileTransferMgrType::SFTP;
} elseif (stripos($entryUrl, 'scp:') === 0) {
$subType = kFileTransferMgrType::SCP;
} elseif (stripos($entryUrl, 'ftp:') === 0) {
$subType = kFileTransferMgrType::FTP;
} elseif (stripos($entryUrl, 'https:') === 0) {
$subType = kFileTransferMgrType::HTTPS;
} else {
$subType = kFileTransferMgrType::HTTP;
}
}
if (!$jobData) {
$jobData = new kImportJobData();
}
$jobData->setSrcFileUrl($entryUrl);
if ($asset) {
if ($keepCurrentVersion) {
if (!$asset->isLocalReadyStatus()) {
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_IMPORTING);
}
} else {
$asset->incrementVersion();
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_IMPORTING);
}
$asset->save();
$jobData->setFlavorAssetId($asset->getId());
}
$entry = entryPeer::retrieveByPK($entryId);
if ($entry) {
$higherStatuses = array(entryStatus::PRECONVERT, entryStatus::READY);
if (!in_array($entry->getStatus(), $higherStatuses)) {
$entry->setStatus(entryStatus::IMPORT);
$entry->save();
}
}
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild(BatchJobType::IMPORT, $subType);
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entryId);
$batchJob->setPartnerId($partnerId);
}
$batchJob->setObjectId($jobData->getFlavorAssetId());
$batchJob->setObjectType(BatchJobObjectType::ASSET);
return self::addJob($batchJob, $jobData, BatchJobType::IMPORT, $subType);
}