Merge "Make variant selection menu toggleable by keyboard"
[lhc/web/wiklou.git] / maintenance / mergeMessageFileList.php
index 243c2dd..75b7ef0 100644 (file)
@@ -25,7 +25,7 @@
 # Start from scratch
 define( 'MW_NO_EXTENSION_MESSAGES', 1 );
 
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
 $maintClass = 'MergeMessageFileList';
 $mmfl = false;
 
@@ -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;
@@ -98,7 +107,7 @@ foreach ( $mmfl['setupFiles'] as $fileName ) {
        if ( empty( $mmfl['quiet'] ) ) {
                fwrite( STDERR, "Loading data from $fileName\n" );
        }
-       if ( !include_once( $fileName ) ) {
+       if ( !( include_once $fileName ) ) {
                fwrite( STDERR, "Unable to read $fileName\n" );
                exit( 1 );
        }