Show
Ignore:
Timestamp:
02/06/08 22:58:28 (10 months ago)
Author:
rambo
Message:

scripted whitespace normalization, see r14772

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/build/pearPackagePackage.php

    r12312 r14773  
    1717{ 
    1818 
    19        protected $channel = "pear.midcom-project.org"; 
     19    protected $channel = "pear.midcom-project.org"; 
    2020 
    21        function __construct() 
    22        
     21    function __construct() 
     22   
    2323        ini_set('memory_limit', '-1');  
    24        
     24   
    2525 
    26        protected $returnProperty; // name of property to set to return value 
     26    protected $returnProperty; // name of property to set to return value 
    2727 
    28        /** 
    29         * The path to where the module is stored. 
    30         */ 
    31        private $path = null; 
    32        /** 
    33         * The target directory where the packagefile should be saved. 
    34         */ 
    35        protected $target_dir = null; 
    36        /** 
    37         * The setter for the attribute "message" 
    38         */ 
    39        public function setTarget_dir($str) 
    40        
    41                $this->target_dir = $str; 
    42        
    43        public function setPath($str) 
    44        
    45                $this->path = $str; 
    46        
    47        public function setChannel($str) 
    48        
    49                $this->channel = $str; 
    50        
    51        /** Sets property name to set with return value of function or expression.*/ 
    52        public function setReturnProperty($r) 
    53        
    54                $this->returnProperty = $r; 
    55        
     28    /** 
     29    * The path to where the module is stored. 
     30    */ 
     31    private $path = null; 
     32    /** 
     33    * The target directory where the packagefile should be saved. 
     34    */ 
     35    protected $target_dir = null; 
     36    /** 
     37    * The setter for the attribute "message" 
     38    */ 
     39    public function setTarget_dir($str) 
     40   
     41        $this->target_dir = $str; 
     42   
     43    public function setPath($str) 
     44   
     45        $this->path = $str; 
     46   
     47    public function setChannel($str) 
     48   
     49        $this->channel = $str; 
     50   
     51    /** Sets property name to set with return value of function or expression.*/ 
     52    public function setReturnProperty($r) 
     53   
     54        $this->returnProperty = $r; 
     55   
    5656 
    57        protected $copyfiles = array(); 
     57    protected $copyfiles = array(); 
    5858 
    59        /** 
    60         * The init method: Do init steps. 
    61         */ 
    62        public function init()  {} 
     59    /** 
     60    * The init method: Do init steps. 
     61    */ 
     62    public function init()    {} 
    6363 
    64        /** 
    65         * The main entry point method. 
    66         */ 
    67        public function main() 
    68        
    69                if ($this->target_dir === null   
    70                        || !is_dir($this->target_dir)   
    71                ) { 
    72                        throw new Exception("You must set the target attribute to a writable directory (current: {$this->target_dir})!\n"); 
    73                
    74                $this->execPearPackage(); 
    75        
     64    /** 
     65    * The main entry point method. 
     66    */ 
     67    public function main() 
     68   
     69        if ($this->target_dir === null   
     70            || !is_dir($this->target_dir)   
     71        ) { 
     72            throw new Exception("You must set the target attribute to a writable directory (current: {$this->target_dir})!\n"); 
     73       
     74        $this->execPearPackage(); 
     75   
    7676 
    77         protected function execPearPackage() 
    78         { 
    79                 $curr_dir = getcwd(); 
    80                 chdir($this->target_dir); 
    81                 $pear = exec('which pear'); 
    82                 if (!is_executable($pear)) 
    83                 { 
    84                         die("Pear executable $pear is not executable!"); 
    85                 } 
    86                  
    87                 $ret = exec("$pear package-validate {$this->path}/package.xml", $out, $status); 
    88                 $out = null; 
    89                 if ($status == 0) 
    90                 { 
    91                         $ret = exec("$pear package {$this->path}/package.xml", $out, $status); 
    92                         foreach ($out as $line) { 
    93                                 if (stripos($line, 'error')) { 
    94                                         echo $line . "\n"; 
    95                                 } 
    96                                 if (stripos($line, 'warning')) { 
    97                                         echo $line . "\n"; 
    98                                 } 
    99                                  
    100                         } 
    101                          
    102                 }  
    103                 else  
    104                 { 
    105                         chdir($curr_dir); 
    106                         if (!is_null($out)) 
    107                         { 
    108                         echo implode($out); 
     77    protected function execPearPackage() 
     78    { 
     79        $curr_dir = getcwd(); 
     80        chdir($this->target_dir); 
     81        $pear = exec('which pear'); 
     82        if (!is_executable($pear)) 
     83        { 
     84            die("Pear executable $pear is not executable!"); 
     85        } 
     86         
     87        $ret = exec("$pear package-validate {$this->path}/package.xml", $out, $status); 
     88        $out = null; 
     89        if ($status == 0) 
     90        { 
     91            $ret = exec("$pear package {$this->path}/package.xml", $out, $status); 
     92            foreach ($out as $line) { 
     93                if (stripos($line, 'error')) { 
     94                    echo $line . "\n"; 
     95                } 
     96                if (stripos($line, 'warning')) { 
     97                    echo $line . "\n"; 
     98                } 
     99                 
    109100            } 
    110                         die ("Packagefile did not validate! Exiting."); 
    111                 } 
    112                 chdir($curr_dir); 
    113                  
    114         } 
     101             
     102        }  
     103        else  
     104        { 
     105            chdir($curr_dir); 
     106            if (!is_null($out)) 
     107            { 
     108                echo implode($out); 
     109            } 
     110            die ("Packagefile did not validate! Exiting."); 
     111        } 
     112        chdir($curr_dir); 
     113         
     114    } 
    115115} 
    116116?>