From: <var...@us...> - 2021-08-11 10:16:03
|
Revision: 10482 http://sourceforge.net/p/phpwiki/code/10482 Author: vargenau Date: 2021-08-11 10:16:00 +0000 (Wed, 11 Aug 2021) Log Message: ----------- PHP Doc Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/ADODB_mssqlnative.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB.php trunk/lib/WikiDB/backend/PearDB_ffpgsql.php trunk/lib/WikiDB/backend/dbaBase.php trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend.php trunk/lib/plugin/AnalyseAccessLogSql.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/ADODB.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -373,8 +373,7 @@ * @param int $version Which version to get * @param bool $want_content Do we need content? * - * @return array hash The version data, or false if specified version does not - * exist. + * @return array The version data, or false if specified version does not exist. */ function get_versiondata($pagename, $version, $want_content = false) { @@ -592,8 +591,12 @@ return $result; } - /* - * Update link table. + /** + * Set links for page. + * + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. + * * on DEBUG: delete old, deleted links from page */ function set_links($pagename, $links) @@ -757,9 +760,20 @@ return true; } - /* + /** * Find pages which link to or are linked from a page. * + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages + * @param string $sortby + * @param string $limit + * @param string $exclude Pages to exclude + * @param bool $want_relations + * + * FIXME: array or iterator? + * @return object A WikiDB_backend_iterator. + * * Optimization: save request->_dbi->_iwpcache[] to avoid further iswikipage checks * (linkExistingWikiWord or linkUnknownWikiWord) * This is called on every page header GleanDescription, so we can store all the @@ -1113,9 +1127,13 @@ return new WikiDB_backend_ADODB_iter($this, $result, array('pagename', 'wantedfrom')); } - /* + /** * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name */ + function rename_page($pagename, $to) { $dbh = &$this->_dbh; Modified: trunk/lib/WikiDB/backend/ADODB_mssqlnative.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -95,8 +95,12 @@ return empty($data) ? array() : unserialize(stripslashes($data)); } - /* - * Update link table. + /** + * Set links for page. + * + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. + * * on DEBUG: delete old, deleted links from page */ function set_links($pagename, $links) Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -456,8 +456,7 @@ * @param int $version Which version to get * @param bool $want_content Do we need content? * - * @return array hash The version data, or false if specified version does not - * exist. + * @return array The version data, or false if specified version does not exist. */ function get_versiondata($pagename, $version, $want_content = false) { @@ -716,8 +715,12 @@ return $result; } - /* - * Update link table. + /** + * Set links for page. + * + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. + * * on DEBUG: delete old, deleted links from page */ function set_links($pagename, $links) @@ -767,9 +770,20 @@ return true; } - /* + /** * Find pages which link to or are linked from a page. * + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages + * @param string $sortby + * @param string $limit + * @param string $exclude Pages to exclude + * @param bool $want_relations + * + * FIXME: array or iterator? + * @return object A WikiDB_backend_iterator. + * * Optimization: save request->_dbi->_iwpcache[] to avoid further iswikipage checks * (linkExistingWikiWord or linkUnknownWikiWord) * This is called on every page header GleanDescription, so we can store all the @@ -1107,9 +1121,13 @@ return new WikiDB_backend_PDO_iter($this, $result, array('pagename', 'wantedfrom')); } - /* + /** * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name */ + function rename_page($pagename, $to) { $dbh = &$this->_dbh; Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -323,8 +323,7 @@ * @param int $version Which version to get * @param bool $want_content Do we need content? * - * @return array hash The version data, or false if specified version does not - * exist. + * @return array The version data, or false if specified version does not exist. */ function get_versiondata($pagename, $version, $want_content = false) { @@ -482,8 +481,11 @@ return $result; } - /* - * Update link table. + /** + * Set links for page. + * + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. */ function set_links($pagename, $links) { @@ -529,9 +531,20 @@ $this->unlock(); } - /* + /** * Find pages which link to or are linked from a page. * + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages + * @param string $sortby + * @param string $limit + * @param string $exclude Pages to exclude + * @param bool $want_relations + * + * FIXME: array or iterator? + * @return object A WikiDB_backend_iterator. + * * TESTME relations: get_links is responsible to add the relation to the pagehash * as 'linkrelation' key as pagename. See WikiDB_PageIterator::next * if (isset($next['linkrelation'])) @@ -901,9 +914,13 @@ return substr($s, 0, -1) . ")"; } - /* + /** * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name */ + function rename_page($pagename, $to) { $dbh = &$this->_dbh; Modified: trunk/lib/WikiDB/backend/PearDB_ffpgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -178,8 +178,7 @@ * @param int $version Which version to get * @param bool $want_content Do we need content? * - * @return array hash The version data, or false if specified version does not - * exist. + * @return array The version data, or false if specified version does not exist. */ function get_versiondata($pagename, $version, $want_content = false) { @@ -299,9 +298,20 @@ return $result; } - /* + /** * Find pages which link to or are linked from a page. * + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages + * @param string $sortby + * @param string $limit + * @param string $exclude Pages to exclude + * @param bool $want_relations + * + * FIXME: array or iterator? + * @return object A WikiDB_backend_iterator. + * * TESTME relations: get_links is responsible to add the relation to the pagehash * as 'linkrelation' key as pagename. See WikiDB_PageIterator::next * if (isset($next['linkrelation'])) @@ -574,9 +584,13 @@ return new WikiDB_backend_PearDB_generic_iter($this, $result); } - /* + /** * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name */ + function rename_page($pagename, $to) { $dbh = &$this->_dbh; Modified: trunk/lib/WikiDB/backend/dbaBase.php =================================================================== --- trunk/lib/WikiDB/backend/dbaBase.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/dbaBase.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -214,8 +214,7 @@ * @param int $version Which version to get * @param bool $want_content Do we need content? * - * @return array hash The version data, or false if specified version does not - * exist. + * @return array The version data, or false if specified version does not exist. */ function get_versiondata($pagename, $version, $want_content = false) { @@ -279,6 +278,13 @@ $this->set_links($pagename, array()); } + /** + * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name + */ + function rename_page($pagename, $to) { /** @@ -430,11 +436,32 @@ array('sortby' => $sortby)); // already limited } + /** + * Set links for page. + * + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. + */ function set_links($pagename, $links) { $this->_linkdb->set_links($pagename, $links); } + /** + * Find pages which link to or are linked from a page. + * + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages + * @param string $sortby + * @param string $limit + * @param string $exclude Pages to exclude + * @param bool $want_relations + * + * FIXME: array or iterator? + * @return object A WikiDB_backend_iterator. + */ + function get_links($pagename, $reversed = true, $include_empty = false, $sortby = '', $limit = '', $exclude = '', $want_relations = false) Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend/file.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -307,7 +307,7 @@ * will not affect the value of 'hits' (or whatever other meta-data * may have been stored for the page.) * - * To delete a particular piece of meta-data, set it's value to false. + * To delete a particular piece of meta-data, set its value to false. * <pre> * $backend->update_pagedata($pagename, array('locked' => false)); * </pre> @@ -338,7 +338,7 @@ /** * Get the current version number for a page. * - * @param $pagename string Page name. + * @param string $pagename Page name. * @return int The latest version number for the page. Returns zero if * no versions of a page exist. */ @@ -350,10 +350,10 @@ /** * Get preceding version number. * - * @param $pagename string Page name. - * @param $version int Find version before this one. + * @param string $pagename Page name. + * @param int $version Find version before this one. * @return int The version number of the version in the database which - * immediately preceeds $version. + * immediately precedes $version. * * FIXED: Check if this version really exists! */ @@ -369,9 +369,9 @@ /** * Get revision meta-data and content. * - * @param $pagename string Page name. - * @param $version integer Which version to get. - * @param $want_content boolean + * @param string $pagename Page name. + * @param int $version Which version to get. + * @param bool $want_content * Indicates the caller really wants the page content. If this * flag is not set, the backend is free to skip fetching of the * page content (as that may be expensive). If the backend omits @@ -378,8 +378,7 @@ * the content, the backend might still want to set the value of * '%content' to the empty string if it knows there's no content. * - * @return array hash The version data, or false if specified version does not - * exist. + * @return array|bool The version data, or false if specified version does not exist. * * Some keys which might be present in the $versiondata hash are: * <dl> @@ -399,10 +398,14 @@ return $vd; } - /* - * Rename all files for this page + /** + * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name */ - public function rename_page($pagename, $to) + + function rename_page($pagename, $to) { $version = $this->_getLatestVersion($pagename); foreach ($this->_dir_names as $type => $path) { @@ -425,11 +428,9 @@ } /** - * Delete page from the database. + * Delete page (and all its revisions) from the database. * - * Delete page (and all it's revisions) from the database. - * - * @param $pagename string Page name. + * @param string $pagename Page name. */ function purge_page($pagename) { @@ -453,8 +454,8 @@ * In fact, to be safe, backends should probably allow the deletion of * the most recent version. * - * @param $pagename string Page name. - * @param $version integer Version to delete. + * @param string $pagename Page name. + * @param int $version int Version to delete. */ function delete_versiondata($pagename, $version) { @@ -480,7 +481,7 @@ * If the given ($pagename,$version) is already in the database, * this method completely overwrites any stored data for that version. * - * @param string $pagename Page name. + * @param string $pagename string Page name. * @param int $version New revisions content. * @param array $data hash New revision metadata. * @@ -522,9 +523,8 @@ /** * Set links for page. * - * @param $pagename string Page name. - * - * @param $links array List of page(names) which page links to. + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. */ function set_links($pagename, $links) { @@ -534,13 +534,13 @@ /** * Find pages which link to or are linked from a page. * - * @param string $pagename Page name. - * @param bool $reversed True to get backlinks. - * @param bool $include_empty True to get empty pages - * @param string $sortby - * @param string $limit - * @param string $exclude Pages to exclude. - * @param bool $want_relations True to get relations. + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages + * @param string $sortby + * @param string $limit + * @param string $exclude Pages to exclude + * @param bool $want_relations True to get relations * * FIXME: array or iterator? * @return object A WikiDB_backend_iterator. @@ -571,7 +571,7 @@ /** * Get all revisions of a page. * - * @param $pagename string The page name. + * @param string $pagename The page name. * @return object A WikiDB_backend_iterator. */ /* @@ -585,7 +585,7 @@ * Get all pages in the database. * * Pages should be returned in alphabetical order if that is - * feasable. + * feasible. * * @param bool $include_empty * If set, even pages with no content will be returned @@ -602,7 +602,8 @@ * * @return object A WikiDB_backend_iterator. */ - public function get_all_pages($include_empty = false, $sortby = '', $limit = '', $exclude = '') + public function get_all_pages($include_empty = false, + $sortby = '', $limit = '', $exclude = '') { require_once 'lib/PageList.php'; $this->_loadLatestVersions(); @@ -634,21 +635,36 @@ return count($this->_latest_versions); } - /* + /** * Lock backend database. + * + * Calls may be nested. + * + * @param array $tables + * @param bool $write_lock Unless this is set to false, a write lock + * is acquired, otherwise a read lock. If the backend doesn't support + * read locking, then it should make a write lock no matter which type + * of lock was requested. + * + * All backends <em>should</em> support write locking. */ function lock($tables = array(), $write_lock = true) { } - /* + /** * Unlock backend database. + * + * @param array $tables + * @param bool $force Normally, the database is not unlocked until + * unlock() is called as many times as lock() has been. If $force is + * set to true, the the database is unconditionally unlocked. */ function unlock($tables = array(), $force = false) { } - /* + /** * Close database. */ function close() @@ -655,7 +671,7 @@ { } - /* + /** * Synchronize with filesystem. * * This should flush all unwritten data to the filesystem. @@ -664,12 +680,15 @@ { } - /* + /** * Optimize the database. + * + * @return bool */ function optimize() { - return true; //trigger_error("optimize: Not Implemented", E_USER_WARNING); + //trigger_error("optimize: Not Implemented", E_USER_WARNING); + return true; } /** @@ -681,7 +700,8 @@ * trigger_error("Message goes here.", E_USER_WARNING); * </pre> * - * @return boolean True iff database is in a consistent state. + * @param bool $args + * @return bool True iff database is in a consistent state. */ function check($args = false) { @@ -690,12 +710,14 @@ } /** - * Put the database into a consistent state. + * Put the database into a consistent state + * by reparsing and restoring all pages. * * This should put the database into a consistent state. * (I.e. rebuild indexes, etc...) * - * @return boolean True iff successful. + * @param bool $args + * @return bool True iff successful. */ function rebuild($args = false) { Modified: trunk/lib/WikiDB/backend.php =================================================================== --- trunk/lib/WikiDB/backend.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/WikiDB/backend.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -11,7 +11,7 @@ * * PhpWiki is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along @@ -31,7 +31,7 @@ * //:pagename (*) * * hits - * is_locked + * locked * * Versiondata * @@ -150,8 +150,7 @@ * the content, the backend might still want to set the value of * '%content' to the empty string if it knows there's no content. * - * @return array|bool hash The version data, or false if specified version does not - * exist. + * @return array|bool The version data, or false if specified version does not exist. * * Some keys which might be present in the $versiondata hash are: * <dl> @@ -166,6 +165,15 @@ abstract function get_versiondata($pagename, $version, $want_content = false); /** + * Rename page in the database. + * + * @param string $pagename Current page name + * @param string $to Future page name + */ + + abstract function rename_page($pagename, $to); + + /** * Delete page from the database with backup possibility. * This should remove all links (from the named page) from * the link database. @@ -268,9 +276,10 @@ /** * Set links for page. * - * @param string $pagename Page name. + * @param string $pagename Page name + * @param array $links List of page(names) which page links to. * - * @param array $links List of page(names) which page links to. + * on DEBUG: delete old, deleted links from page */ abstract function set_links($pagename, $links); @@ -277,12 +286,13 @@ /** * Find pages which link to or are linked from a page. * - * @param string $pagename Page name. - * @param bool $reversed True to get backlinks. - * @param bool $include_empty + * @param string $pagename Page name + * @param bool $reversed True to get backlinks + * @param bool $include_empty True to get empty pages * @param string $sortby * @param string $limit - * @param string $exclude + * @param string $exclude Pages to exclude + * @param bool $want_relations * * FIXME: array or iterator? * @return object A WikiDB_backend_iterator. @@ -290,7 +300,8 @@ // FIXME: implement simple (but slow) link finder. abstract function get_links($pagename, $reversed = true, $include_empty = false, - $sortby = '', $limit = '', $exclude = ''); + $sortby = '', $limit = '', $exclude = '', + $want_relations = false); /** * Get all revisions of a page. @@ -324,8 +335,8 @@ * @param string $exclude * @return object A WikiDB_backend_iterator. */ - abstract public function get_all_pages($include_empty, - $sortby = '', $limit = '', $exclude = ''); + abstract function get_all_pages($include_empty, + $sortby = '', $limit = '', $exclude = ''); /** * Title or full text search. Modified: trunk/lib/plugin/AnalyseAccessLogSql.php =================================================================== --- trunk/lib/plugin/AnalyseAccessLogSql.php 2021-08-11 08:05:47 UTC (rev 10481) +++ trunk/lib/plugin/AnalyseAccessLogSql.php 2021-08-11 10:16:00 UTC (rev 10482) @@ -11,7 +11,7 @@ * * PhpWiki is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |