private static function getConfig($os, $osTypes, $version = null)
 {
     if (!self::$config) {
         $filename = __DIR__ . '/../config/' . self::INI_FILE_NAME;
         self::$config = parse_ini_file($filename, true);
     }
     if ($version) {
         $version = str_replace('.', '_', $version);
         if (!isset(self::$config[$version])) {
             return null;
         }
         $sections = array($version => self::$config[$version]);
     } else {
         uksort(self::$config, 'version_compare');
         $sections = array_reverse(self::$config, true);
     }
     $osFileType = null;
     foreach ($osTypes as $osType => $fileType) {
         if (strpos($os, $osType) === 0) {
             $osFileType = $fileType;
             break;
         }
     }
     foreach ($sections as $section) {
         if (isset($section[$osFileType])) {
             return explode(',', $section[$osFileType]);
         }
     }
     return null;
 }
Пример #2
0
 /**
  * Serve update file
  *
  * @action serveUpdate
  * @param string $os
  * @param string $version
  * @return file
  * @throws CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE
  */
 public function serveUpdateAction($os, $version)
 {
     $filename = kCaptureSpaceVersionManager::getUpdateFile($os, $version);
     if (!$filename) {
         throw new KalturaAPIException(CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE, $version, $os);
     }
     $actualFilePath = myContentStorage::getFSContentRootPath() . "/content/third_party/capturespace/{$filename}";
     if (!file_exists($actualFilePath)) {
         throw new KalturaAPIException(CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE, $version, $os);
     }
     $mimeType = kFile::mimeType($actualFilePath);
     header("Content-Disposition: attachment; filename=\"{$filename}\"");
     return $this->dumpFile($actualFilePath, $mimeType);
 }