本文整理匯總了PHP中FileSyncPeer::doSelectOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSyncPeer::doSelectOne方法的具體用法?PHP FileSyncPeer::doSelectOne怎麽用?PHP FileSyncPeer::doSelectOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileSyncPeer
的用法示例。
在下文中一共展示了FileSyncPeer::doSelectOne方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: objectAdded
/**
* @param BaseObject $object
* @return bool true if should continue to the next consumer
*/
public function objectAdded(BaseObject $object)
{
if (!$object instanceof FileSync || $object->getStatus() != FileSync::FILE_SYNC_STATUS_PENDING || $object->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_FILE || $object->getDc() == kDataCenterMgr::getCurrentDcId()) {
return true;
}
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $object->getObjectId());
$c->addAnd(FileSyncPeer::VERSION, $object->getVersion());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $object->getObjectType());
$c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $object->getObjectSubType());
$c->addAnd(FileSyncPeer::ORIGINAL, '1');
$original_filesync = FileSyncPeer::doSelectOne($c);
if (!$original_filesync) {
KalturaLog::err('Original filesync not found for object_id[' . $object->getObjectId() . '] version[' . $object->getVersion() . '] type[' . $object->getObjectType() . '] subtype[' . $object->getObjectSubType() . ']');
return true;
}
$sourceFileUrl = $original_filesync->getExternalUrl();
if (!$sourceFileUrl) {
KalturaLog::err('External URL not found for filesync id [' . $object->getId() . ']');
return true;
}
$job = kMultiCentersManager::addFileSyncImportJob($this->getEntryId($object), $object->getPartnerId(), $object->getId(), $sourceFileUrl);
$job->setDc($object->getDc());
$job->save();
return true;
}
示例2: getOriginalFileSync
protected static function getOriginalFileSync($fileSync)
{
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $fileSync->getObjectId());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $fileSync->getObjectType());
$c->addAnd(FileSyncPeer::VERSION, $fileSync->getVersion());
$c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $fileSync->getObjectSubType());
$c->addAnd(FileSyncPeer::DC, $fileSync->getOriginalDc());
return FileSyncPeer::doSelectOne($c);
}
示例3: isPendingExport
public function isPendingExport(FileSyncKey $key)
{
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::DC, $this->getId(), Criteria::EQUAL);
$fileSync = FileSyncPeer::doSelectOne($c);
if (!$fileSync) {
return false;
}
return $fileSync->getStatus() == FileSync::FILE_SYNC_STATUS_PENDING;
}
示例4: wasFileSyncLimitationReached
public static function wasFileSyncLimitationReached($object_id, $version, $object_type, $object_sub_type)
{
if ($version > self::FILE_SYNC_MIN_VERSION_VALIDATE) {
$queryVersion = $version - self::FILE_SYNC_MIN_VERSION_VALIDATE;
$c = new Criteria();
$c->add(FileSyncPeer::OBJECT_ID, $object_id);
$c->add(FileSyncPeer::OBJECT_TYPE, $object_type);
$c->add(FileSyncPeer::OBJECT_SUB_TYPE, $object_sub_type);
//Version in the db is of type varchar so to avoid string compare we need to add this as custom
$c->add(FileSyncPeer::VERSION, FileSyncPeer::VERSION . " <= {$queryVersion}", Criteria::CUSTOM);
$c->addDescendingOrderByColumn(FileSyncPeer::CREATED_AT);
FileSyncPeer::setUseCriteriaFilter(false);
$res = FileSyncPeer::doSelectOne($c);
FileSyncPeer::setUseCriteriaFilter(true);
if ($res) {
if ($res->getCreatedAt(null) > time() - 86400) {
return true;
}
}
}
return false;
}
示例5: objectAdded
public function objectAdded(BaseObject $object, BatchJob $raisedJob = null)
{
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $object->getObjectId());
$c->addAnd(FileSyncPeer::VERSION, $object->getVersion());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $object->getObjectType());
$c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $object->getObjectSubType());
$c->addAnd(FileSyncPeer::ORIGINAL, '1');
$original_filesync = FileSyncPeer::doSelectOne($c);
if (!$original_filesync) {
KalturaLog::err('Original filesync not found for object_id[' . $object->getObjectId() . '] version[' . $object->getVersion() . '] type[' . $object->getObjectType() . '] subtype[' . $object->getObjectSubType() . ']');
return true;
}
$entryId = $this->getEntryId($object);
$sourceFileUrl = $original_filesync->getExternalUrl($entryId);
if (!$sourceFileUrl) {
KalturaLog::err('External URL not found for filesync id [' . $object->getId() . ']');
return true;
}
$job = kMultiCentersManager::addFileSyncImportJob($entryId, $object, $sourceFileUrl, $raisedJob, $original_filesync->getFileSize());
$job->save();
return true;
}
示例6: isPendingExport
public function isPendingExport(asset $asset)
{
$key = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::DC, $this->getId(), Criteria::EQUAL);
$fileSync = FileSyncPeer::doSelectOne($c);
if (!$fileSync) {
return false;
}
return $fileSync->getStatus() == FileSync::FILE_SYNC_STATUS_PENDING;
}
示例7: createReadyExternalSyncFileForKey
/**
* @param FileSyncKey $key
* @param string $url
* @param StorageProfile $externalStorage
* @return SyncFile
*/
public static function createReadyExternalSyncFileForKey(FileSyncKey $key, $url, StorageProfile $externalStorage)
{
$externalStorageId = $externalStorage->getId();
KalturaLog::log(__METHOD__ . " - key [{$key}], externalStorage [{$externalStorageId}]");
$fileRoot = $externalStorage->getDeliveryHttpBaseUrl();
$filePath = str_replace($fileRoot, '', $url);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->add(FileSyncPeer::DC, $externalStorageId);
$fileSync = FileSyncPeer::doSelectOne($c);
if (!$fileSync) {
$fileSync = FileSync::createForFileSyncKey($key);
}
$fileSync->setDc($externalStorageId);
$fileSync->setFileRoot($fileRoot);
$fileSync->setFilePath($filePath);
$fileSync->setFileSize(-1);
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
$fileSync->setOriginal(false);
$fileSync->setFileType(FileSync::FILE_SYNC_FILE_TYPE_URL);
$fileSync->save();
kEventsManager::raiseEvent(new kObjectAddedEvent($fileSync));
return $fileSync;
}
示例8: isAssetExportFinished
private static function isAssetExportFinished(FileSync $fileSync, asset $asset)
{
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $fileSync->getObjectId());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $fileSync->getObjectType());
$c->addAnd(FileSyncPeer::VERSION, $fileSync->getVersion());
$c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
$c->addAnd(FileSyncPeer::DC, $fileSync->getDc());
$c->addAnd(FileSyncPeer::STATUS, Filesync::FILE_SYNC_STATUS_PENDING);
$pendingFileSync = FileSyncPeer::doSelectOne($c);
if ($pendingFileSync) {
return false;
} else {
return true;
}
}
示例9: dirname
<?php
require_once dirname(__FILE__) . '/../bootstrap.php';
$playlists = entryPeer::retrieveByPKs(array('_KMCSPL1', '_KMCSPL2'));
foreach ($playlists as $playlist) {
/* @var $playlist entry */
$criteria = new Criteria();
$criteria->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ENTRY);
$criteria->add(FileSyncPeer::OBJECT_SUB_TYPE, entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
$criteria->add(FileSyncPeer::OBJECT_ID, $playlist->getId());
$criteria->add(FileSyncPeer::PARTNER_ID, 0);
$criteria->add(FileSyncPeer::DC, 0);
$criteria->add(FileSyncPeer::ORIGINAL, true);
$criteria->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
$criteria->addDescendingOrderByColumn(FileSyncPeer::ID);
$fileSync = FileSyncPeer::doSelectOne($criteria);
$playlist->setData($fileSync->getVersion(), true);
$playlist->save();
}
KalturaLog::debug('Done');
示例10: foreach
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// count only file syncs that should be synced
$count = 0;
$size = 0;
foreach ($rows as $row) {
$objectType = $row['OBJECT_TYPE'];
$objectSubType = $row['OBJECT_SUB_TYPE'];
if (isset($excludeFileSyncMap[$objectType]) && (!count($excludeFileSyncMap[$objectType]) || in_array($objectSubType, $excludeFileSyncMap[$objectType]))) {
continue;
}
$count += $row['COUNT(file_sync.ID)'];
$size += $row['SUM(file_sync.FILE_SIZE)'];
}
if ($count) {
$breakdownBySize[$sizeName] = array($count, $size);
}
}
// get next file sync to process
$c = clone $baseCriteria;
$c->addAscendingOrderByColumn(FileSyncPeer::ID);
$fileSync = FileSyncPeer::doSelectOne($c);
// print the status
writeOutput("Worker id [{$workerId}] name [{$workerName}] lastId [{$lastId}] maxId - lastId [" . ($maxId - $lastId) . "]\n");
foreach ($breakdownBySize as $sizeName => $curStat) {
list($count, $size) = $curStat;
writeOutput("\t{$sizeName} - count {$count}, size " . formatFileSize($size) . "\n");
}
if ($fileSync) {
writeOutput("\tnext file sync id [" . $fileSync->getId() . "] created at [" . $fileSync->getCreatedAt() . "]\n");
}
}
示例11: createPendingExternalSyncFileForKey
/**
* @param FileSyncKey $key
* @param StorageProfile $externalStorage
* @return SyncFile
*/
public static function createPendingExternalSyncFileForKey(FileSyncKey $key, StorageProfile $externalStorage)
{
$externalStorageId = $externalStorage->getId();
KalturaLog::log(__METHOD__ . " - key [{$key}], externalStorage [{$externalStorageId}]");
list($fileRoot, $realPath) = kPathManager::getFilePathArr($key, $externalStorageId);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->add(FileSyncPeer::DC, $externalStorageId);
$fileSync = FileSyncPeer::doSelectOne($c);
if (!$fileSync) {
$fileSync = FileSync::createForFileSyncKey($key);
}
$fileSync->setDc($externalStorageId);
$fileSync->setFileRoot($fileRoot);
$fileSync->setFilePath($realPath);
$fileSync->setFileSize(-1);
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_PENDING);
$fileSync->setOriginal(false);
if ($externalStorage->getProtocol() == StorageProfile::STORAGE_KALTURA_DC) {
$fileSync->setFileType(FileSync::FILE_SYNC_FILE_TYPE_FILE);
} else {
$fileSync->setFileType(FileSync::FILE_SYNC_FILE_TYPE_URL);
}
$fileSync->save();
kEventsManager::raiseEvent(new kObjectAddedEvent($fileSync));
return $fileSync;
}