| [ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 3 /** 4 * Driver for using mkisofs for creating ISO images. 5 * 6 * $Horde: framework/VFS_ISOWriter/ISOWriter/mkisofs.php,v 1.1.8.5 2006/01/01 21:28:43 jan Exp $ 7 * 8 * Copyright 2004-2006 Cronosys, LLC <http://www.cronosys.com/> 9 * 10 * See the enclosed file COPYING for license information (LGPL). If you 11 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 12 * 13 * @author Jason M. Felice <jfelice@cronosys.com> 14 * @package VFS_ISO 15 * @since Horde 3.0 16 */ 17 class VFS_ISOWriter_mkisofs extends VFS_ISOWriter { 18 19 function process() 20 { 21 require_once dirname(__FILE__) . '/RealInputStrategy.php'; 22 $inputStrategy = &VFS_ISOWriter_RealInputStrategy::factory($this->_sourceVfs, $this->_params['sourceRoot']); 23 if (is_a($inputStrategy, 'PEAR_Error')) { 24 return $inputStrategy; 25 } 26 27 require_once dirname(__FILE__) . '/RealOutputStrategy.php'; 28 $outputStrategy = &VFS_ISOWriter_RealOutputStrategy::factory($this->_targetVfs, $this->_params['targetFile']); 29 if (is_a($outputStrategy, 'PEAR_Error')) { 30 return $outputStrategy; 31 } 32 33 $cmd = sprintf('mkisofs -quiet -r -J -o %s %s >/dev/null', 34 escapeshellarg($outputStrategy->getRealFilename()), 35 escapeshellarg($inputStrategy->getRealPath())); 36 $res = system($cmd, $ec); 37 38 /* Could be a lot of space used. Give both a chance to clean up even 39 * if one errors out. */ 40 $finRes1 = $inputStrategy->finished(); 41 $finRes2 = $outputStrategy->finished(); 42 if (is_a($finRes1, 'PEAR_Error')) { 43 return $finRes1; 44 } 45 if (is_a($finRes2, 'PEAR_Error')) { 46 return $finRes2; 47 } 48 49 if ($res === false) { 50 return PEAR::raiseError(_("Unable to run 'mkisofs'.")); 51 } 52 if ($ec != 0) { 53 return PEAR::raiseError(sprintf(_("mkisofs error code %d while making ISO."), $ec)); 54 } 55 } 56 57 /** 58 * Determine if we can use this driver to make images 59 * 60 * @static 61 * 62 * @return boolean Whether we can use this strategy for making ISO images. 63 */ 64 function strategyAvailable() 65 { 66 /* Check if we can find and execute the `mkisofs' command. */ 67 $res = system("mkisofs -help >/dev/null 2>&1", $ec); 68 if ($res === false) { 69 return false; 70 } 71 if ($ec != 0) { 72 return false; 73 } 74 return true; 75 } 76 77 } 78
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |