From 21e747a726b4822cbae240522864cc3998d7cd83 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Tue, 17 Nov 2009 17:26:19 +0000 Subject: [PATCH] syntaxChecker: added option --modified to check only modified or added files within a SVN repo --- maintenance/syntaxChecker.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/maintenance/syntaxChecker.php b/maintenance/syntaxChecker.php index 4850be9f7f..1899b0f4d7 100644 --- a/maintenance/syntaxChecker.php +++ b/maintenance/syntaxChecker.php @@ -25,7 +25,7 @@ require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class SyntaxChecker extends Maintenance { // List of files we're going to check - private $mFiles, $mFailures = array(), $mWarnings = array(); + private $mFiles = array(), $mFailures = array(), $mWarnings = array(); public function __construct() { parent::__construct(); @@ -33,6 +33,7 @@ class SyntaxChecker extends Maintenance { $this->addOption( 'with-extensions', 'Also recurse the extensions folder' ); $this->addOption( 'file', 'Specific file to check, either with absolute path or relative to the root of this MediaWiki installation', false, true); + $this->addOption( 'modified', 'Check only files that were modified (requires SVN command-line client)' ); } protected function getDbType() { @@ -77,6 +78,19 @@ class SyntaxChecker extends Maintenance { $this->mFiles[] = $file; $this->output( "Checking file $file.\n" ); return; // process only this file + } elseif ( $this->hasOption( 'modified' ) ) { + $this->output( "Retrieving list from Subversion... " ); + $parentDir = wfEscapeShellArg( dirname( __FILE__ ) . '/..' ); + $output = wfShellExec( "svn status --ignore-externals $parentDir", $retval ); + if ( $retval ) { + $this->error( "Error retrieving list from Subversion!\n", true ); + } else { + $this->output( "done\n" ); + } + + preg_match_all( '/^\s*[AM]\s+(.*?)\r?$/m', $output, $matches ); + $this->mFiles = array_merge( $this->mFiles, $matches[1] ); + return; } $this->output( "Building file list..." ); -- 2.20.1