[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/VFS/ -> ISOWriter.php (source)

   1  <?php
   2  
   3  require_once 'PEAR.php';
   4  
   5  /**
   6   * VFS API for abstracted creation of ISO (CD-ROM) filesystems.
   7   *
   8   * $Horde: framework/VFS_ISOWriter/ISOWriter.php,v 1.1.8.7 2006/01/01 21:28:43 jan Exp $
   9   *
  10   * Copyright 2004-2006 Cronosys, LLC <http://www.cronosys.com/>
  11   *
  12   * See the enclosed file COPYING for license information (LGPL). If you
  13   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  14   *
  15   * @author  Jason M. Felice <jfelice@cronosys.com>
  16   * @package VFS_ISO
  17   * @since   Horde 3.0
  18   */
  19  class VFS_ISOWriter {
  20  
  21      /**
  22       * A VFS object used for reading the source files
  23       *
  24       * @var VFS
  25       */
  26      var $_sourceVfs = null;
  27  
  28      /**
  29       * A VFS object used for writing the ISO image
  30       *
  31       * @var VFS
  32       */
  33      var $_targetVfs = null;
  34  
  35      /**
  36       * Hash containing connection parameters.
  37       *
  38       * @var array
  39       */
  40      var $_params = array();
  41  
  42      /**
  43       * Constructs a new VFS_ISOWriter object
  44       *
  45       * @param array $params  A hash containing parameters.
  46       */
  47      function VFS_ISOWriter(&$sourceVfs, &$targetVfs, $params)
  48      {
  49          $this->_sourceVfs = &$sourceVfs;
  50          $this->_targetVfs = &$targetVfs;
  51          $this->_params = $params;
  52      }
  53  
  54      /**
  55       * Create the ISO image
  56       *
  57       * @abstract
  58       *
  59       * @return mixed  Null or PEAR_Error on failure.
  60       */
  61      function process()
  62      {
  63          return PEAR::raiseError(_("Not implemented."));
  64      }
  65  
  66      /**
  67       * Attempt to create a concrete VFS_ISOWriter subclass.
  68       *
  69       * This method uses its parameters and checks the system to determine
  70       * the most appropriate subclass to use for building ISO images.  If
  71       * none is found, an error is raised.
  72       *
  73       * @param object &$sourceVfs      Reference to the VFS object from which
  74       *                                the files will be read to create the
  75       *                                ISO image.
  76       * @param object &$targetVfs      Reference to the VFS object to which the
  77       *                                ISO image will be written.
  78       * @param array $params           Hash of parameters for creating the
  79       *                                image:
  80       *              'sourceRoot' =>     A directory in the source VFS for
  81       *                                  files to be read from for the image.
  82       *              'targetFile' =>     Path and filename of the ISO file to
  83       *                                  write into the target VFS.
  84       *
  85       * @return object                 A newly created concrete VFS_ISOWriter
  86       *                                subclass, or a PEAR_Error on an error.
  87       */
  88      function &factory(&$sourceVfs, &$targetVfs, $params)
  89      {
  90          if (empty($params['targetFile'])) {
  91              return PEAR::raiseError(_("Cannot proceed without 'targetFile' parameter."));
  92          }
  93          if (empty($params['sourceRoot'])) {
  94              $params['sourceRoot'] = '/';
  95          }
  96  
  97          /* Right now, mkisofs is the only driver, but make sure we can
  98           * support it. */
  99          require_once dirname(__FILE__) . '/ISOWriter/mkisofs.php';
 100          if (VFS_ISOWriter_mkisofs::strategyAvailable()) {
 101              $isowriter = &new VFS_ISOWriter_mkisofs($sourceVfs, $targetVfs,
 102                                                      $params);
 103              return $isowriter;
 104          }
 105  
 106          return PEAR::raiseError(_("No available strategy for making ISO images."));
 107      }
 108  
 109  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7