TTO has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/299286

Change subject: Make importTextFiles.php work with wildcards on the Windows 
shell
......................................................................

Make importTextFiles.php work with wildcards on the Windows shell

The Windows command line doesn't automatically expand wildcards, unlike
Unix shells. So the script tried to run function calls like
file_get_contents( '*.txt' ), which do not work. This patch uses glob() to
simulate the behaviour of the Unix shell.

This was reported at https://www.mediawiki.org/wiki/Topic:T7hf8bz8u2p4ryol

Change-Id: I002344a19cb08cc8ac8ee75214339b2379b04dbe
---
M maintenance/importTextFiles.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/299286/1

diff --git a/maintenance/importTextFiles.php b/maintenance/importTextFiles.php
index 88ee9d7..5531ffc 100644
--- a/maintenance/importTextFiles.php
+++ b/maintenance/importTextFiles.php
@@ -63,7 +63,16 @@
                        if ( file_exists( $arg ) ) {
                                $files[$arg] = file_get_contents( $arg );
                        } else {
-                               $this->error( "Fatal error: The file '$arg' 
does not exist!", 1 );
+                               // use glob to support the Windows shell, which 
doesn't automatically
+                               // expand wildcards
+                               $found = false;
+                               foreach ( glob( $arg ) as $filename ) {
+                                       $found = true;
+                                       $files[$filename] = file_get_contents( 
$filename );
+                               }
+                               if ( !$found ) {
+                                       $this->error( "Fatal error: The file 
'$arg' does not exist!", 1 );
+                               }
                        }
                };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I002344a19cb08cc8ac8ee75214339b2379b04dbe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TTO <at.li...@live.com.au>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to