Aaron Schulz has uploaded a new change for review.

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

Change subject: Added support for result=json parameter to runJobs.php
......................................................................

Added support for result=json parameter to runJobs.php

* This can let the caller get info about what was run, just like the web version

Change-Id: I49d7eccee52eb1dc161249fdc0546259ccf1f959
(cherry picked from commit 5dc6ff0f3606746303cc8bf62efbff50fbffb839)
---
M maintenance/runJobs.php
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/98/150098/1

diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php
index 3e6fa52..c757802 100644
--- a/maintenance/runJobs.php
+++ b/maintenance/runJobs.php
@@ -37,6 +37,7 @@
                $this->addOption( 'type', 'Type of job to run', false, true );
                $this->addOption( 'procs', 'Number of processes to use', false, 
true );
                $this->addOption( 'nothrottle', 'Ignore job throttling 
configuration', false, false );
+               $this->addOption( 'result', 'Set to JSON to print only a JSON 
response', false, false );
        }
 
        public function memoryLimit() {
@@ -65,14 +66,21 @@
                        }
                }
 
+               $json = ( $this->getOption( 'result' ) === 'json' );
+
                $runner = new JobRunner();
-               $runner->setDebugHandler( array( $this, 'debugInternal' ) );
-               $runner->run( array(
+               if ( !$json ) {
+                       $runner->setDebugHandler( array( $this, 'debugInternal' 
) );
+               }
+               $response = $runner->run( array(
                        'type'     => $this->getOption( 'type', false ),
                        'maxJobs'  => $this->getOption( 'maxjobs', false ),
                        'maxTime'  => $this->getOption( 'maxtime', false ),
                        'throttle' => $this->hasOption( 'nothrottle' ) ? false 
: true,
                ) );
+               if ( $json ) {
+                       $this->output( FormatJson::encode( $response, true ) );
+               }
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I49d7eccee52eb1dc161249fdc0546259ccf1f959
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.24wmf15
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to