From 69dd51f03b5b1022db9f1de0642130fc925cc85a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 19 May 2008 15:49:05 +0000 Subject: [PATCH] Don't fall into an infinite loop o' death if the pipes get broken. Exit out if we can't read from stdin anymore, instead of interpreting the 'false' error code as text ID 0... --- maintenance/fetchText.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/maintenance/fetchText.php b/maintenance/fetchText.php index 3b745c0ac1..6492fad0e9 100644 --- a/maintenance/fetchText.php +++ b/maintenance/fetchText.php @@ -10,6 +10,10 @@ $db = wfGetDB( DB_SLAVE ); $stdin = fopen( "php://stdin", "rt" ); while( !feof( $stdin ) ) { $line = fgets( $stdin ); + if( $line === false ) { + // We appear to have lost contact... + break; + } $textId = intval( $line ); $text = doGetText( $db, $textId ); echo strlen( $text ) . "\n"; @@ -31,6 +35,3 @@ function doGetText( $db, $id ) { } return $text; } - - -?> \ No newline at end of file -- 2.20.1