From: Ori Livneh Date: Thu, 18 Jul 2013 22:46:18 +0000 (-0700) Subject: Discard comments in mergeMessageFileList.php's --list-file file X-Git-Tag: 1.31.0-rc.0~19135 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=17ad68087c561e39f5ff4abd6ada74d1de80c22c;p=lhc%2Fweb%2Fwiklou.git Discard comments in mergeMessageFileList.php's --list-file file We're currently working around a bug in an extension (bug 51643) by deviating from lexicographical order in extension-list to ensure that one extension is loaded before another. It'd be nice to be able to document that in the file itself, but there is no convention for adding comments to the file; mergeMessageFileList.php treats every line as a file name. We've previously talked about including a comment header in the file as part of our reponse to bug 50347. This patch adds some minimal syntax-handling to mergeMessageFileList.php which causes it to treat as a comment any substring starting with '#' and extending to the end of the line. This change implements part of what aude projected for Gerrit change 71056, but I don't see the harm in pushing ahead with it here. Change-Id: I4b296aa69ad77ecb51f1a0e27ce6a698cf09732b --- diff --git a/maintenance/mergeMessageFileList.php b/maintenance/mergeMessageFileList.php index 2b680d3cd9..b36a319dea 100644 --- a/maintenance/mergeMessageFileList.php +++ b/maintenance/mergeMessageFileList.php @@ -54,7 +54,16 @@ class MergeMessageFileList extends Maintenance { if ( $lines === false ) { $this->error( 'Unable to open list file.' ); } - $mmfl = array( 'setupFiles' => array_map( 'trim', $lines ) ); + $mmfl = array( 'setupFiles' => array() ); + + # Strip comments, discard empty lines, and trim leading and trailing + # whitespace. Comments start with '#' and extend to the end of the line. + foreach( $lines as $line ) { + $line = trim( preg_replace( '/#.*/', '', $line ) ); + if ( $line !== '' ) { + $mmfl['setupFiles'][] = $line; + } + } # Now find out files in a directory $hasError = false;