r59175 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59174‎ | r59175 | r59176 >
Date:17:26, 17 November 2009
Author:maxsem
Status:deferred
Tags:
Comment:
syntaxChecker: added option --modified to check only modified or added files within a SVN repo
Modified paths:
  • /trunk/phase3/maintenance/syntaxChecker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/syntaxChecker.php
@@ -25,7 +25,7 @@
2626 class SyntaxChecker extends Maintenance {
2727
2828 // List of files we're going to check
29 - private $mFiles, $mFailures = array(), $mWarnings = array();
 29+ private $mFiles = array(), $mFailures = array(), $mWarnings = array();
3030
3131 public function __construct() {
3232 parent::__construct();
@@ -33,6 +33,7 @@
3434 $this->addOption( 'with-extensions', 'Also recurse the extensions folder' );
3535 $this->addOption( 'file', 'Specific file to check, either with absolute path or relative to the root of this MediaWiki installation',
3636 false, true);
 37+ $this->addOption( 'modified', 'Check only files that were modified (requires SVN command-line client)' );
3738 }
3839
3940 protected function getDbType() {
@@ -77,6 +78,19 @@
7879 $this->mFiles[] = $file;
7980 $this->output( "Checking file $file.\n" );
8081 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;
8195 }
8296
8397 $this->output( "Building file list..." );

Status & tagging log