From: <var...@us...> - 2014-12-02 14:26:55
|
Revision: 9404 http://sourceforge.net/p/phpwiki/code/9404 Author: vargenau Date: 2014-12-02 14:26:47 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Add class variables Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-12-02 13:41:37 UTC (rev 9403) +++ trunk/lib/WikiDB.php 2014-12-02 14:26:47 UTC (rev 9404) @@ -41,6 +41,37 @@ class WikiDB { /** + * @see open() + */ + function __construct(&$backend, $dbparams) + { + /** + * @var WikiRequest $request + */ + global $request; + + $this->_backend =& $backend; + // don't do the following with the auth_dsn! + if (isset($dbparams['auth_dsn'])) + return; + + $this->_cache = new WikiDB_cache($backend); + if (!empty($request)) + $request->_dbi = $this; + + // If the database doesn't yet have a timestamp, initialize it now. + if ($this->get('_timestamp') === false) + $this->touch(); + + // devel checking. + if ((int)DEBUG & _DEBUG_SQL) { + $this->_backend->check(); + } + // might be changed when opening the database fails + $this->readonly = defined("READONLY") ? READONLY : false; + } + + /** * Open a WikiDB database. * * This function inspects its arguments to determine the proper @@ -105,35 +136,6 @@ } /** - * @see open() - */ - function __construct(&$backend, $dbparams) - { - /** - * @var WikiRequest $request - */ - global $request; - - $this->_backend =& $backend; - // don't do the following with the auth_dsn! - if (isset($dbparams['auth_dsn'])) return; - - $this->_cache = new WikiDB_cache($backend); - if (!empty($request)) $request->_dbi = $this; - - // If the database doesn't yet have a timestamp, initialize it now. - if ($this->get('_timestamp') === false) - $this->touch(); - - // devel checking. - if ((int)DEBUG & _DEBUG_SQL) { - $this->_backend->check(); - } - // might be changed when opening the database fails - $this->readonly = defined("READONLY") ? READONLY : false; - } - - /** * Close database connection. * * The database may no longer be used after it is closed. @@ -602,7 +604,6 @@ /** * Update the database timestamp. - * */ function touch() { @@ -721,10 +722,8 @@ function isOpen() { - global $request; - if (!$request->_dbi) return false; - else return false; /* so far only needed for sql so false it. - later we have to check dba also */ + return false; /* so far only needed for sql so false it. + later we have to check dba also */ } function getParam($param) @@ -761,7 +760,11 @@ */ class WikiDB_Page { - function WikiDB_Page(&$wikidb, $pagename) + public $score; + public $_wikidb; + public $_pagename; + + function __construct(&$wikidb, $pagename) { $this->_wikidb = &$wikidb; $this->_pagename = $pagename; @@ -997,8 +1000,7 @@ $backend->unlock(array('version', 'page', 'recent', 'link', 'nonempty')); - return new WikiDB_PageRevision($this->_wikidb, $pagename, $newversion, - $data); + return new WikiDB_PageRevision($this->_wikidb, $pagename, $newversion, $data); } /** A higher-level interface to createRevision. @@ -1489,15 +1491,19 @@ // The authenticated author of the first revision or empty if not authenticated then. function getCreator() { - if ($current = $this->getRevision(1, false)) return $current->get('author_id'); - else return ''; + if ($current = $this->getRevision(1, false)) + return $current->get('author_id'); + else + return ''; } // The authenticated author of the current revision. function getAuthor() { - if ($current = $this->getCurrentRevision(false)) return $current->get('author_id'); - else return ''; + if ($current = $this->getCurrentRevision(false)) + return $current->get('author_id'); + else + return ''; } /* Semantic Web value, not stored in the links. @@ -1534,10 +1540,13 @@ */ class WikiDB_PageRevision { + public $_wikidb; + public $_pagename; + public $_version; + public $_data; public $_transformedContent = false; // set by WikiDB_Page::save() - function WikiDB_PageRevision(&$wikidb, $pagename, $version, - $versiondata = false) + function __construct(&$wikidb, $pagename, $version, $versiondata = array()) { $this->_wikidb = &$wikidb; $this->_pagename = $pagename; @@ -1559,7 +1568,7 @@ /** * Get the version number of this revision. * - * @return integer The version number of this revision. + * @return int The version number of this revision. */ public function getVersion() { @@ -1862,7 +1871,11 @@ */ class WikiDB_PageIterator { - function WikiDB_PageIterator(&$wikidb, &$iter, $options = array()) + public $_iter; + public $_wikidb; + public $_options; + + function __construct(&$wikidb, &$iter, $options = array()) { $this->_iter = $iter; // a WikiDB_backend_iterator $this->_wikidb = &$wikidb; @@ -2010,7 +2023,11 @@ */ class WikiDB_PageRevisionIterator { - function WikiDB_PageRevisionIterator(&$wikidb, &$revisions, $options = false) + public $_revisions; + public $_wikidb; + public $_options; + + function __construct(&$wikidb, &$revisions, $options = false) { $this->_revisions = $revisions; $this->_wikidb = &$wikidb; @@ -2057,8 +2074,7 @@ } } else assert($version > 0); - return new WikiDB_PageRevision($this->_wikidb, $pagename, $version, - $versiondata); + return new WikiDB_PageRevision($this->_wikidb, $pagename, $version, $versiondata); } /** @@ -2090,9 +2106,16 @@ */ class WikiDB_Array_PageIterator { - function WikiDB_Array_PageIterator($pagenames) + public $_dbi; + public $_pages; + + function __construct ($pagenames) { + /** + * @var WikiRequest $request + */ global $request; + $this->_dbi = $request->getDbh(); $this->_pages = $pagenames; reset($this->_pages); @@ -2128,7 +2151,9 @@ class WikiDB_Array_generic_iter { - function WikiDB_Array_generic_iter($result) + public $_array; + + function __construct($result) { // $result may be either an array or a query result if (is_array($result)) { @@ -2182,7 +2207,14 @@ { // FIXME: beautify versiondata cache. Cache only limited data? - function WikiDB_cache(&$backend) + public $_backend; + public $_pagedata_cache; + public $_versiondata_cache; + public $_glv_cache; + public $_id_cache; + public $readonly; + + function __construct(&$backend) { /** * @var WikiRequest $request @@ -2190,7 +2222,6 @@ global $request; $this->_backend = &$backend; - $this->_pagedata_cache = array(); $this->_versiondata_cache = array(); array_push($this->_versiondata_cache, array()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |