mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
rpc: delay getting DB connection until absolutely necessary
Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
parent
6afc46cb4a
commit
0caa949e41
1 changed files with 4 additions and 3 deletions
|
@ -33,8 +33,6 @@ class AurJSON {
|
|||
public function handle($http_data) {
|
||||
// set content type header to json
|
||||
header('content-type: application/json');
|
||||
// set up db connection.
|
||||
$this->dbh = db_connect();
|
||||
|
||||
// handle error states
|
||||
if ( !isset($http_data['type']) || !isset($http_data['arg']) ) {
|
||||
|
@ -43,6 +41,9 @@ class AurJSON {
|
|||
|
||||
// do the routing
|
||||
if ( in_array($http_data['type'], $this->exposed_methods) ) {
|
||||
// set up db connection.
|
||||
$this->dbh = db_connect();
|
||||
|
||||
// ugh. this works. I hate you php.
|
||||
$json = call_user_func_array(array(&$this,$http_data['type']),
|
||||
$http_data['arg']);
|
||||
|
|
Loading…
Add table
Reference in a new issue