[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/file/unpacker/ -> rarunpacker.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/file/unpacker/baseunpacker.class.php" );
   4  
   5      /**
   6       * \ingroup File_Unpacker
   7       *
   8       * extends the BaseUnpacker class to implement support for RAR files
   9       *
  10       * It users the binary "unrar" and "gzip" to unpack the files. The location of these binaries
  11       * is obtained from the config parameter "path_to_unrar" (or /usr/bin/unrar)
  12       */
  13      class RarUnpacker extends BaseUnpacker
  14      {
  15  
  16      	function RarUnpacker()
  17          {
  18              $this->BaseUnpacker();
  19          }
  20  
  21          /**
  22           * @see BaseUnpacker::unpack()
  23           */
  24          function unpack( $file, $destFolder )
  25          {
  26              // get the paths where tar and gz are
  27              $config =& Config::getConfig();
  28              $unrarPath = $config->getValue( "path_to_unrar" );
  29              if( $unrarPath == "" )
  30                  $unrarPath = DEFAULT_UNRAR_PATH;
  31  
  32              $cmd = "$unrarPath x $file $destFolder";
  33  
  34              $result = exec( $cmd, $output, $retval );
  35  
  36              //
  37              // :KLUDGE:
  38              // apparently, we should get something in $retval but there's nothing
  39              // to the only way I've found to check if the command finished
  40              // successfully was checking if the $output array is full or empty
  41              //
  42  
  43              return ( $retval == 0 );
  44          }
  45       }
  46  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics