Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 5449cf5

Browse files
author
Julien Jomier
committed
ENH: Adding MongoDB support
1 parent 509648e commit 5449cf5

File tree

8 files changed

+362
-4
lines changed

8 files changed

+362
-4
lines changed

core/Bootstrap.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ protected function _initConfig()
8383
Zend_Db_Table::setDefaultAdapter($db);
8484
Zend_Registry::set('dbAdapter', $db);
8585
}
86+
elseif($configDatabase->database->type == 'mongo')
87+
{
88+
// The mongo driver should be a php extension
89+
$db = new Mongo($configDatabase->database->params->host.":".
90+
$configDatabase->database->params->port);
91+
$dbname = $configDatabase->database->params->dbname;
92+
$database = $db->$dbname;
93+
Zend_Registry::set('dbAdapter', $database);
94+
}
8695
elseif($configDatabase->database->type == 'cassandra')
8796
{
8897
Zend_Loader::loadClass("connection", BASE_PATH . '/library/phpcassa');
@@ -115,7 +124,7 @@ protected function _initConfig()
115124
array(
116125
'writerName' => 'Stream',
117126
'writerParams' => array(
118-
'stream' => './log/dev.log'),
127+
'stream' => './log/prod.log'),
119128
'filterName' => 'Priority',
120129
'filterParams' => array(
121130
'priority' => Zend_Log::INFO)),
@@ -132,12 +141,13 @@ protected function _initConfig()
132141
array(
133142
'writerName' => 'Stream',
134143
'writerParams' => array(
135-
'stream' => './log/prod.log'),
144+
'stream' => './log/dev.log'),
136145
'filterName' => 'Priority',
137146
'filterParams' => array(
138147
'priority' => Zend_Log::WARN))));
139148
}
140-
if($configDatabase->database->adapter == 'PDO_MYSQL' && $configDatabase->database->params->password != 'set_your_password')
149+
if($configDatabase->database->adapter == 'PDO_MYSQL'
150+
&& $configDatabase->database->params->password != 'set_your_password')
141151
{
142152
$logger->addWriter($writerDb);
143153
$logger->setEventItem('datetime', date('Y-m-d H:i:s'));

core/controllers/components/NotifyErrorComponent.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ public function fatalEror($logger, $mailer)
113113
return;
114114
}
115115
header('content-type: text/plain');
116-
ob_clean();
116+
if (count(ob_list_handlers()) > 0)
117+
{
118+
ob_clean();
119+
}
117120
echo $this->getFatalErrorMessage($e);
118121
}
119122
$logger->crit($this->getFatalErrorMessage($e));

core/controllers/components/UtilityComponent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static public function getAllModules()
3333
$config->db->PDO_OCI = true;
3434
$config->db->PDO_SQLITE = true;
3535
$config->db->CASSANDRA = true;
36+
$config->db->MONGO = true;
3637
}
3738
else
3839
{
@@ -51,6 +52,7 @@ static public function getAllModules()
5152
case 'oci' : $config->db->PDO_OCI = true;break;
5253
case 'sqlite' : $config->db->PDO_SQLITE = true;break;
5354
case 'cassandra' : $config->db->CASSANDRA = true;break;
55+
case 'mongo' : $config->db->MONGO = true;break;
5456
default : break;
5557
}
5658
}

core/database/mongo/midas.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Nothing here for the moment

core/public/images/icons/add.png

3.14 KB
Loading

library/MIDAS/init.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
require_once BASE_PATH . '/library/MIDAS/models/MIDASDatabaseInterface.php';
2222
require_once BASE_PATH . '/library/MIDAS/models/MIDASDatabasePdo.php';
2323
require_once BASE_PATH . '/library/MIDAS/models/MIDASDatabaseCassandra.php';
24+
require_once BASE_PATH . '/library/MIDAS/models/MIDASDatabaseMongo.php';
2425
require_once BASE_PATH . '/library/MIDAS/models/GlobalDao.php';
2526

2627
include_once BASE_PATH . '/library/MIDAS/constant/datatype.php';

0 commit comments

Comments
 (0)