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

Commit 06503a1

Browse files
author
Julien Jomier
committed
ENH: Support for cassandra
1 parent 31dbc9c commit 06503a1

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

core/Bootstrap.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ protected function _initConfig()
8383
}
8484
elseif ($configDatabase->database->type == 'cassandra')
8585
{
86-
set_include_path('.'
87-
. PATH_SEPARATOR . './core/models/cassandra/'
88-
. PATH_SEPARATOR . get_include_path());
86+
Zend_Loader::loadClass( "connection", BASE_PATH . '/library/phpcassa');
87+
Zend_Loader::loadClass( "columnfamily", BASE_PATH . '/library/phpcassa');
88+
89+
$db = new Connection('midas', array(array('host' => $configDatabase->database->params->host,
90+
'port' => $configDatabase->database->params->port)));
91+
Zend_Registry::set('dbAdapter', $db);
8992
}
9093
else
9194
{

core/configs/database.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ database.type=pdo
33
database.profiler=0
44
database.adapter = PDO_MYSQL
55
database.params.host = localhost
6+
database.params.port = 3306
67
database.params.username = root
78
database.params.password = 123
89
database.params.dbname = midas3
@@ -13,6 +14,7 @@ database.type=pdo
1314
database.profiler=1
1415
database.adapter = PDO_MYSQL
1516
database.params.host = localhost
17+
database.params.port = 3306
1618
database.params.username = root
1719
database.params.password = 123
1820
database.params.dbname = midas3
@@ -22,6 +24,7 @@ database.type=pdo
2224
database.profiler=1
2325
database.adapter = PDO_MYSQL
2426
database.params.host = localhost
27+
database.params.port = 3306
2528
database.params.username = root
2629
database.params.password =
2730
database.params.dbname = midas3_test

core/controllers/ErrorController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ public function init()
1919
$mailer = new Zend_Mail();
2020
$session = new Zend_Session_Namespace('Auth_User');
2121
$db = Zend_Registry::get('dbAdapter');
22-
$profiler = $db->getProfiler();
22+
23+
if(method_exists($db,"getProfiler"))
24+
{
25+
$profiler = $db->getProfiler();
26+
}
27+
else
28+
{
29+
$profiler = new Zend_Db_Profiler();
30+
}
2331
$environment = Zend_Registry::get('configGlobal')->environment;
2432
$this->_environment=$environment;
2533
$this->Component->NotifyError->initNotifier(

core/models/cassandra/ItemModel.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@
55
*/
66
class ItemModel
77
{
8-
protected $_name = 'item';
9-
/*Récupération des ACL d'un groupe d'utilisateurs LDAP*/
10-
public function test()
11-
{
12-
echo 'testCassandra';
13-
}
8+
public $_name = 'item';
9+
public $_key = 'item_id';
10+
11+
public $_mainData= array(
12+
'item_id'=> array('type'=>MIDAS_DATA),
13+
'name' => array('type'=>MIDAS_DATA),
14+
'description' => array('type'=>MIDAS_DATA),
15+
'type' => array('type'=>MIDAS_DATA),
16+
'sizebytes'=>array('type'=>MIDAS_DATA),
17+
'date'=>array('type'=>MIDAS_DATA),
18+
'thumbnail'=>array('type'=>MIDAS_DATA),
19+
'folders' => array('type'=>MIDAS_MANY_TO_MANY, 'model'=>'Folder', 'table' => 'item2folder', 'parent_column'=> 'item_id', 'child_column' => 'folder_id'),
20+
'revisions' => array('type'=>MIDAS_ONE_TO_MANY, 'model'=>'ItemRevision', 'parent_column'=> 'item_id', 'child_column' => 'item_id'),
21+
'keywords' => array('type'=>MIDAS_MANY_TO_MANY, 'model'=>'ItemKeyword', 'table' => 'item2keyword', 'parent_column'=> 'item_id', 'child_column' => 'keyword_id'),
22+
);
23+
24+
/** Load function */
25+
function load()
26+
{
27+
28+
1429
}
30+
}
1531
?>

0 commit comments

Comments
 (0)