本文整理匯總了PHP中FileSyncPeer::retrieveAllByFileSyncKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSyncPeer::retrieveAllByFileSyncKey方法的具體用法?PHP FileSyncPeer::retrieveAllByFileSyncKey怎麽用?PHP FileSyncPeer::retrieveAllByFileSyncKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileSyncPeer
的用法示例。
在下文中一共展示了FileSyncPeer::retrieveAllByFileSyncKey方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: restoreFileSyncByKey
function restoreFileSyncByKey(FileSyncKey $fileSyncKey)
{
KalturaLog::debug("file sync key: {$fileSyncKey}");
/* @var $entryFileSyncKey FileSyncKey */
FileSyncPeer::setUseCriteriaFilter(false);
$fileSyncs = FileSyncPeer::retrieveAllByFileSyncKey($fileSyncKey);
FileSyncPeer::setUseCriteriaFilter(true);
foreach ($fileSyncs as $fileSync) {
if ($fileSync->getStatus() == FileSync::FILE_SYNC_STATUS_DELETED) {
$shouldUnDelete = false;
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE || $fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
if (file_exists($fileSync->getFullPath())) {
$shouldUnDelete = true;
}
} else {
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_LINK) {
$linkedId = $fileSync->getLinkedId();
FileSyncPeer::setUseCriteriaFilter(false);
$linkedFileSync = FileSyncPeer::retrieveByPK($linkedId);
FileSyncPeer::setUseCriteriaFilter(true);
if ($linkedFileSync->getStatus() == FileSync::FILE_SYNC_STATUS_DELETED && file_exists($linkedFileSync->getFullPath())) {
$shouldUnDelete = true;
}
} else {
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_CACHE) {
$shouldUnDelete = false;
}
}
}
if ($shouldUnDelete) {
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
} else {
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR);
}
}
$fileSync->save();
}
}
示例2: execute
public function execute()
{
$this->forceSystemAuthentication();
myDbHelper::$use_alternative_con = null;
//myDbHelper::DB_HELPER_CONN_PROPEL2
$this->saved = false;
$uiConfId = $this->getRequestParameter("id");
if ($uiConfId) {
$uiConf = uiConfPeer::retrieveByPK($uiConfId);
} else {
$uiConf = new uiConf();
}
if ($this->getRequest()->getMethodName() == "POST") {
$uiConf->setPartnerId($this->getRequestParameter("partnerId"));
$uiConf->setSubpId($uiConf->getPartnerId() * 100);
$uiConf->setObjType($this->getRequestParameter("type"));
$uiConf->setName($this->getRequestParameter("name"));
$uiConf->setWidth($this->getRequestParameter("width"));
$uiConf->setHeight($this->getRequestParameter("height"));
$uiConf->setCreationMode($this->getRequestParameter("creationMode"));
$uiConf->setSwfUrl($this->getRequestParameter("swfUrl"));
$uiConf->setConfVars($this->getRequestParameter("confVars"));
$useCdn = $this->getRequestParameter("useCdn");
$uiConf->setUseCdn($useCdn === "1" ? true : false);
$uiConf->setDisplayInSearch($this->getRequestParameter("displayInSearch"));
$uiConf->setConfVars($this->getRequestParameter("confVars"));
$uiConf->setTags($this->getRequestParameter("tags"));
/* files: */
if ($uiConf->getCreationMode() != uiConf::UI_CONF_CREATION_MODE_MANUAL) {
$confFile = $this->getRequestParameter("uiconf_confFile");
$confFileFeatures = $this->getRequestParameter("uiconf_confFileFeatures");
if ($uiConf->getConfFile() != $confFile || $uiConf->getConfFileFeatures() != $confFileFeatures) {
$uiConf->setConfFile($confFile);
$uiConf->setConfFileFeatures($confFileFeatures);
}
}
$uiConf->save();
$this->saved = true;
}
// so script won't die when uiconf is missing
if (!$uiConf) {
$uiConf = new uiConf();
}
$partner = PartnerPeer::retrieveByPK($uiConf->getPartnerId());
$types = $uiConf->getUiConfTypeMap();
$c = new Criteria();
$c->add(widgetPeer::UI_CONF_ID, $uiConf->getId());
$c->setLimit(1000);
$widgets = widgetPeer::doSelect($c);
$widgetsPerPartner = array();
$this->tooMuchWidgets = false;
if (count($widgets) == 1000) {
$this->tooMuchWidgets = true;
} else {
if ($widgets) {
foreach ($widgets as $widget) {
if (!array_key_exists($widget->getPartnerId(), $widgetsPerPartner)) {
$widgetsPerPartner[$widget->getPartnerId()] = 0;
}
$widgetsPerPartner[$widget->getPartnerId()]++;
}
}
}
// find the FileSync
$fileSyncs = array();
$fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA));
$fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES));
foreach ($fileSyncs as &$fileSync) {
$fileSync["fileSyncs"] = FileSyncPeer::retrieveAllByFileSyncKey($fileSync["key"]);
}
$this->fileSyncs = $fileSyncs;
$this->widgetsPerPartner = $widgetsPerPartner;
$this->directoryMap = $uiConf->getDirectoryMap();
$this->swfNames = $uiConf->getSwfNames();
$this->types = $types;
$this->uiConf = $uiConf;
$this->partner = $partner;
}
示例3: restoreDeletedEntryAction
/**
* Restore deleted entry.
*
* @action restoreDeletedEntry
* @param string $entryId
* @return KalturaBaseEntry The restored entry
*/
public function restoreDeletedEntryAction($entryId)
{
$deletedEntry = entryPeer::retrieveByPKNoFilter($entryId);
if (!$deletedEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$fileSyncKeys = array();
foreach (self::$fileSyncKeysToRestore as $key) {
$fileSyncKeys[] = $deletedEntry->getSyncKey($key);
}
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entryId, Criteria::EQUAL);
assetPeer::setUseCriteriaFilter(false);
$deletedAssets = assetPeer::doSelect($c);
assetPeer::setUseCriteriaFilter(true);
foreach ($deletedAssets as $deletedAsset) {
array_push($fileSyncKeys, $deletedAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET), $deletedAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_CONVERT_LOG));
}
$fileSyncs = array();
FileSyncPeer::setUseCriteriaFilter(false);
foreach ($fileSyncKeys as $fileSyncKey) {
$fileSyncs = array_merge($fileSyncs, FileSyncPeer::retrieveAllByFileSyncKey($fileSyncKey));
}
FileSyncPeer::setUseCriteriaFilter(true);
if (!$this->validateEntryForRestoreDelete($deletedEntry, $fileSyncs, $deletedAssets)) {
throw new KalturaAPIException(KalturaAdminConsoleErrors::ENTRY_ASSETS_WRONG_STATUS_FOR_RESTORE, $entryId);
}
$this->restoreFileSyncs($fileSyncs);
//restore assets
foreach ($deletedAssets as $deletedAsset) {
$deletedAsset->setStatus(asset::ASSET_STATUS_READY);
$deletedAsset->save();
}
//restore entry
$deletedEntry->setStatusReady();
$deletedEntry->setThumbnail($deletedEntry->getFromCustomData("deleted_original_thumb"), true);
$deletedEntry->setData($deletedEntry->getFromCustomData("deleted_original_data"), true);
//data should be resotred even if it's NULL
$deletedEntry->save();
kEventsManager::flushEvents();
kMemoryManager::clearMemory();
$entry = KalturaEntryFactory::getInstanceByType($deletedEntry->getType(), true);
$entry->fromObject($deletedEntry, $this->getResponseProfile());
return $entry;
}
示例4: foreach
assetPeer::clearInstancePool();
$assetSyncKey = $deletedAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$assetfileSyncs = FileSyncPeer::retrieveAllByFileSyncKey($assetSyncKey);
foreach ($assetfileSyncs as $assetfileSync) {
if ($assetfileSync->getStatus() == FileSync::FILE_SYNC_STATUS_DELETED) {
$file_full_path = $assetfileSync->getFullPath();
if (file_exists($file_full_path)) {
echo 'LOG: Changing status of file_sync ' . $assetfileSync->getId() . ' to: ' . FileSync::FILE_SYNC_STATUS_READY . ".\n";
$assetfileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
$assetfileSync->save();
} else {
echo "LOG: will not revive file sync as {$file_full_path} does not exist on disk.\n";
}
}
}
//restore asset's convert-log's file syncs.
$assetConvertLogSyncKey = $deletedAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_CONVERT_LOG);
$assetConvertLogfileSyncs = FileSyncPeer::retrieveAllByFileSyncKey($assetConvertLogSyncKey);
foreach ($assetConvertLogfileSyncs as $assetConvertLogfileSync) {
if ($assetConvertLogfileSync->getStatus() == FileSync::FILE_SYNC_STATUS_DELETED) {
$file_full_path = $assetConvertLogfileSync->getFullPath();
if (file_exists($file_full_path)) {
$assetConvertLogfileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
$assetConvertLogfileSync->save();
} else {
echo "LOG: will not revive file sync as {$file_full_path} does not exist on disk.\n";
}
}
}
}
}