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


PHP kFile类代码示例

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


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

示例1: createDirDescriber

 protected function createDirDescriber($outDir, $fileName)
 {
     $fileList = kFile::dirList($outDir, false);
     $fileListXml = $this->createImagesListXML($fileList);
     kFile::setFileContent($outDir . DIRECTORY_SEPARATOR . $fileName, $fileListXml->asXML());
     KalturaLog::info('file list xml [' . $outDir . DIRECTORY_SEPARATOR . $fileName . '] created');
 }
开发者ID:kubrickfr,项目名称:server,代码行数:7,代码来源:KOperationEnginePpt2Image.php

示例2: get

 /**
  * @param string $type
  * @return KalturaTypeReflector
  */
 static function get($type)
 {
     if (!self::$_enabled) {
         return new KalturaTypeReflector($type);
     }
     if (!array_key_exists($type, self::$_loadedTypeReflectors)) {
         $cachedDir = KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "typeReflector");
         if (!is_dir($cachedDir)) {
             mkdir($cachedDir);
             chmod($cachedDir, 0755);
         }
         $cachedFilePath = $cachedDir . DIRECTORY_SEPARATOR . $type . ".cache";
         $typeReflector = null;
         if (file_exists($cachedFilePath)) {
             $cachedData = file_get_contents($cachedFilePath);
             $typeReflector = unserialize($cachedData);
         }
         if (!$typeReflector) {
             $typeReflector = new KalturaTypeReflector($type);
             $cachedData = serialize($typeReflector);
             $bytesWritten = kFile::safeFilePutContents($cachedFilePath, $cachedData);
             if (!$bytesWritten) {
                 $folderPermission = substr(decoct(fileperms(dirname($cachedFilePath))), 2);
                 error_log("Kaltura type reflector could not be saved to path [{$cachedFilePath}] type [{$type}] folder permisisons [{$folderPermission}]");
             }
         }
         self::$_loadedTypeReflectors[$type] = $typeReflector;
     }
     return self::$_loadedTypeReflectors[$type];
 }
开发者ID:DBezemer,项目名称:server,代码行数:34,代码来源:KalturaTypeReflectorCacher.php

示例3: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     $dbUploadToken = UploadTokenPeer::retrieveByPK($this->token);
     if (is_null($dbUploadToken)) {
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_NOT_FOUND);
     }
     if (!$object_to_fill) {
         $object_to_fill = new kUploadedFileTokenResource();
     }
     $object_to_fill->setToken($this->token);
     if ($dbUploadToken->getStatus() != UploadToken::UPLOAD_TOKEN_FULL_UPLOAD) {
         $object_to_fill->setIsReady(false);
         return $object_to_fill;
     }
     try {
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($this->token);
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
     if (!file_exists($entryFullPath)) {
         $remoteDCHost = kUploadTokenMgr::getRemoteHostForUploadToken($this->token, kDataCenterMgr::getCurrentDcId());
         if ($remoteDCHost) {
             kFile::dumpApiRequest($remoteDCHost);
         } else {
             throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
     }
     $object_to_fill->setLocalFilePath($entryFullPath);
     return $object_to_fill;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:33,代码来源:KalturaUploadedFileTokenResource.php

示例4: sendRequest

 private static function sendRequest($params, $url = "rest")
 {
     $fullUrl = self::buildUrl($params, $url);
     $rsp = kFile::downloadUrlToString($fullUrl);
     $rsp_obj = unserialize($rsp);
     return $rsp_obj;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:myFlickrServices.class.php

示例5: execute

    public function execute()
    {
        $this->forceSystemAuthentication();
        $this->basePath = "/content/dynamic/";
        $dynamicRoot = myContentStorage::getFSContentRootPath() . $this->basePath;
        if ($this->getRequest()->getMethod() == sfRequest::POST) {
            $origFilename = basename($_FILES['Filedata']['name']);
            $fullPath = $dynamicRoot . $origFilename;
            move_uploaded_file($_FILES['Filedata']['tmp_name'], $fullPath);
            chmod($fullPath, 0777);
            return $this->renderText("ok");
        } else {
            if ($this->getRequest()->getMethod() == sfRequest::DELETE) {
                $filename = basename($_REQUEST['fileName']);
                kFile::deleteFile($dynamicRoot . $filename);
                return $this->renderText("ok");
            }
        }
        $this->files = kFile::dirListExtended($dynamicRoot, false);
        $this->extraHead = <<<EOT
\t\t<style type="text/css">
\t\t\ttable{ font-size:1.2em; width:100%; margin:40px 0 0 0; }
\t\t\ttable thead{ font-size:1.4em; }
\t\t\t\ttable thead td{ border-bottom:1px solid #444; margin-bottom:20px; }
\t\t\ttable tbody td{ padding:2px 0; color:#ccc; }
\t\t\t\ttable tbody td b{ font-weight:normal; cursor:default; }
\t\t\t\ttable tbody td span.btn{ margin-right:12px;}
\t\t\tdiv#helper{ display:none; position:absolute; left:0; width:250px; }
\t\t\tdiv#helper img{ float:right; max-width:250px; }
\t\t</style>
EOT;
    }
开发者ID:DBezemer,项目名称:server,代码行数:32,代码来源:uploadAction.class.php

示例6: validateEntry

 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('resources');
     $dc = null;
     foreach ($this->resources as $resource) {
         $resource->validateEntry($dbEntry);
         if (!$resource instanceof KalturaDataCenterContentResource) {
             continue;
         }
         $theDc = $resource->getDc();
         if (is_null($theDc)) {
             continue;
         }
         if (is_null($dc)) {
             $dc = $theDc;
         } elseif ($dc != $theDc) {
             throw new KalturaAPIException(KalturaErrors::RESOURCES_MULTIPLE_DATA_CENTERS);
         }
     }
     if (!is_null($dc) && $dc != kDataCenterMgr::getCurrentDcId()) {
         $remoteHost = kDataCenterMgr::getRemoteDcExternalUrlByDcId($dc);
         kFile::dumpApiRequest($remoteHost);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:25,代码来源:KalturaAssetsParamsResourceContainers.php

示例7: configure

 public function configure()
 {
     $this->tempDirectory = isset(KBatchBase::$taskConfig->params->tempDirectoryPath) ? KBatchBase::$taskConfig->params->tempDirectoryPath : sys_get_temp_dir();
     if (!is_dir($this->tempDirectory)) {
         kFile::fullMkfileDir($this->tempDirectory, 0700, true);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:DistributionEngine.php

示例8: addParseCaptionAssetJob

 /**
  * @param CaptionAsset $captionAsset
  * @param BatchJob $parentJob
  * @throws kCoreException FILE_NOT_FOUND
  * @return BatchJob
  */
 public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null)
 {
     $syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
     if (!$fileSync) {
         if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) {
             throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
         }
         $fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
         if (!$fileSync) {
             throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
         }
         $fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp';
         if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) {
             throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
         }
         kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true);
     }
     $jobData = new kParseCaptionAssetJobData();
     $jobData->setCaptionAssetId($captionAsset->getId());
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild();
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($captionAsset->getEntryId());
         $batchJob->setPartnerId($captionAsset->getPartnerId());
     }
     return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET));
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:36,代码来源:kCaptionSearchFlowManager.php

示例9: moveFile

 private function moveFile(KalturaBatchJob $job, $fromPath, $toPath)
 {
     KalturaLog::debug("moveFile from[{$fromPath}] to[{$toPath}]");
     // move file/dir to the new location
     $res = @rename($fromPath, $toPath);
     // chmod + chown + check file seen by apache - for each moved file/directory
     if ($res) {
         if (is_dir($toPath)) {
             $contents = kFile::listDir($toPath);
             sort($contents, SORT_STRING);
             foreach ($contents as $current) {
                 $res = $res && $this->setAndCheck($toPath . '/' . $current);
             }
         } else {
             $res = $this->setAndCheck($toPath);
         }
     }
     if ($res) {
         $job->status = KalturaBatchJobStatus::FINISHED;
         $job->message = "File moved to final destination";
     } else {
         $job->status = KalturaBatchJobStatus::FAILED;
         $job->message = "File not moved correctly";
     }
     return $this->closeJob($job, null, null, $job->message, $job->status, null, $job->data);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:26,代码来源:KAsyncFileSyncImportCloser.class.php

示例10: executeImpl

 /**
  * Executes addComment action, which returns a form enabling the insertion of a comment
  * The request may include 1 fields: entry id.
  */
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $version = @$_REQUEST["version"];
     // it's a path on the disk
     if (kString::beginsWith($version, ".")) {
         // someone is trying to hack in the system
         return sfView::ERROR;
     }
     // in case we're making a roughcut out of a regular invite, we start from scratch
     if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry->getDataPath($version) === null) {
         $this->xml_content = "<xml></xml>";
         return;
     }
     // fetch content of file from disk - it should hold the XML
     $file_name = myContentStorage::getFSContentRootPath() . "/" . $entry->getDataPath($version);
     //echo "[$file_name]";
     if (kString::endsWith($file_name, "xml")) {
         if (file_exists($file_name)) {
             $this->xml_content = kFile::getFileContent($file_name);
             //	echo "[" . $this->xml_content . "]" ;
         } else {
             $this->xml_content = "<xml></xml>";
         }
         myMetadataUtils::updateEntryForPending($entry, $version, $this->xml_content);
     } else {
         return sfView::ERROR;
     }
     // this is NOT an xml file we are looking for !
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:33,代码来源:getMetadataAction.class.php

示例11: crop

 public function crop($quality, $cropType, $width = 0, $height = 0, $cropX = 0, $cropY = 0, $cropWidth = 0, $cropHeight = 0, $scaleWidth = 1, $scaleHeight = 1, $bgcolor = 0xffffff, $density = 0, $forceRotation = null, $strip = false)
 {
     if (is_null($quality)) {
         $quality = 100;
     }
     if (is_null($cropType)) {
         $cropType = 1;
     }
     if (is_null($width)) {
         $width = 0;
     }
     if (is_null($height)) {
         $height = 0;
     }
     if (is_null($cropX)) {
         $cropX = 0;
     }
     if (is_null($cropY)) {
         $cropY = 0;
     }
     if (is_null($cropWidth)) {
         $cropWidth = 0;
     }
     if (is_null($cropHeight)) {
         $cropHeight = 0;
     }
     if (is_null($scaleWidth)) {
         $scaleWidth = 1;
     }
     if (is_null($scaleHeight)) {
         $scaleHeight = 1;
     }
     if (is_null($bgcolor)) {
         $bgcolor = 0;
     }
     $cmd = $this->getCommand($quality, $cropType, $width, $height, $cropX, $cropY, $cropWidth, $cropHeight, $scaleWidth, $scaleHeight, $bgcolor, $density, $forceRotation, $strip);
     if ($cmd) {
         KalturaLog::info("Executing: {$cmd}");
         $returnValue = null;
         $output = system($cmd, $returnValue);
         KalturaLog::debug("Returned value: '{$returnValue}'");
         if ($returnValue) {
             return false;
         }
         // Support animated gifs - KImageMagick generates multiple images with a postfix of '-<frame num>'
         if (!kFile::fileSize($this->targetPath)) {
             $targetFiledir = pathinfo($this->targetPath, PATHINFO_DIRNAME);
             $targetFilename = pathinfo($this->targetPath, PATHINFO_FILENAME);
             $targetFileext = pathinfo($this->targetPath, PATHINFO_EXTENSION);
             $firstFrameTargetFile = "{$targetFiledir}/{$targetFilename}-0.{$targetFileext}";
             if (kFile::fileSize($firstFrameTargetFile)) {
                 kFile::moveFile($firstFrameTargetFile, $this->targetPath);
             }
         }
         return true;
     }
     KalturaLog::info("No conversion required, copying source[{$this->srcPath}] to target[{$this->targetPath}]");
     return copy($this->srcPath, $this->targetPath);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:59,代码来源:KBaseCropper.php

示例12: appendRecordingAction

 /**
  * Append recorded video to live entry
  * 
  * @action appendRecording
  * @param string $entryId Live entry id
  * @param string $assetId Live asset id
  * @param KalturaMediaServerIndex $mediaServerIndex
  * @param KalturaDataCenterContentResource $resource
  * @param float $duration in seconds
  * @param bool $isLastChunk Is this the last recorded chunk in the current session (i.e. following a stream stop event)
  * @return KalturaLiveEntry The updated live entry
  * 
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  */
 function appendRecordingAction($entryId, $assetId, $mediaServerIndex, KalturaDataCenterContentResource $resource, $duration, $isLastChunk = false)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || !$dbEntry instanceof LiveEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $dbAsset = assetPeer::retrieveById($assetId);
     if (!$dbAsset || !$dbAsset instanceof liveAsset) {
         throw new KalturaAPIException(KalturaErrors::ASSET_ID_NOT_FOUND, $assetId);
     }
     $lastDuration = $dbEntry->getLengthInMsecs();
     if (!$lastDuration) {
         $lastDuration = 0;
     }
     $liveSegmentDurationInMsec = (int) ($duration * 1000);
     $currentDuration = $lastDuration + $liveSegmentDurationInMsec;
     $maxRecordingDuration = (kConf::get('max_live_recording_duration_hours') + 1) * 60 * 60 * 1000;
     if ($currentDuration > $maxRecordingDuration) {
         KalturaLog::err("Entry [{$entryId}] duration [" . $dbEntry->getLengthInMsecs() . "] and current duration [{$currentDuration}] is more than max allwoed duration [{$maxRecordingDuration}]");
         throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_EXCEEDED_MAX_RECORDED_DURATION, $entryId);
     }
     $kResource = $resource->toObject();
     $filename = $kResource->getLocalFilePath();
     if (!$resource instanceof KalturaServerFileResource) {
         $filename = kConf::get('uploaded_segment_destination') . basename($kResource->getLocalFilePath());
         kFile::moveFile($kResource->getLocalFilePath(), $filename);
         chgrp($filename, kConf::get('content_group'));
         chmod($filename, 0640);
     }
     if ($dbAsset->hasTag(assetParams::TAG_RECORDING_ANCHOR) && $mediaServerIndex == KalturaMediaServerIndex::PRIMARY) {
         KalturaLog::debug("Appending assetId {$assetId} to entryId {$entryId}");
         $dbEntry->setLengthInMsecs($currentDuration);
         // Extract the exact video segment duration from the recorded file
         $mediaInfoParser = new KMediaInfoMediaParser($filename, kConf::get('bin_path_mediainfo'));
         $recordedSegmentDurationInMsec = $mediaInfoParser->getMediaInfo()->videoDuration;
         $currentSegmentVodToLiveDeltaTime = $liveSegmentDurationInMsec - $recordedSegmentDurationInMsec;
         $recordedSegmentsInfo = $dbEntry->getRecordedSegmentsInfo();
         $recordedSegmentsInfo->addSegment($lastDuration, $recordedSegmentDurationInMsec, $currentSegmentVodToLiveDeltaTime);
         $dbEntry->setRecordedSegmentsInfo($recordedSegmentsInfo);
         if ($isLastChunk) {
             // Save last elapsed recording time
             $dbEntry->setLastElapsedRecordingTime($currentDuration);
         }
         $dbEntry->save();
     }
     kJobsManager::addConvertLiveSegmentJob(null, $dbAsset, $mediaServerIndex, $filename, $currentDuration);
     if ($mediaServerIndex == KalturaMediaServerIndex::PRIMARY) {
         if (!$dbEntry->getRecordedEntryId()) {
             $this->createRecordedEntry($dbEntry, $mediaServerIndex);
         }
         $recordedEntry = entryPeer::retrieveByPK($dbEntry->getRecordedEntryId());
         if ($recordedEntry) {
             $this->ingestAsset($recordedEntry, $dbAsset, $filename);
         }
     }
     $entry = KalturaEntryFactory::getInstanceByType($dbEntry->getType());
     $entry->fromObject($dbEntry, $this->getResponseProfile());
     return $entry;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:73,代码来源:KalturaLiveEntryService.php

示例13: getAssetDataFilesArray

 private function getAssetDataFilesArray(kConvertLiveSegmentJobData $data)
 {
     $amfFilesDir = dirname($data->getDestDataFilePath());
     $pattern = "/{$data->getEntryId()}_{$data->getAssetId()}_{$data->getMediaServerIndex()}_[0-9]*.data/";
     $files = kFile::recursiveDirList($amfFilesDir, true, false, $pattern);
     natsort($files);
     return $files;
 }
开发者ID:wzur,项目名称:server,代码行数:8,代码来源:kCuePointManager.php

示例14: execute

 /**
  * Will forward to the regular swf player according to the widget_id 
  */
 public function execute()
 {
     $ui_conf_id = $this->getRequestParameter("ui_conf_id");
     $preloader_path = myContentStorage::getFSContentRootPath() . "/content" . myContentStorage::getFSUiconfRootPath() . "/preloader_{$ui_conf_id}.swf";
     if (!file_exists($preloader_path)) {
         $preloader_path = myContentStorage::getFSContentRootPath() . "/content" . myContentStorage::getFSUiconfRootPath() . "/preloader_2.swf";
     }
     kFile::dumpFile($preloader_path);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:kpreloaderAction.class.php

示例15: execute

 /**
  * Will forward to the regular swf player according to the widget_id 
  */
 public function execute()
 {
     $uiconf_id = $this->getRequestParameter('uiconf_id');
     if (!$uiconf_id) {
         KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
     }
     $uiConf = uiConfPeer::retrieveByPK($uiconf_id);
     if (!$uiConf) {
         KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
     }
     $partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
     if (!$partner_id) {
         KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
     }
     $partner_host = myPartnerUtils::getHost($partner_id);
     $partner_cdnHost = myPartnerUtils::getCdnHost($partner_id);
     $use_cdn = $uiConf->getUseCdn();
     $host = $use_cdn ? $partner_cdnHost : $partner_host;
     $ui_conf_html5_url = $uiConf->getHtml5Url();
     if (kConf::hasMap("optimized_playback")) {
         $optimizedPlayback = kConf::getMap("optimized_playback");
         if (array_key_exists($partner_id, $optimizedPlayback)) {
             // force a specific kdp for the partner
             $params = $optimizedPlayback[$partner_id];
             if (array_key_exists('html5_url', $params)) {
                 $ui_conf_html5_url = $params['html5_url'];
             }
         }
     }
     if (kString::beginsWith($ui_conf_html5_url, "http")) {
         $url = $ui_conf_html5_url;
         // absolute URL
     } else {
         if ($ui_conf_html5_url) {
             $url = $host . $ui_conf_html5_url;
         } else {
             $html5_version = kConf::get('html5_version');
             $url = "{$host}/html5/html5lib/{$html5_version}/mwEmbedLoader.php";
         }
     }
     // append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php suffix
     if (kString::endsWith($url, "mwEmbedLoader.php")) {
         $url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
         $entry_id = $this->getRequestParameter('entry_id');
         if ($entry_id) {
             $url .= "/entry_id/{$entry_id}";
         }
     }
     requestUtils::sendCachingHeaders(60);
     header("Pragma:");
     kFile::cacheRedirect($url);
     header("Location:{$url}");
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:57,代码来源:embedIframeJsAction.class.php


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