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


PHP kFile::dirList方法代码示例

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


在下文中一共展示了kFile::dirList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createImagesListXML

 private function createImagesListXML($outDirPath)
 {
     $imagesList = kFile::dirList($outDirPath, false);
     sort($imagesList);
     $imagesListXML = new SimpleXMLElement('<' . self::IMAGES_LIST_XML_LABEL_ITEMS . '/>');
     foreach ($imagesList as $image) {
         $imageNode = $imagesListXML->addChild(self::IMAGES_LIST_XML_LABEL_ITEM);
         $imageNode->addChild(self::IMAGES_LIST_XML_LABEL_NAME, $image);
     }
     $imagesListXML->addAttribute(self::IMAGES_LIST_XML_ATTRIBUTE_COUNT, count($imagesList));
     return $imagesListXML;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:12,代码来源:KOperationEngineImageMagick.php

示例3: operate

 public function operate(kOperator $operator = null, $inFilePath, $configFilePath = null)
 {
     if (kFile::fullMkfileDir($this->outFilePath)) {
         KalturaLog::debug('dir [' . $this->outFilePath . '] created');
         //outFilePath will be the path to the directory in which the images will be saved.
         $outDirPath = $this->outFilePath;
         //imageMagick decides the format of the output file according to the outFilePath's extension.so the format need to be added.
         $this->outFilePath = $this->outFilePath . DIRECTORY_SEPARATOR . basename($this->outFilePath) . self::LEADING_ZEROS_PADDING . '.' . $this->data->flavorParamsOutput->format;
     } else {
         KalturaLog::debug('failed to create [' . $this->outFilePath . '] directory');
         throw new KOperationEngineException('failed to create [' . $this->outFilePath . '] directory');
     }
     $ext = strtolower(pathinfo($inFilePath, PATHINFO_EXTENSION));
     $inputFormat = $this->getInputFormat();
     if ($inputFormat == self::PDF_FORMAT && $ext != 'pdf' && kFile::linkFile($inFilePath, "{$inFilePath}.pdf")) {
         $inFilePath = "{$inFilePath}.pdf";
     }
     if ($inputFormat == self::JPG_FORMAT && $ext != 'jpg' && kFile::linkFile($inFilePath, "{$inFilePath}.jpg")) {
         $inFilePath = "{$inFilePath}.jpg";
     }
     $realInFilePath = realpath($inFilePath);
     // Test input
     // - Test file type
     $errorMsg = $this->checkFileType($realInFilePath, $this->SUPPORTED_FILE_TYPES);
     if (!is_null($errorMsg)) {
         $this->data->engineMessage = $errorMsg;
     }
     // Test password required
     if ($this->testPasswordRequired($realInFilePath)) {
         $this->data->engineMessage = "Password required.";
     }
     parent::operate($operator, $realInFilePath, $configFilePath);
     $imagesList = kFile::dirList($outDirPath, false);
     // Test output
     // - Test black Image
     $identifyExe = KBatchBase::$taskConfig->params->identify;
     $firstImage = $outDirPath . DIRECTORY_SEPARATOR . $imagesList[0];
     $errorMsg = $this->testBlackImage($identifyExe, $firstImage, $errorMsg);
     if (!is_null($errorMsg)) {
         $this->data->engineMessage = $errorMsg;
     }
     $imagesListXML = $this->createImagesListXML($imagesList);
     kFile::setFileContent($outDirPath . DIRECTORY_SEPARATOR . self::IMAGES_LIST_XML_NAME, $imagesListXML->asXML());
     KalturaLog::info('images list xml [' . $outDirPath . DIRECTORY_SEPARATOR . self::IMAGES_LIST_XML_NAME . '] created');
     return true;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:46,代码来源:KOperationEngineImageMagick.php

示例4: export

 /**
  * Will take a single KalturaBatchJob and export the given file 
  * 
  * @param KalturaBatchJob $job
  * @param KalturaStorageExportJobData $data
  * @return KalturaBatchJob
  */
 protected function export(KalturaBatchJob $job, KalturaStorageExportJobData $data)
 {
     KalturaLog::debug("export({$job->id})");
     $srcFile = str_replace('//', '/', trim($data->srcFileSyncLocalPath));
     if (!$this->pollingFileExists($srcFile)) {
         return $this->closeJob($job, KalturaBatchJobErrorTypes::APP, KalturaBatchJobAppErrors::NFS_FILE_DOESNT_EXIST, "Source file {$srcFile} does not exist", KalturaBatchJobStatus::RETRY);
     }
     $destFile = str_replace('//', '/', trim($data->destFileSyncStoredPath));
     $this->updateJob($job, "Exporting {$srcFile} to {$destFile}", KalturaBatchJobStatus::QUEUED, 1);
     $engine = kFileTransferMgr::getInstance($job->jobSubType);
     try {
         $engine->login($data->serverUrl, $data->serverUsername, $data->serverPassword, null, $data->ftpPassiveMode);
     } catch (Exception $e) {
         return $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, $e->getCode(), $e->getMessage(), KalturaBatchJobStatus::RETRY);
     }
     try {
         if (is_file($srcFile)) {
             $engine->putFile($destFile, $srcFile, $data->force);
         } else {
             if (is_dir($srcFile)) {
                 $filesPaths = kFile::dirList($srcFile);
                 $destDir = $destFile;
                 foreach ($filesPaths as $filePath) {
                     $destFile = $destDir . DIRECTORY_SEPARATOR . basename($filePath);
                     $engine->putFile($destFile, $filePath, $data->force);
                 }
             }
         }
     } catch (kFileTransferMgrException $e) {
         if ($e->getCode() == kFileTransferMgrException::remoteFileExists) {
             return $this->closeJob($job, KalturaBatchJobErrorTypes::APP, KalturaBatchJobAppErrors::FILE_ALREADY_EXISTS, $e->getMessage(), KalturaBatchJobStatus::FAILED);
         }
         return $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, $e->getCode(), $e->getMessage(), KalturaBatchJobStatus::FAILED);
     } catch (Exception $e) {
         return $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, $e->getCode(), $e->getMessage(), KalturaBatchJobStatus::FAILED);
     }
     if ($this->taskConfig->params->chmod) {
         try {
             $engine->chmod($destFile, $this->taskConfig->params->chmod);
         } catch (Exception $e) {
         }
     }
     return $this->closeJob($job, null, null, null, KalturaBatchJobStatus::FINISHED);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:51,代码来源:KAsyncStorageExport.class.php

示例5: export

 function export()
 {
     if (!KBatchBase::pollingFileExists($this->srcFile)) {
         throw new kTemporaryException("Source file {$this->srcFile} does not exist");
     }
     $engineOptions = isset(KBatchBase::$taskConfig->engineOptions) ? KBatchBase::$taskConfig->engineOptions->toArray() : array();
     $engineOptions['passiveMode'] = $this->data->ftpPassiveMode;
     $engineOptions['createLink'] = $this->data->createLink;
     if ($this->data instanceof KalturaAmazonS3StorageExportJobData) {
         $engineOptions['filesAcl'] = $this->data->filesPermissionInS3;
         $engineOptions['s3Region'] = $this->data->s3Region;
     }
     $engine = kFileTransferMgr::getInstance($this->protocol, $engineOptions);
     try {
         $keyPairLogin = false;
         if ($this->protocol == KalturaStorageProfileProtocol::SFTP) {
             $keyPairLogin = $this->data->serverPrivateKey || $this->data->serverPublicKey;
         }
         if ($keyPairLogin) {
             $privateKeyFile = self::getTempFileWithContent($this->data->serverPrivateKey, 'privateKey');
             $publicKeyFile = self::getTempFileWithContent($this->data->serverPublicKey, 'publicKey');
             $engine->loginPubKey($this->data->serverUrl, $this->data->serverUsername, $publicKeyFile, $privateKeyFile, $this->data->serverPassPhrase);
         } else {
             $engine->login($this->data->serverUrl, $this->data->serverUsername, $this->data->serverPassword);
         }
     } catch (Exception $e) {
         throw new kTemporaryException($e->getMessage());
     }
     try {
         if (is_file($this->srcFile)) {
             $engine->putFile($this->destFile, $this->srcFile, $this->data->force);
             if (KBatchBase::$taskConfig->params->chmod) {
                 try {
                     $engine->chmod($this->destFile, KBatchBase::$taskConfig->params->chmod);
                 } catch (Exception $e) {
                 }
             }
         } else {
             if (is_dir($this->srcFile)) {
                 $filesPaths = kFile::dirList($this->srcFile);
                 $destDir = $this->destFile;
                 foreach ($filesPaths as $filePath) {
                     $destFile = $destDir . '/' . basename($filePath);
                     $engine->putFile($destFile, $filePath, $this->data->force);
                     if (KBatchBase::$taskConfig->params->chmod) {
                         try {
                             $engine->chmod($destFile, KBatchBase::$taskConfig->params->chmod);
                         } catch (Exception $e) {
                         }
                     }
                 }
             }
         }
     } catch (kFileTransferMgrException $e) {
         if ($e->getCode() == kFileTransferMgrException::remoteFileExists) {
             throw new kApplicativeException(KalturaBatchJobAppErrors::FILE_ALREADY_EXISTS, $e->getMessage());
         }
         throw new Exception($e->getMessage(), $e->getCode());
     }
     return true;
 }
开发者ID:DBezemer,项目名称:server,代码行数:61,代码来源:KFileTransferExportEngine.php

示例6: getAllTemplateNames

 public static function getAllTemplateNames()
 {
     return kFile::dirList(self::getTemplateDir(), false);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:4,代码来源:___myTemplateUtils.class.php

示例7: operate

 public function operate(kOperator $operator = null, $inFilePath, $configFilePath = null)
 {
     /*
      * Creating unique output folder for nbrPlay/Webex sessions.
      * This is required in order to support concurrent conversion sessions,
      * because the nbrPlay tool generates temp files with the same name.
      * Upon completion move the generated file into the 'regular' outFilePath
      */
     $saveOutPath = $this->outFilePath;
     $path_parts = pathinfo($this->outFilePath);
     $outDir = realpath($path_parts['dirname']);
     /*
      * The temp folder name
      */
     $tempFolder = "{$outDir}/" . $path_parts['basename'] . ".webex_temp_folder";
     $tempOutPath = "{$tempFolder}/" . $path_parts['basename'];
     if (!file_exists($tempFolder)) {
         $oldUmask = umask(00);
         $result = @mkdir($tempFolder, 0777, true);
         umask($oldUmask);
     }
     /*
      * Switch to temp forlder
      */
     $this->outFilePath = $tempOutPath;
     $rv = parent::operate($operator, $inFilePath, $configFilePath);
     /*
      * Restore the original
      */
     if (file_exists($tempOutPath)) {
         $outFilelist = kFile::dirList($tempFolder);
         if (isset($outFilelist) && count($outFilelist) > 0) {
             foreach ($outFilelist as $fileName) {
                 for ($tries = 0; $tries < 5; $tries++) {
                     $toFile = "{$outDir}/" . pathinfo($fileName, PATHINFO_BASENAME);
                     $rv = kFile::moveFile($fileName, $toFile);
                     if (!file_exists($fileName)) {
                         break;
                     }
                     KalturaLog::err("Failed to move ({$fileName}) to ({$toFile})");
                     Sleep(60);
                 }
             }
             Sleep(60);
             rmdir($tempFolder);
         }
     }
     $this->outFilePath = $saveOutPath;
     return $rv;
 }
开发者ID:DBezemer,项目名称:server,代码行数:50,代码来源:KOperationEngineWebexNbrplayer.php


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