jenkins-bot has submitted this change and it was merged.

Change subject: mwconf: allow empty lines in extensions_load.txt
......................................................................


mwconf: allow empty lines in extensions_load.txt

It might convenient to have empty lines in the list of extensions to
load. For example:

 echo "
   mediawiki/extensions/foo
   mediawiki/extensions/bar
 " > deps.txt

Which is slightly nicer than:

 echo "mediawiki/extensions/foo
   mediawiki/extensions/bar" > deps.txt

Skip new lines when reading the extension_loads.txt file.
Test for the behavior.

Change-Id: Ic386007b6b00d9216333af55294097c3bd895d83
---
M mediawiki/conf.d/50_mw_ext_loader.php
M tests/mediawiki/conf.d/50_mw_ext_loaderTest.php
2 files changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, but someone else must approve
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/mediawiki/conf.d/50_mw_ext_loader.php 
b/mediawiki/conf.d/50_mw_ext_loader.php
index 65d6802..b5c6abc 100644
--- a/mediawiki/conf.d/50_mw_ext_loader.php
+++ b/mediawiki/conf.d/50_mw_ext_loader.php
@@ -39,7 +39,10 @@
 
        $loadFile = $IP . '/extensions_load.txt';
        if ( file_exists( $loadFile ) ) {
-               $ext_candidates = file( $loadFile, FILE_IGNORE_NEW_LINES );
+               $ext_candidates = file( $loadFile,
+                       FILE_IGNORE_NEW_LINES
+                       | FILE_SKIP_EMPTY_LINES
+               );
                $ext_candidates = array_map( function ( $entry ) {
                        return str_replace( 'mediawiki/extensions/', '', $entry 
);
                }, $ext_candidates );
diff --git a/tests/mediawiki/conf.d/50_mw_ext_loaderTest.php 
b/tests/mediawiki/conf.d/50_mw_ext_loaderTest.php
index 57fdee2..cafaf0e 100644
--- a/tests/mediawiki/conf.d/50_mw_ext_loaderTest.php
+++ b/tests/mediawiki/conf.d/50_mw_ext_loaderTest.php
@@ -157,4 +157,12 @@
                $this->assertNotLoaded( 'Must_not_be_loaded' );
                $this->assertLoaded( 'GerritRepoName' );
        }
+
+       function testLoadFromFileWithEmptyLines() {
+               $this->fakeExtension( 'One' );
+               $this->createLoadFile( array( 'One', "\n" ) );
+               $this->runLoader();
+               $this->assertLoaded( 'One' );
+       }
+
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/183884
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic386007b6b00d9216333af55294097c3bd895d83
Gerrit-PatchSet: 4
Gerrit-Project: integration/jenkins
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to