[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Pear/PEAR/ -> Mirror.php (source)

   1  <?php
   2  //
   3  // +----------------------------------------------------------------------+
   4  // | PHP Version 5                                                        |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 1997-2004 The PHP Group                                |
   7  // +----------------------------------------------------------------------+
   8  // | This source file is subject to version 3.0 of the PHP license,       |
   9  // | that is bundled with this package in the file LICENSE, and is        |
  10  // | available through the world-wide-web at the following url:           |
  11  // | http://www.php.net/license/3_0.txt.                                  |
  12  // | If you did not receive a copy of the PHP license and are unable to   |
  13  // | obtain it through the world-wide-web, please send a note to          |
  14  // | license@php.net so we can mail you a copy immediately.               |
  15  // +----------------------------------------------------------------------+
  16  // | Author: Alexander Merz <alexmerz@php.net>                            |
  17  // |                                                                      |
  18  // +----------------------------------------------------------------------+
  19  //
  20  // $Id: Mirror.php,v 1.5 2004/03/18 12:23:57 mj Exp $
  21  
  22  require_once "PEAR/Command/Common.php";
  23  require_once "PEAR/Command.php";
  24  require_once "PEAR/Remote.php";
  25  require_once "PEAR.php";
  26  
  27  /**
  28   * PEAR commands for providing file mirrors
  29   *
  30   */
  31  class PEAR_Command_Mirror extends PEAR_Command_Common
  32  {
  33      // {{{ properties
  34  
  35      var $commands = array(
  36          'download-all' => array(
  37              'summary' => 'Downloads each available package from master_server',
  38              'function' => 'doDownloadAll',
  39              'shortcut' => 'da',
  40              'options' => array(),
  41              'doc' => '
  42          Requests a list of available packages from the package server
  43          (master_server) and downloads them to current working directory'
  44              ),
  45          );
  46  
  47      // }}}
  48  
  49      // {{{ constructor
  50  
  51      /**
  52       * PEAR_Command_Mirror constructor.
  53       *
  54       * @access public
  55       * @param object PEAR_Frontend a reference to an frontend
  56       * @param object PEAR_Config a reference to the configuration data
  57       */
  58      function PEAR_Command_Mirror(&$ui, &$config)
  59      {
  60          parent::PEAR_Command_Common($ui, $config);
  61      }
  62  
  63      // }}}
  64  
  65      // {{{ doDownloadAll()
  66      /**
  67      * retrieves a list of avaible Packages from master server
  68      * and downloads them
  69      *
  70      * @access public
  71      * @param string $command the command
  72      * @param array $options the command options before the command
  73      * @param array $params the stuff after the command name
  74      * @return bool true if succesful
  75      * @throw PEAR_Error 
  76      */
  77      function doDownloadAll($command, $options, $params)
  78      {
  79          $this->config->set("php_dir", "."); 
  80          $remote = &new PEAR_Remote($this->config);
  81          $remoteInfo = $remote->call("package.listAll");
  82          if (PEAR::isError($remoteInfo)) {
  83              return $remoteInfo;
  84          }
  85          $cmd = &PEAR_Command::factory("download", $this->config);
  86          if (PEAR::isError($cmd)) {
  87              return $cmd;
  88          }
  89          foreach ($remoteInfo as $pkgn => $pkg) {
  90              /**
  91               * Error handling not neccesary, because already done by 
  92               * the download command
  93               */
  94              $cmd->run("download", array(), array($pkgn));
  95          }
  96  
  97          return true;
  98      }
  99  
 100      // }}}
 101  }


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7