4 Using this extension you get access to the data from multiple backends
5 (the requests will be dispatched and query results merged from
6 individual database implementations). It is HIGHLY EXPERIMENTAL and
7 it's typically safer to simply merge all page data into one database
8 backend/implementation instead.
10 You should set this up by hand as follows, because order is important:
12 include("plugins/db/any.php");
13 include("plugins/db/dzf2.php");
14 include("plugins/db/ext_multi.php");
16 $ewiki_db = & new ewiki_database_multi(false);
17 #-- register databases
18 $ewiki_db->all[] = & new ewiki_database_anydb();
19 $ewiki_db->all[] = & new ewiki_database_dzf2();
22 If you only load the plugins, the order may not be preserved, so that
23 new page entries go to the wrong backend (typically the first was the
24 active/main database).
25 #this should be configureable!
27 If you also want subwiki support, then you should load that plugin
29 #both features could be merged
33 define("EWIKI_MULTIDB_GUESS", 0); // which database to use for WRITE calls, if disabled this will always fallback to the first backend
37 $ewiki_plugins["database"][0] = "ewiki_database_multi";
41 class ewiki_database_multi {
45 function ewiki_database_multi($auto=true) {
47 foreach (get_declared_classes() as $classname) {
48 if ((strpos($name, "ewiki_database_") === 0) && !strpos($name, "_multi")) {
49 $this->all = & new $classname;
54 function GET($id, $version=false) {
55 for ($i=0; $i<count($this->all); $i++) {
56 $r = $this->all[$i]->GET($id, $version);
65 function WRITE($hash, $overwrite=0) {
70 return $this->all[$i]->WRITE($hash, $overwrite);
78 function FIND($list) {
82 function GETALL($fields, $mask=0, $filter=0) {
86 function SEARCH($field, $content, $ci="i", $regex=0, $mask=0, $filter=0) {
90 function DELETE($id, $version) {
95 for ($i=0; $i<count($this->all); $i++) {
96 $this->all[$i]->INIT();
101 function WHICH($id) {