PEAR_PackageUpdate
[ class tree: PEAR_PackageUpdate ] [ index: PEAR_PackageUpdate ] [ all elements ]

Source for file Cli.php

Documentation is available at Cli.php

  1. <?php
  2. /**
  3.  * This is the default CLI driver for PEAR_PackageUpdate.
  4.  *
  5.  * PHP versions 4 and 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.01 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @category PEAR
  14.  * @package  PEAR_PackageUpdate
  15.  * @author   Laurent Laville <pear@laurent-laville.org>
  16.  * @license  http://www.php.net/license/3_01.txt  PHP License 3.01
  17.  * @version  CVS: $Id: Cli.php,v 1.4 2007/11/25 16:23:47 farell Exp $
  18.  * @link     http://pear.php.net/package/PEAR_PackageUpdate
  19.  * @since    File available since Release 0.6.0
  20.  */
  21.  
  22.  
  23. /**
  24.  * This is the default CLI driver for PEAR_PackageUpdate.
  25.  *
  26.  * A package to make adding self updating functionality to other
  27.  * packages easy.
  28.  *
  29.  * EXAMPLE:
  30.  * <code>
  31.  * <?php
  32.  *     require_once 'PEAR/PackageUpdate.php';
  33.  *     // check for updates of PEAR::Config package
  34.  *     $ppu =& PEAR_PackageUpdate::factory('Cli', 'Config', 'pear');
  35.  *     if ($ppu !== false) {
  36.  *         // Check for new stable and minor changes version
  37.  *         $ppu->setMinimumState(PEAR_PACKAGEUPDATE_STATE_STABLE);
  38.  *         $ppu->setMinimumReleaseType(PEAR_PACKAGEUPDATE_TYPE_MINOR);
  39.  *         if ($ppu->checkUpdate()) {
  40.  *             // Update your local copy
  41.  *             if ($ppu->update()) {
  42.  *                 include_once 'Config.php';
  43.  *             }
  44.  *         }
  45.  *     }
  46.  * ?>
  47.  * </code>
  48.  *
  49.  * @category PEAR
  50.  * @package  PEAR_PackageUpdate
  51.  * @author   Laurent Laville <pear@laurent-laville.org>
  52.  * @license  http://www.php.net/license/3_01.txt  PHP License 3.01
  53.  * @version  Release: @package_version@
  54.  * @link     http://pear.php.net/package/PEAR_PackageUpdate
  55.  * @since    Class available since Release 0.6.0
  56.  */
  57.  
  58. {
  59.     /**
  60.      * Cli driver class constructor
  61.      *
  62.      * @param string $packageName The package to update.
  63.      * @param string $channel     The channel the package resides on.
  64.      * @param string $user_file   (optional) file to read PEAR user-defined
  65.      *                             options from
  66.      * @param string $system_file (optional) file to read PEAR system-wide
  67.      *                             defaults from
  68.      * @param string $pref_file   (optional) file to read PPU user-defined
  69.      *                             options from
  70.      *
  71.      * @access public
  72.      * @return void 
  73.      * @since  0.6.0
  74.      */
  75.     function PEAR_PackageUpdate_Cli($packageName$channel,
  76.         $user_file ''$system_file ''$pref_file '')
  77.     {
  78.         parent::PEAR_PackageUpdate($packageName$channel,
  79.             $user_file$system_file$pref_file);
  80.     }
  81.  
  82.     /**
  83.      * Cli driver does not redirects or exits
  84.      * to force the user to restart the application.
  85.      *
  86.      * @access public
  87.      * @return void 
  88.      * @since  0.6.0
  89.      */
  90.     function forceRestart()
  91.     {
  92.     }
  93.  
  94.     /**
  95.      * Cli driver does not present any frontend when an update is needed
  96.      *
  97.      * @access public
  98.      * @return boolean Always true
  99.      * @since  0.6.0
  100.      */
  101.     function presentUpdate()
  102.     {
  103.         // always update the package to latest version depending of options
  104.         // see    setMinimumState(), setMinimumReleaseType()
  105.         return true;
  106.     }
  107. }
  108. ?>

Documentation generated on Sun, 15 Jun 2008 10:30:04 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.