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


PHP kDataCenterMgr::retrieveFileFromRemoteDataCenter方法代码示例

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


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

示例1: getContentsByFileSync

 public static function getContentsByFileSync(FileSync $file_sync, $local = true, $fetch_from_remote_if_no_local = true, $strict = true)
 {
     if ($local) {
         $full_path = $file_sync->getFullPath();
         $real_path = realpath($full_path);
         if (file_exists($real_path)) {
             $startTime = microtime(true);
             $contents = file_get_contents($real_path);
             KalturaLog::info("file was found locally at [{$real_path}] fgc took [" . (microtime(true) - $startTime) . "]");
             return $contents;
         } else {
             KalturaLog::info("file was not found locally [{$full_path}]");
             throw new kFileSyncException("Cannot find file on local disk [{$full_path}] for file sync [" . $file_sync->getId() . "]", kFileSyncException::FILE_DOES_NOT_EXIST_ON_DISK);
         }
     }
     if ($fetch_from_remote_if_no_local) {
         if (!in_array($file_sync->getDc(), kDataCenterMgr::getDcIds())) {
             if ($strict) {
                 throw new Exception("File sync is remote - cannot get contents, id = [" . $file_sync->getId() . "]");
             } else {
                 return null;
             }
         }
         // if $fetch_from_remote_if_no_local is false - $file_sync shoule be null , this if is in fact redundant
         // TODO - curl to the remote
         $content = kDataCenterMgr::retrieveFileFromRemoteDataCenter($file_sync);
         return $content;
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:29,代码来源:kFileSyncUtils.class.php

示例2: getContentsByFileSync

 public static function getContentsByFileSync(FileSync $file_sync, $local = true, $fetch_from_remote_if_no_local = true, $strict = true)
 {
     if ($local) {
         $real_path = realpath($file_sync->getFullPath());
         if (file_exists($real_path)) {
             KalturaLog::log(__METHOD__ . " - file was found locally at [{$real_path}]");
             return file_get_contents($real_path);
         } else {
             KalturaLog::log(__METHOD__ . " - file was not found locally [{$real_path}]");
             if ($strict) {
                 throw new Exception("Cannot find file on local disk [{$real_path}] for file sync [" . $file_sync->getId() . "]");
             } else {
                 return null;
             }
         }
     }
     if ($fetch_from_remote_if_no_local) {
         // if $fetch_from_remote_if_no_local is false - $file_sync shoule be null , this if is in fact redundant
         // TODO - curl to the remote
         $content = kDataCenterMgr::retrieveFileFromRemoteDataCenter($file_sync);
         return $content;
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:23,代码来源:kFileSyncUtils.class.php


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