Changeset 12787

Show
Ignore:
Timestamp:
10/12/11 18:05:54 (2 years ago)
Author:
p_lindheimer
Message:

fix syntax checking and some typos

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/package.php

    r12785 r12787  
    149149   
    150150  //check php files for syntax errors 
    151   if ($vars['checkphp']) { 
    152     //get a recursivle list of all files 
    153     $files = scandirr($mod, true); 
    154     foreach ($files as $f) { 
    155       //if its a php file, test it 
    156       if (pathinfo($f, PATHINFO_EXTENSION) == 'php') { 
    157         if (!system('php -l ' . $f)) { 
    158           echo('syntaxt error detected in ' . $f . ',' .  $mod . ' won\'t be packaged' . PHP_EOL); 
    159           continue 2; 
    160         } 
     151  $bail = false; 
     152  $files = scandirr($mod, true); 
     153  foreach ($files as $f) { 
     154    if (pathinfo($f, PATHINFO_EXTENSION) == 'php') { 
     155      $ret_val = 0; 
     156      system('php -l ' . $f, $ret_val); 
     157      if ($ret_val != 0) { 
     158        echo('syntax error detected in ' . $f . ',' .  $mod . ' won\'t be packaged' . PHP_EOL); 
     159        $bail=true; // finish scanning all files before bailing 
    161160      } 
    162161    } 
     162  } 
     163  if ($bail && $vars['checkphp']) { 
     164    echo('syntax error detecteded in ' .  $mod . ' skipping packaging going to next' . PHP_EOL); 
     165    continue; 
    163166  } 
    164167   
     
    269272} 
    270273 
    271 //runs systems commands, or echo's them 
    272 function run_cmd($cmd, $quite = false) { 
     274function run_cmd($cmd, $quiet = false) { 
    273275  global $vars; 
    274   $quite = $quite ? ' > /dev/null' : ''; 
     276  $quiet = $quiet ? ' > /dev/null' : ''; 
    275277 
    276278  if ($vars['debug']) { 
     
    281283    echo PHP_EOL . '+' . $bt[0]["file"] . ':' . $bt[0]["line"] . PHP_EOL; 
    282284    echo "\t" . $cmd . PHP_EOL; 
    283     return system($cmd . $quite); 
     285    return system($cmd . $quiet); 
    284286  } else { 
    285     return system($cmd . $quite); 
     287    return system($cmd . $quiet); 
    286288  } 
    287289} 
     
    315317  return array($rawname, $ver); 
    316318} 
     319 
    317320?>