Ejemplo n.º 1
0
 /**
  * will return a pair of file_root and file_path
  * This is the only function that should be extended for building a different path
  *
  * @param ISyncableFile $object
  * @param int $subType
  * @param $version
  */
 public function generateFilePathArr(ISyncableFile $object, $subType, $version = null)
 {
     //		$traces = debug_backtrace(false);
     //		foreach($traces as $i => $trace)
     //		{
     //			$file = $trace['file'];
     //			$line = $trace['line'];
     //			$class = $trace['class'];
     //			$function = $trace['function'];
     //			KalturaLog::debug("#$i Called from function [$class::$function] file[$file] line[$line]");
     //		}
     list($root, $path) = $object->generateFilePathArr($subType, $version);
     $root = str_replace('//', '/', $root);
     $path = str_replace('//', '/', $path);
     if (!kConf::hasParam('volumes')) {
         KalturaLog::debug("Path [{$root}{$path}]");
         return array($root, $path);
     }
     if (isset(self::$sessionCache[$path])) {
         return array($root, self::$sessionCache[$path]);
     }
     $volumes = kConf::get('volumes');
     $volume = $volumes[rand(0, count($volumes) - 1)];
     $newPath = str_replace('/content/', "/content/{$volume}/", $path);
     self::$sessionCache[$path] = $newPath;
     $path = $newPath;
     KalturaLog::debug("Path [{$root}{$path}]");
     return array($root, $path);
 }