Nemo bis has uploaded a new change for review.

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

Change subject: Various fixes to job running code in Wiki.php
......................................................................

Various fixes to job running code in Wiki.php

* Make it async on Windows
* Fixed possible "invalid filename" errors on Windows
* Redirect output to dev/null to avoid hanging PHP

bug: 60231
bug: 58719
Change-Id: If4e52b86fb3a1bff283dfba3dfac213367f47543
(cherry picked from commit 96b678e110f90237d66eb095fa6cf223524d7ff4)
---
M includes/Wiki.php
1 file changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/110923/1

diff --git a/includes/Wiki.php b/includes/Wiki.php
index ae75bf3..074ec1a 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -653,12 +653,19 @@
                }
 
                if ( !wfShellExecDisabled() && is_executable( $wgPhpCli ) ) {
-                       // Start a background process to run some of the jobs.
-                       // This will be asynchronous on *nix though not on 
Windows.
+                       // Start a background process to run some of the jobs
                        wfProfileIn( __METHOD__ . '-exec' );
                        $retVal = 1;
                        $cmd = wfShellWikiCmd( "$IP/maintenance/runJobs.php", 
array( '--maxjobs', $n ) );
-                       wfShellExec( "$cmd &", $retVal );
+                       $cmd .= " >" . wfGetNull() . " 2>&1"; // don't hang PHP 
on pipes
+                       if ( wfIsWindows() ) {
+                               // Using START makes this async and also works 
around a bug where using
+                               // wfShellExec() with a quoted script name 
causes a filename syntax error.
+                               $cmd = "START /B \"bg\" $cmd";
+                       } else {
+                               $cmd = "$cmd &";
+                       }
+                       wfShellExec( $cmd, $retVal );
                        wfProfileOut( __METHOD__ . '-exec' );
                } else {
                        try {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4e52b86fb3a1bff283dfba3dfac213367f47543
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_22
Gerrit-Owner: Nemo bis <federicol...@tiscali.it>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>

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

Reply via email to