Commit d8d38535 authored by Henning Leutz's avatar Henning Leutz 🥋

fix: undefined function MongoDB\is_in_transaction() workaround

parent baf01e9f
......@@ -25,6 +25,24 @@ class QuiqqerMongoDriver extends AbstractDriver
*/
private $collection;
/**
* QuiqqerMongoDriver constructor.
* @param array $options
*/
public function __construct(array $options = [])
{
parent::__construct($options);
// workaround for mongo auto loading, // load mongo functions
if (!\function_exists('\MongoDB\is_in_transaction')) {
$file = OPT_DIR.'mongodb/mongodb/src/functions.php';
if (\file_exists($file)) {
require $file;
}
}
}
/**
* @param array $key
* @return string
......@@ -64,7 +82,7 @@ class QuiqqerMongoDriver extends AbstractDriver
try {
$this->collection->replaceOne(['_id' => $id], [
'_id' => $id,
'data' => serialize($data),
'data' => \serialize($data),
'expiration' => $expiration
], ['upsert' => true]);
} catch (\MongoDB\Driver\Exception\BulkWriteException $ignored) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment