当前位置: 首页>>代码示例>>PHP>>正文


PHP entry::setData方法代码示例

本文整理汇总了PHP中entry::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::setData方法的具体用法?PHP entry::setData怎么用?PHP entry::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entry的用法示例。


在下文中一共展示了entry::setData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = $this->getObjectPrefix();
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $entry_id = $this->getPM("{$prefix}_id");
     $entry = entryPeer::retrieveByPK($entry_id);
     if (!$entry) {
         $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id);
         return;
     }
     $this->validateInputEntry($entry);
     // TODO - verify the user is allowed to modify the entry
     if (!$this->isOwnedBy($entry, $puser_kuser->getKuserId())) {
         $this->verifyEntryPrivileges($entry);
         // user was granted explicit permissions when initiatd the ks
     }
     // get the new properties for the kuser from the request
     $entry_update_data = new entry();
     // assume the type and media_type of the entry from the DB are the same as those of the one from the user - if not -they will be overriden
     $entry_update_data->setType($entry->getType());
     $entry_update_data->setMediaType($entry->getMediaType());
     $entry_update_data->setId($entry->getId());
     $entry_update_data->setPartnerId($entry->getPartnerId());
     $entry_update_data->setData($entry->getData(), true);
     $obj_wrapper = objectWrapperBase::getWrapperClass($entry_update_data, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $entry_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($entry_update_data) {
             // allow admins to set admin more fields
             baseObjectUtils::fillObjectFromObject($updateable_fields, $entry_update_data, $entry, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $this->validateEntry($entry);
         // TODO - chack to see that the permissions changed, not just any attributes
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_PERMISSIONS, $entry);
         $entry->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     $wrapper->removeFromCache("entry", $entry->getId());
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:50,代码来源:updateentryAction.class.php

示例2: attachFile

 /**
  * @param string $entryFullPath
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return asset
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  */
 protected function attachFile($entryFullPath, entry $dbEntry, asset $dbAsset = null, $copyOnly = false)
 {
     // TODO - move image handling to media service
     if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
         $exifImageType = @exif_imagetype($entryFullPath);
         $validTypes = array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM, IMAGETYPE_IFF, IMAGETYPE_PNG);
         if (in_array($exifImageType, $validTypes)) {
             $exifData = @exif_read_data($entryFullPath);
             if ($exifData && isset($exifData["DateTimeOriginal"]) && $exifData["DateTimeOriginal"]) {
                 $mediaDate = $exifData["DateTimeOriginal"];
                 $ts = strtotime($mediaDate);
                 // handle invalid dates either due to bad format or out of range
                 if ($ts === -1 || $ts === false || $ts < strtotime('2000-01-01') || $ts > strtotime('2015-01-01')) {
                     $mediaDate = null;
                 }
                 $dbEntry->setMediaDate($mediaDate);
             }
         }
         list($width, $height, $type, $attr) = getimagesize($entryFullPath);
         $dbEntry->setDimensions($width, $height);
         $dbEntry->setData(".jpg");
         // this will increase the data version
         $dbEntry->save();
         $syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         try {
             kFileSyncUtils::moveFromFile($entryFullPath, $syncKey, true, $copyOnly);
         } catch (Exception $e) {
             if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
                 $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
                 $dbEntry->save();
             }
             throw $e;
         }
         $dbEntry->setStatus(entryStatus::READY);
         $dbEntry->save();
         return null;
     }
     $isNewAsset = false;
     if (!$dbAsset) {
         $isNewAsset = true;
         $dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
     }
     if (!$dbAsset && $dbEntry->getStatus() == entryStatus::NO_CONTENT) {
         $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
         $dbEntry->save();
     }
     $ext = pathinfo($entryFullPath, PATHINFO_EXTENSION);
     $dbAsset->setFileExt($ext);
     $dbAsset->save();
     if ($dbAsset && $dbAsset instanceof thumbAsset) {
         list($width, $height, $type, $attr) = getimagesize($entryFullPath);
         $dbAsset->setWidth($width);
         $dbAsset->setHeight($height);
         $dbAsset->save();
     }
     $syncKey = $dbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     try {
         kFileSyncUtils::moveFromFile($entryFullPath, $syncKey, true, $copyOnly);
     } catch (Exception $e) {
         if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
             $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
             $dbEntry->save();
         }
         $dbAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
         $dbAsset->save();
         throw $e;
     }
     if ($dbAsset && !$dbAsset instanceof flavorAsset) {
         $dbAsset->setStatusLocalReady();
         if ($dbAsset->getFlavorParamsId()) {
             $dbFlavorParams = assetParamsPeer::retrieveByPK($dbAsset->getFlavorParamsId());
             if ($dbFlavorParams) {
                 $dbAsset->setTags($dbFlavorParams->getTags());
             }
         }
         $dbAsset->save();
     }
     if ($isNewAsset) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
     }
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAsset));
     return $dbAsset;
 }
开发者ID:DBezemer,项目名称:server,代码行数:91,代码来源:KalturaEntryService.php

示例3: handleEntry


