]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/ADODB.php
add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
[SourceForge/phpwiki.git] / lib / WikiDB / ADODB.php
1 <?php // -*-php-*-
2 rcs_id('$Id: ADODB.php,v 1.4 2004-04-26 20:44:34 rurban Exp $');
3
4 require_once('lib/WikiDB.php');
5
6 /**
7  * WikiDB layer for ADODB, which does nothing more than calling the 
8  * mysql-specific ADODB backend.
9  * Support for a newer adodb library, the adodb extension library 
10  * and more databases will come with PhpWiki v1.3.10
11  *
12  * @author: Lawrence Akka, Reini Urban
13  */
14 class WikiDB_ADODB extends WikiDB
15 {
16     function WikiDB_ADODB ($dbparams) {
17         if (is_array($dbparams['dsn']))
18             $backend = $dbparams['dsn']['phptype'];
19         elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
20             $backend = $m[1];
21         // do we have a override? (currently only mysql)
22         // todo: don't use this if the used mysql database can do transactions
23         if (FindFile("lib/WikiDB/backend/ADODB_$backend.php",true)) {
24             $backend = 'ADODB_' . $backend;
25         } else {
26             $backend = 'ADODB';
27         }
28         include_once("lib/WikiDB/backend/$backend.php");
29         $backend_class = "WikiDB_backend_$backend";
30         $backend = new $backend_class($dbparams);
31         $this->WikiDB($backend, $dbparams);
32     }
33     
34     /**
35      * Determine whether page exists (in non-default form).
36      * @see WikiDB::isWikiPage
37      */
38     function isWikiPage ($pagename) {
39         /*
40         if (empty($this->_iwpcache))
41             $this->_iwpcache = array_flip($this->_backend->get_all_pagenames());
42         return isset($this->_iwpcache[$pagename]);
43         */
44
45         if (!isset($this->_iwpcache[$pagename]))
46             $this->_iwpcache[$pagename] = $this->_backend->is_wiki_page($pagename);
47         return $this->_iwpcache[$pagename];
48         
49         // Talk to the backend directly for max speed.
50         /*
51         $pagedata = $this->_cache->get_pagedata($pagename);
52         return !empty($pagedata[':non_default']);
53         */
54     }
55 };
56   
57 // For emacs users
58 // Local Variables:
59 // mode: php
60 // tab-width: 8
61 // c-basic-offset: 4
62 // c-hanging-comment-ender-p: nil
63 // indent-tabs-mode: nil
64 // End:
65 ?>