From 17ad68087c561e39f5ff4abd6ada74d1de80c22c Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Thu, 18 Jul 2013 15:46:18 -0700 Subject: [PATCH] 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 --- maintenance/mergeMessageFileList.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; -- 2.20.1