r45356 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45355‎ | r45356 | r45357 >
Date:00:31, 3 January 2009
Author:tstarling
Status:ok
Tags:
Comment:
* Fix some command-line propagation issues
* Fix weird failure to open /dev/stdout
* Wait for slaves after each child command
Modified paths:
  • /trunk/phase3/maintenance/storage/recompressTracked.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/storage/recompressTracked.php
@@ -169,7 +169,9 @@
170170 function startSlaveProcs() {
171171 $cmd = 'php ' . wfEscapeShellArg( __FILE__ );
172172 foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
173 - if ( in_array( $cmdOption, self::$optionsWithArgs ) ) {
 173+ if ( $cmdOption == 'slave-id' ) {
 174+ continue;
 175+ } elseif ( in_array( $cmdOption, self::$optionsWithArgs ) && isset( $this->$classOption ) ) {
174176 $cmd .= " --$cmdOption " . wfEscapeShellArg( $this->$classOption );
175177 } elseif ( $this->$classOption ) {
176178 $cmd .= " --$cmdOption";
@@ -184,14 +186,14 @@
185187 $pipes = false;
186188 $spec = array(
187189 array( 'pipe', 'r' ),
188 - array( 'file', '/dev/stdout', 'w' ),
189 - array( 'file', '/dev/stderr', 'w' )
 190+ array( 'file', 'php://stdout', 'w' ),
 191+ array( 'file', 'php://stderr', 'w' )
190192 );
191193 wfSuppressWarnings();
192194 $proc = proc_open( "$cmd --slave-id $i", $spec, $pipes );
193195 wfRestoreWarnings();
194196 if ( !$proc ) {
195 - $this->critical( "Error opening slave process" );
 197+ $this->critical( "Error opening slave process: $cmd" );
196198 exit( 1 );
197199 }
198200 $this->slaveProcs[$i] = $proc;
@@ -396,6 +398,7 @@
397399 case 'quit':
398400 return;
399401 }
 402+ wfWaitForSlaves( 5 );
400403 }
401404 }
402405

Status & tagging log