Commit 8b3b8956 authored by Henning Leutz's avatar Henning Leutz 🥋

fix: #1009

parent 9d5788be
......@@ -202,38 +202,46 @@ class LongTermCache
break;
case 'mongo':
$conf = $Config->get('longtime');
$database = 'localhost';
$collection = \md5(__FILE__);
if (!class_exists('\MongoDB\Client')) {
QUI\System\Log::write(
'Mongo DB Driver not found.
Please install MongoDB\Client (php MongoDB extension) or don\'t use MongoDB as long term cache',
QUI\System\Log::LEVEL_ALERT
);
} else {
$conf = $Config->get('longtime');
$database = 'localhost';
$collection = \md5(__FILE__);
// database server
if (!empty($conf['mongo_database'])) {
$database = $conf['mongo_database'];
}
// database server
if (!empty($conf['mongo_database'])) {
$database = $conf['mongo_database'];
}
if (!empty($conf['mongo_collection'])) {
$collection = $conf['mongo_collection'];
}
if (!empty($conf['mongo_collection'])) {
$collection = $conf['mongo_collection'];
}
if (\strpos($database, 'mongodb://') === false) {
$database = 'mongodb://'.$database;
}
if (\strpos($database, 'mongodb://') === false) {
$database = 'mongodb://'.$database;
}
if (!empty($conf['mongo_username']) && !empty($conf['mongo_password'])) {
$Client = new \MongoDB\Client($database, [
"username" => $conf['mongo_username'],
"password" => $conf['mongo_password']
]);
} else {
$Client = new \MongoDB\Client($database);
}
if (!empty($conf['mongo_username']) && !empty($conf['mongo_password'])) {
$Client = new \MongoDB\Client($database, [
"username" => $conf['mongo_username'],
"password" => $conf['mongo_password']
self::$Driver = new QuiqqerMongoDriver([
'mongo' => $Client,
'database' => $database,
'collection' => $collection
]);
} else {
$Client = new \MongoDB\Client($database);
}
self::$Driver = new QuiqqerMongoDriver([
'mongo' => $Client,
'database' => $database,
'collection' => $collection
]);
break;
}
......
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