Changeset 13002 for modules/branches/2.10/package.php
- Timestamp:
- 12/07/11 14:22:24 (1 year ago)
- Files:
-
- modules/branches/2.10/package.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.10/package.php
r13001 r13002 150 150 151 151 //check php files for syntax errors 152 if ($vars['checkphp']) { 153 var_dump($tar_dir); 154 $files = package_scandirr($tar_dir, true, $file_scan_exclude_list); 155 foreach ($files as $f) { 156 if (pathinfo($f, PATHINFO_EXTENSION) == 'php') { 157 $ret_val = 0; 158 159 if (!run_cmd($vars['php_-l'] . ' ' . $f)) { 160 echo('syntax error detected in ' . $f . ', ' . $mod . ' won\'t be packaged' . PHP_EOL); 161 continue 2; 162 } 152 $bail = false; 153 $files = package_scandirr($tar_dir, true, $file_scan_exclude_list); 154 foreach ($files as $f) { 155 if (pathinfo($f, PATHINFO_EXTENSION) == 'php' || pathinfo($f, PATHINFO_EXTENSION) == 'agi') { 156 if (!run_cmd($vars['php_-l'] . ' ' . $f, $outline, false, true)) { 157 echo('syntax error detected in ' . $f . ', ' . $mod . ' won\'t be packaged' . PHP_EOL); 158 $bail=true; // finish scanning all files before bailing 163 159 } 164 160 } 165 unset($files, $list); 161 } 162 unset($files, $list); 163 if ($bail && $vars['checkphp']) { 164 echo('syntax error detecteded in ' . $mod . ' skipping packaging going to next' . PHP_EOL); 165 continue; 166 166 } 167 167 168 168 //check in any out standing files 169 if (run_cmd('svn st ' . $mod_dir . '|wc -l') > 0) { 169 run_cmd('svn st ' . $mod_dir . '|wc -l', $lines); 170 if ( $lines > 0) { 170 171 run_cmd('svn ci -m "Auto Check-in of any outstanding changes in ' . $mod . '" ' . $mod_dir); 171 172 } … … 214 215 215 216 //set latpublished property 216 $lastpub = run_cmd('svn info ' . $mod_dir . ' | grep Revision: | awk \'{print $2}\'');217 run_cmd('svn info ' . $mod_dir . ' | grep Revision: | awk \'{print $2}\'', $lastpub, false, true); 217 218 run_cmd('svn ps lastpublish ' . $lastpub . ' ' . $mod_dir); 218 219 … … 283 284 } 284 285 285 function run_cmd($cmd, $quiet = false) { 286 // if $duplex set to true and in debug mode, it will echo the command AND run it 287 function run_cmd($cmd, &$outline='', $quiet = false, $duplex = false) { 286 288 global $vars; 287 289 $quiet = $quiet ? ' > /dev/null' : ''; … … 289 291 if ($vars['debug']) { 290 292 echo $cmd . PHP_EOL; 291 return true; 292 } elseif($vars['verbose']) { 293 if (!$duplex) { 294 return true; 295 } 296 } 297 if ($vars['verbose']) { 293 298 $bt = debug_backtrace(); 294 299 echo PHP_EOL . '+' . $bt[0]["file"] . ':' . $bt[0]["line"] . PHP_EOL; 295 300 echo "\t" . $cmd . PHP_EOL; 296 system($cmd . $quiet, $ret_val);301 $outline = system($cmd . $quiet, $ret_val); 297 302 } else { 298 system($cmd . $quiet, $ret_val);303 $outline = system($cmd . $quiet, $ret_val); 299 304 } 300 305 return ($ret_val == 0);
