本文整理汇总了PHP中asset::incrementVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP asset::incrementVersion方法的具体用法?PHP asset::incrementVersion怎么用?PHP asset::incrementVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asset
的用法示例。
在下文中一共展示了asset::incrementVersion方法的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);
}