Пример #1
0
 /**
  * Returns a XML Resource filename for the uncompressed contents of the provided zipped $filename
  *
  * @param string $filename of zipped XML data
  *
  * @throws Exception ZipArchive extension is not loaded or the ZIP file is corrupt
  *
  * @return string Full filename and path of extracted XML file
  */
 private static function getZippedFile($filename)
 {
     if (!self::zipModuleLoaded()) {
         throw new Exception('The ZipArchive extension is not loaded. Load the extension or use the flat wurfl.xml file');
     }
     $tmpDir = FileUtils::getTempDir();
     $zip = new \ZipArchive();
     if ($zip->open($filename) !== true) {
         throw new Exception('The Zip file <$filename> could not be opened');
     }
     $zippedFile = $zip->statIndex(0);
     $wurflFile = $zippedFile['name'];
     $zip->extractTo($tmpDir);
     $zip->close();
     return FileUtils::cleanFilename($tmpDir . DIRECTORY_SEPARATOR . $wurflFile);
 }
Пример #2
0
 public function getFileLockPath()
 {
     return FileUtils::getTempDir() . '/wurfl_builder_' . md5(WurflConstants::API_VERSION . __DIR__) . '.lock';
 }