Source for file Ethna_Plugin_Handle_ChannelUpdate.php

Documentation is available at Ethna_Plugin_Handle_ChannelUpdate.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  Ethna_Plugin_Handle_ChannelUpdate.php
  5.  *
  6.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id$
  10.  */
  11.  
  12. require_once ETHNA_BASE '/class/Ethna_PearWrapper.php';
  13.  
  14. // {{{ Ethna_Plugin_Handle_ChannelUpdate
  15. /**
  16.  *  info-plugin handler
  17.  *
  18.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  19.  *  @access     public
  20.  *  @package    Ethna
  21.  */
  22. {
  23.     // {{{ _parseArgList()
  24.     /**
  25.      * @access private
  26.      */
  27.     function &_parseArgList()
  28.     {
  29.         $r =$this->_getopt(array('local''master''basedir=',
  30.                                    'channel=''pearopt='));
  31.         if (Ethna::isError($r)) {
  32.             return $r;
  33.         }
  34.         list($opt_list$arg_list$r;
  35.         $ret array();
  36.  
  37.         // options
  38.         $ret['target'= isset($opt_list['master']'master' 'local';
  39.         if (isset($opt_list['basedir'])) {
  40.             $ret['basedir'end($opt_list['basedir']);
  41.         }
  42.         if (isset($opt_list['channel'])) {
  43.             $ret['channel'end($opt_list['channel']);
  44.         }
  45.  
  46.         return $ret;
  47.     }
  48.     // }}}
  49.  
  50.     // {{{ perform()
  51.     /**
  52.      *  @access public
  53.      */
  54.     function perform()
  55.     {
  56.         $args =$this->_parseArgList();
  57.         if (Ethna::isError($args)) {
  58.             return $args;
  59.         }
  60.  
  61.         $pear =new Ethna_PearWrapper();
  62.         if (isset($args['pearopt'])) {
  63.             $pear->setPearOpt($args['pearopt']);
  64.         }
  65.  
  66.         $target = isset($args['target']$args['target'null;
  67.         $channel = isset($args['channel']$args['channel'null;
  68.         $basedir = isset($args['basedir']realpath($args['basedir']getcwd();
  69.  
  70.         $r =$pear->init($target$basedir$channel);
  71.         if (Ethna::isError($r)) {
  72.             return $r;
  73.         }
  74.  
  75.         $r =$pear->doClearCache();
  76.         if (Ethna::isError($r)) {
  77.             return $r;
  78.         }
  79.  
  80.         $r =$pear->doChannelUpdate();
  81.         if (Ethna::isError($r)) {
  82.             return $r;
  83.         }
  84.  
  85.         return true;
  86.     }
  87.     // }}}
  88.  
  89.     // {{{ getDescription()
  90.     /**
  91.      *  @access public
  92.      */
  93.     function getDescription()
  94.     {
  95.         return <<<EOS
  96. update package repositry channel:
  97.     {$this->id} [-c|--channel=channel] [-b|--basedir=dir] [-l|--local] [-m|--master]
  98.  
  99. EOS;
  100.     }
  101.     // }}}
  102.  
  103.     // {{{ getUsage()
  104.     /**
  105.      *  @access public
  106.      */
  107.     function getUsage()
  108.     {
  109.         return <<<EOS
  110. ethna {$this->id} [-c|--channel=channel] [-b|--basedir=dir] [-l|--local] [-m|--master] [type name]
  111. EOS;
  112.     }
  113.     // }}}
  114. }
  115. // }}}
  116. ?>

Documentation generated on Fri, 11 Nov 2011 04:00:25 +0900 by phpDocumentor 1.4.3