Changeset 342

Show
Ignore:
Timestamp:
01/21/08 14:49:48 (6 months ago)
Author:
mrook
Message:

#207 - Add php.interpreter property, use property in PhpLintTask

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.3/classes/phing/Phing.php

    r332 r342  
    11081108                        case 'WINNT': 
    11091109                                self::setProperty('host.fstype', 'WINNT'); 
     1110                                self::setProperty('php.interpreter', getenv('PHP_COMMAND')); 
    11101111                                break; 
    11111112                        case 'WIN32': 
  • branches/2.3/classes/phing/tasks/ext/PhpLintTask.php

    r325 r342  
    3737        protected $haltOnFailure = false; 
    3838        protected $hasErrors = false; 
    39     private $badFiles = array(); 
     39        private $badFiles = array(); 
     40        protected $interpreter = ''; // php interpreter to use for linting 
     41 
     42    /** 
     43     * Initialize the interpreter with the Phing property 
     44     */ 
     45    public function __construct() { 
     46        $this->setInterpreter(Phing::getProperty('php.interpreter')); 
     47    } 
     48 
     49        /** 
     50         * Override default php interpreter 
     51         * @todo        Do some sort of checking if the path is correct but would  
     52         *                      require traversing the systems executeable path too 
     53         * @param       string  $sPhp 
     54         */ 
     55        public function setInterpreter($sPhp) { 
     56                $this->Interpreter = $sPhp; 
     57        } 
    4058 
    4159        /** 
     
    106124         */ 
    107125        protected function lint($file) { 
    108                 $command = 'php -l '; 
     126        $command = $this->Interpreter == '' 
     127            ? 'php' 
     128            : $this->Interpreter; 
     129        $command .= ' -l '; 
    109130                if(file_exists($file)) { 
    110131                        if(is_readable($file)) { 
     
    136157 
    137158 
     159 
  • branches/2.3/docs/phing_guide/book/chapters/appendixes/AppendixC-OptionalTasks.html

    r329 r342  
    11961196      <td>The name of a property that will be set to contain the error string (if any).</td> 
    11971197      <td>n/a</td> 
     1198      <td>No</td> 
     1199    </tr> 
     1200    <tr> 
     1201      <td>interpreter</td> 
     1202      <td>string</td> 
     1203      <td>Path to alternative PHP interpreter</td> 
     1204      <td>Defaults to the <tt>${php.command}</tt> property which is the 
     1205          interpreter used to execute phing itself.</td> 
    11981206      <td>No</td> 
    11991207    </tr>