//.........这里部分代码省略.........
                     } catch (Exception $e) {
                         $entry->setStatus(entryStatus::ERROR_CONVERTING);
                         $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
                         $entry->save();
                         $flavorAsset->save();
                         throw $e;
                     }
                     kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset));
                 } else {
                     $entry->setStatus(entryStatus::ERROR_CONVERTING);
                 }
                 //				Remarked by Tan-Tan
                 //				$targetFileName = $this->entry_id.".".$ext;
                 //				if ( false /* old conversion */)
                 //				{
                 //								// if we need to convert move entry to conversion directory
                 //								$preConvPath = $content.'/content/preconvert/';
                 //								myContentStorage::moveFile($entry_fullPath, $preConvPath."data/".$targetFileName, true , $should_copy );
                 //
                 //								$signalFilePath = $preConvPath."files/".$targetFileName;
                 //								myContentStorage::fullMkdir($signalFilePath);
                 //								touch($signalFilePath);
                 //				}
                 //				else
                 //				{
                 //								$preConvPath = myContentStorage::getFSContentRootPath (). "/content/new_preconvert";
                 //								$to_data = $preConvPath . "/$targetFileName" ;
                 //								myContentStorage::moveFile($entry_fullPath, $to_data , true);
                 //								touch ( $to_data . ".indicator" );
                 //				}
             }
         } else {
             if ($entry->getStatus() == entryStatus::PENDING || $media_source == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
                 $entry->setData($entry_fullPath);
                 $entry->save();
                 if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO || $media_type == entry::ENTRY_MEDIA_TYPE_AUDIO) {
                     KalturaLog::debug("handleEntry: creating original flavor asset for ready entry");
                     $flavorAsset = kFlowHelper::createOriginalFlavorAsset($this->partner_id, $this->entry_id);
                     if ($flavorAsset) {
                         $ext = pathinfo($entry_fullPath, PATHINFO_EXTENSION);
                         $flavorAsset->setFileExt($ext);
                         $flavorAsset->save();
                         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                         try {
                             if (!$should_copy) {
                                 kFileSyncUtils::moveFromFile($entry_fullPath, $syncKey);
                             } else {
                                 // copy & create file sync from $entry_fullPath
                                 kFileSyncUtils::copyFromFile($entry_fullPath, $syncKey);
                             }
                         } catch (Exception $e) {
                             $entry->setStatus(entryStatus::ERROR_CONVERTING);
                             $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
                             $entry->save();
                             $flavorAsset->save();
                             throw $e;
                         }
                         //					// bypass to conversion
                         //					kBusinessPreConvertDL::bypassConversion($flavorAsset, $entry);
                         /**
                          * if this is webcam entry, create mediaInfo for the source flavor asset synchronously
                          * since entry is ready right at the beginning
                          */
                         if ($media_source == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
                             require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "api_v3" . DIRECTORY_SEPARATOR . "bootstrap.php";
                             // extract file path
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:67,代码来源:myInsertEntryHelper.class.php

示例4: undeleteEntry

 public static function undeleteEntry(entry $entry, $partner_id = null)
 {
     if ($entry->getStatus() != entryStatus::DELETED) {
         return;
     }
     $data = $entry->getData();
     $original_play = "";
     $parts = explode("&", $data);
     if (count($parts) < 2) {
         $original_play = $data;
     } else {
         $original_play = $parts[0];
     }
     $deleted_file_path = $entry->getFromCustomData("deleted_file_path");
     //		echo $deleted_file_path . "\n";
     $deleted_paths = explode("|", $deleted_file_path);
     if ($deleted_paths) {
         $original_play = @$deleted_paths[0];
         $dataKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, @$deleted_paths[0]);
         kFileSyncUtils::undeleteSyncFile($dataKey);
         //$original = myContentStorage::moveFromDeleted ( @$deleted_paths[0] );
         $dataEditKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT, @$deleted_paths[1]);
         kFileSyncUtils::undeleteSyncFile($dataEditKey);
         //$original = myContentStorage::moveFromDeleted ( @$deleted_paths[1] );
         //figure out the thumb's path from the deleted path  and the property deleted_original_thumb
         $entry->setData(null);
         $entry->setData($entry->getFromCustomData("deleted_original_data"), true);
         // force the value that was set beforehand
         // the data is supposed to point to a delete template 100000.flv&deleted_video.flv
         $orig_thumb = $entry->getFromCustomData("deleted_original_thumb");
         if (myContentStorage::isTemplate($orig_thumb)) {
             $entry->setThumbnail($orig_thumb, true);
             //  the thumbnail wat a template- use it as it was
         } else {
             $entry->setThumbnail(null);
             // reset the thumb before setting - it won't increment the version count
             $entry->setThumbnail($entry->getFromCustomData("deleted_original_thumb"), true);
             // force the value that was set beforehand
             $thumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB, @$deleted_paths[2]);
             kFileSyncUtils::undeleteSyncFile($thumbKey);
             //$original = myContentStorage::moveFromDeleted ( @$deleted_paths[2] ); //
         }
     } else {
         // error
     }
     $entry->setStatusReady();
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:47,代码来源:myEntryUtils.class.php


注:本文中的entry::setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。