From fa2efb9e50cebcc1b9b83bca9f2e515414a70534 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 2 May 2017 11:42:28 -0700 Subject: [PATCH] ApiVisualEditor: Move RESTbase initiation from construct() to execute() There's no need e.g. in API documention queries to actually create the RESTbase service connection, and it's quite an expensive operation to do there. Change-Id: I114fe0718338db7233ed94e4ffa90861b4e9ff50 --- ApiVisualEditor.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php index e132470b90..28847c78d0 100644 --- a/ApiVisualEditor.php +++ b/ApiVisualEditor.php @@ -25,7 +25,6 @@ class ApiVisualEditor extends ApiBase { parent::__construct( $main, $name ); $this->veConfig = $config; $this->serviceClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) ); - $this->serviceClient->mount( '/restbase/', $this->getVRSObject() ); } /** @@ -181,6 +180,8 @@ class ApiVisualEditor extends ApiBase { } public function execute() { + $this->serviceClient->mount( '/restbase/', $this->getVRSObject() ); + $user = $this->getUser(); $params = $this->extractRequestParams();