require_once instead of depending on the return value of include_once
authorMukunda Modell <mmodell@wikimedia.org>
Wed, 22 Apr 2015 22:34:25 +0000 (17:34 -0500)
committerMukunda Modell <mmodell@wikimedia.org>
Wed, 22 Apr 2015 22:37:19 +0000 (17:37 -0500)
return value from include_once is unreliable, it could be the value
of a 'return;' statement in the included file, or it could be false
when the file wasn't readable. This was breaking deployments because
one of the extensions had "return;" which caused include_once to
return a falsy value.

Change-Id: I48b9a55d5f9e85efe515d87b56b60ee71f939842

maintenance/mergeMessageFileList.php

index 43fa460..b491497 100644 (file)
@@ -173,10 +173,8 @@ foreach ( $mmfl['setupFiles'] as $fileName ) {
        // Using extension.json or skin.json
        if ( substr( $fileName, -strlen( '.json' ) ) === '.json' ) {
                $queue[$fileName] = 1;
-       } elseif ( !( include_once $fileName ) ) {
-               // Include the extension to update $wgExtensionMessagesFiles
-               fwrite( STDERR, "Unable to read $fileName\n" );
-               exit( 1 );
+       } else {
+               require_once $fileName;
        }
 }