From b6d1afa1aa851874d1e818ec9781d833d24b8330 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Wed, 1 Sep 2021 11:43:22 -0700 Subject: [PATCH] shell: Fix $wgShellboxUrls by passing service name when creating BoxedCommand To be able to use non-default Shellbox URLs, we need to be able to pass in a service name when creating the ShellboxClient. Have CommandFactory::createBoxed() take a $service parameter that can be used to change which Shellbox will be hit, as intended. Bug: T290193 Change-Id: Ic1671a69070f962dbb0083028faf34d6d437022a --- includes/shell/CommandFactory.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/shell/CommandFactory.php b/includes/shell/CommandFactory.php index 47bb039613f..978cef301c7 100644 --- a/includes/shell/CommandFactory.php +++ b/includes/shell/CommandFactory.php @@ -172,12 +172,15 @@ class CommandFactory { /** * Instantiates a new BoxedCommand. * + * @param ?string $service Name of Shellbox (as configured in + * $wgShellboxUrls) that should be used * @return BoxedCommand */ - public function createBoxed(): BoxedCommand { - if ( $this->shellboxClientFactory->isEnabled() ) { + public function createBoxed( ?string $service = null ): BoxedCommand { + if ( $this->shellboxClientFactory->isEnabled( $service ) ) { $client = $this->shellboxClientFactory->getClient( [ - 'timeout' => $this->limits['walltime'] + 1 + 'timeout' => $this->limits['walltime'] + 1, + 'service' => $service, ] ); $executor = new RemoteBoxedExecutor( $client ); $executor->setLogger( $this->logger );