]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/SQL.php
Jeff's hacks II.
[SourceForge/phpwiki.git] / lib / WikiDB / SQL.php
1 <?php rcs_id('$Id: SQL.php,v 1.1 2001-09-18 19:16:23 dairiki Exp $');
2
3 require_once('lib/WikiDB.php');
4
5
6 /**
7  *
8  */
9 class WikiDB_SQL extends WikiDB
10 {
11     function WikiDB_SQL ($dbparams) {
12         $backend_type = 'PearDB';
13         if (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
14             $backend_type = $m[1];
15         include_once("lib/WikiDB/backend/$backend_type.php");
16         $backend_class = "WikiDB_backend_$backend_type";
17         $backend = new $backend_class($dbparams);
18
19         $this->WikiDB($backend, $dbparams);
20     }
21     
22     
23     /**
24      * Determine whether page exists (in non-default form).
25      * @see WikiDB::isWikiPage
26      */
27     function isWikiPage ($pagename) {
28         /*
29         if (empty($this->_iwpcache))
30             $this->_iwpcache = array_flip($this->_backend->get_all_pagenames());
31         return isset($this->_iwpcache[$pagename]);
32         */
33
34         if (!isset($this->_iwpcache[$pagename]))
35             $this->_iwpcache[$pagename] = $this->_backend->is_wiki_page($pagename);
36         return $this->_iwpcache[$pagename];
37         
38         // Talk to the backend directly for max speed.
39         /*
40         $pagedata = $this->_cache->get_pagedata($pagename);
41         return !empty($pagedata[':non_default']);
42         */
43     }
44 };
45
46   
47 // Local Variables:
48 // mode: php
49 // End:
50 ?>