Index: trunk/phase3/maintenance/syntaxChecker.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | class SyntaxChecker extends Maintenance { |
27 | 27 | |
28 | 28 | // List of files we're going to check |
29 | | - private $mFiles, $mFailures = array(), $mWarnings = array(); |
| 29 | + private $mFiles = array(), $mFailures = array(), $mWarnings = array(); |
30 | 30 | |
31 | 31 | public function __construct() { |
32 | 32 | parent::__construct(); |
— | — | @@ -33,6 +33,7 @@ |
34 | 34 | $this->addOption( 'with-extensions', 'Also recurse the extensions folder' ); |
35 | 35 | $this->addOption( 'file', 'Specific file to check, either with absolute path or relative to the root of this MediaWiki installation', |
36 | 36 | false, true); |
| 37 | + $this->addOption( 'modified', 'Check only files that were modified (requires SVN command-line client)' ); |
37 | 38 | } |
38 | 39 | |
39 | 40 | protected function getDbType() { |
— | — | @@ -77,6 +78,19 @@ |
78 | 79 | $this->mFiles[] = $file; |
79 | 80 | $this->output( "Checking file $file.\n" ); |
80 | 81 | return; // process only this file |
| 82 | + } elseif ( $this->hasOption( 'modified' ) ) { |
| 83 | + $this->output( "Retrieving list from Subversion... " ); |
| 84 | + $parentDir = wfEscapeShellArg( dirname( __FILE__ ) . '/..' ); |
| 85 | + $output = wfShellExec( "svn status --ignore-externals $parentDir", $retval ); |
| 86 | + if ( $retval ) { |
| 87 | + $this->error( "Error retrieving list from Subversion!\n", true ); |
| 88 | + } else { |
| 89 | + $this->output( "done\n" ); |
| 90 | + } |
| 91 | + |
| 92 | + preg_match_all( '/^\s*[AM]\s+(.*?)\r?$/m', $output, $matches ); |
| 93 | + $this->mFiles = array_merge( $this->mFiles, $matches[1] ); |
| 94 | + return; |
81 | 95 | } |
82 | 96 | |
83 | 97 | $this->output( "Building file list..." ); |