changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / db / oldapi.php
1 <?php
2 /*
3   If you are using an older database backend (one of the ewiki_database_*()
4   functions), then you need to load this plugin wrapper _after_ it, so it
5   still can be accessed by the core using the newer OO interface.
6   
7   Whenever it doesn't work out of the box, do this by hand:
8     $ewiki_db = new ewiki_database_compat("");
9     $ewiki_db->pf = "old_db_function_name";
10     
11   You can probably also use this file as template for converting your
12   database backend to the new scheme.
13 */
14
15
16 #-- enable it
17 if (!isset($ewiki_db) && isset($ewiki_plugins["database"])) {
18    $ewiki_db = new ewiki_database_compat($ewiki_plugins["database"][0]);
19 }
20
21
22 #-- compatibility wrapper
23 class ewiki_database_compat {
24
25    var $pf;
26
27    function ewiki_database_compat($pf) {
28       $this->pf = $pf;
29    }
30    
31    function GET($id, $version=false) {
32       return $this->pf("GET", array("id"=>$id, "version"=>$version));
33    }
34
35    function WRITE($data, $overwrite=0) {
36       $FUNC = $overwrite ? "OVERWRITE" : "WRITE";
37       return $this->pf($FUNC, $data);
38    }
39
40    function HIT($id) {
41       return $this->pf("HIT", $id);
42    }
43
44    function FIND($list) {
45       return $this->pf("FIND", $list);
46    }
47
48    function GETALL($fields) {
49       return $this->pf("GETALL", $fields);
50    }
51
52    function SEARCH($field, $content, $ci=1, $regex=0, $mask=0, $filter=0) {
53       return $this->pf("SEARCH", array($field=>$content));
54    }
55
56    function DELETE($id, $version) {
57       return $this->pf("DELETE", array("id"=>$id, "version"=>$version));
58    }
59
60    function INIT() {
61       return $this->pf("INIT", array());
62    }
63
64 }
65
66
67 ?>