@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function connect() |
30 | 30 | { |
31 | - if ($this->_connection) return; |
|
31 | + if ($this->_connection) { |
|
32 | + return; |
|
33 | + } |
|
32 | 34 | |
33 | 35 | // Auth to database |
34 | 36 | $userpass = isset($this->_config['username']) && isset($this->_config['password']) ? $this->_config['username'] . ':' . $this->_config['password'] . '@' : null; |
@@ -91,7 +93,11 @@ discard block |
||
91 | 93 | try { |
92 | 94 | $writeConcern = new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY, 1000); |
93 | 95 | $this->_connection->executeBulkWrite($this->_config['database'] . '.' . $collection, $bulk, $writeConcern); |
94 | - if ($command == 'insert') $response = (string) new \MongoDB\BSON\ObjectID($data['_id']); else $response = true; |
|
96 | + if ($command == 'insert') { |
|
97 | + $response = (string) new \MongoDB\BSON\ObjectID($data['_id']); |
|
98 | + } else { |
|
99 | + $response = true; |
|
100 | + } |
|
95 | 101 | } catch (\MongoDB\Driver\Exception\BulkWriteException $e) { |
96 | 102 | error_log( |
97 | 103 | "Uncaught Error: " . $e->getMessage() . " in " . $e->getFile() . ":" . $e->getLine() . "\n" |