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
This commit is contained in:
James D. Forrester 2017-05-02 11:42:28 -07:00
parent 54fc920622
commit fa2efb9e50

View file

@ -25,7 +25,6 @@ class ApiVisualEditor extends ApiBase {
parent::__construct( $main, $name ); parent::__construct( $main, $name );
$this->veConfig = $config; $this->veConfig = $config;
$this->serviceClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) ); $this->serviceClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
$this->serviceClient->mount( '/restbase/', $this->getVRSObject() );
} }
/** /**
@ -181,6 +180,8 @@ class ApiVisualEditor extends ApiBase {
} }
public function execute() { public function execute() {
$this->serviceClient->mount( '/restbase/', $this->getVRSObject() );
$user = $this->getUser(); $user = $this->getUser();
$params = $this->extractRequestParams(); $params = $this->extractRequestParams();