From: <var...@us...> - 2008-08-29 15:42:26
|
Revision: 6226 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6226&view=rev Author: vargenau Date: 2008-08-29 15:42:34 +0000 (Fri, 29 Aug 2008) Log Message: ----------- PDO_mysql.php and PDO.php are not executable Property Changed: ---------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_mysql.php Property changes on: trunk/lib/WikiDB/backend/PDO.php ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/lib/WikiDB/backend/PDO_mysql.php ___________________________________________________________________ Deleted: svn:executable - * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-03-23 19:47:34
|
Revision: 6692 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6692&view=rev Author: vargenau Date: 2009-03-23 19:47:25 +0000 (Mon, 23 Mar 2009) Log Message: ----------- Same correction as Subversion 5960 for PearDB.php Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2009-03-23 07:43:49 UTC (rev 6691) +++ trunk/lib/WikiDB/backend/ADODB.php 2009-03-23 19:47:25 UTC (rev 6692) @@ -761,7 +761,7 @@ else list($have,$want) = array('linker', 'linkee'); $orderby = $this->sortby($sortby, 'db', array('pagename')); - if ($orderby) $orderby = ' ORDER BY $want.' . $orderby; + if ($orderby) $orderby = " ORDER BY $want." . $orderby; if ($exclude) // array of pagenames $exclude = " AND $want.pagename NOT IN ".$this->_sql_set($exclude); else Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2009-03-23 07:43:49 UTC (rev 6691) +++ trunk/lib/WikiDB/backend/PDO.php 2009-03-23 19:47:25 UTC (rev 6692) @@ -734,7 +734,7 @@ else list($have,$want) = array('linker', 'linkee'); $orderby = $this->sortby($sortby, 'db', array('pagename')); - if ($orderby) $orderby = ' ORDER BY $want.' . $orderby; + if ($orderby) $orderby = " ORDER BY $want." . $orderby; if ($exclude) // array of pagenames $exclude = " AND $want.pagename NOT IN ".$this->_sql_set($exclude); else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-07-13 13:05:29
|
Revision: 7597 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7597&view=rev Author: vargenau Date: 2010-07-13 13:05:22 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Avoid PHP warning when relation is not set Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/ADODB_mssqlnative.php trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2010-07-05 08:19:33 UTC (rev 7596) +++ trunk/lib/WikiDB/backend/ADODB.php 2010-07-13 13:05:22 UTC (rev 7597) @@ -596,7 +596,7 @@ if ($links) { foreach ($links as $link) { $linkto = $link['linkto']; - if ($link['relation']) + if (isset($link['relation'])) $relation = $this->_get_pageid($link['relation'], true); else $relation = 0; Modified: trunk/lib/WikiDB/backend/ADODB_mssqlnative.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2010-07-05 08:19:33 UTC (rev 7596) +++ trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2010-07-13 13:05:22 UTC (rev 7597) @@ -92,7 +92,7 @@ if ($links) { foreach ($links as $link) { $linkto = $link['linkto']; - if ($link['relation']) + if (isset($link['relation'])) $relation = $this->_get_pageid($link['relation'], true); else $relation = 0; Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2010-07-05 08:19:33 UTC (rev 7596) +++ trunk/lib/WikiDB/backend/PearDB.php 2010-07-13 13:05:22 UTC (rev 7597) @@ -520,7 +520,7 @@ if ($linkto === "") { // ignore attributes continue; } - if ($link['relation']) + if (isset($link['relation'])) $relation = $this->_get_pageid($link['relation'], true); else $relation = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-02 12:28:26
|
Revision: 8380 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8380&view=rev Author: vargenau Date: 2012-10-02 12:28:16 +0000 (Tue, 02 Oct 2012) Log Message: ----------- Whitespace only Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/ADODB_mssql.php trunk/lib/WikiDB/backend/ADODB_mssqlnative.php trunk/lib/WikiDB/backend/ADODB_mysql.php trunk/lib/WikiDB/backend/ADODB_oci8po.php trunk/lib/WikiDB/backend/ADODB_postgres7.php trunk/lib/WikiDB/backend/ADODB_sqlite.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_mysql.php trunk/lib/WikiDB/backend/PDO_oci8.php trunk/lib/WikiDB/backend/PDO_pgsql.php trunk/lib/WikiDB/backend/PearDB.php trunk/lib/WikiDB/backend/PearDB_ffpgsql.php trunk/lib/WikiDB/backend/PearDB_mysql.php trunk/lib/WikiDB/backend/PearDB_oci8.php trunk/lib/WikiDB/backend/PearDB_pgsql.php trunk/lib/WikiDB/backend/PearDB_sqlite.php trunk/lib/WikiDB/backend/dbaBase.php trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend/flatfile.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /* * Copyright 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam * Modified: trunk/lib/WikiDB/backend/ADODB_mssql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB_mssql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /** * MS SQL extensions for the ADODB DB backend. */ Modified: trunk/lib/WikiDB/backend/ADODB_mssqlnative.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /** * MS SQL extensions for the ADODB DB backend. */ Modified: trunk/lib/WikiDB/backend/ADODB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mysql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB_mysql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/WikiDB/backend/ADODB.php'; /* Modified: trunk/lib/WikiDB/backend/ADODB_oci8po.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_oci8po.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB_oci8po.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /** * Oracle extensions for the ADODB DB backend. * @author: Phi...@to... Modified: trunk/lib/WikiDB/backend/ADODB_postgres7.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_postgres7.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB_postgres7.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/WikiDB/backend/ADODB.php'; if (!defined("USE_BYTEA")) // see schemas/psql-initialize.sql Modified: trunk/lib/WikiDB/backend/ADODB_sqlite.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_sqlite.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/ADODB_sqlite.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/WikiDB/backend/ADODB.php'; /** Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PDO.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /* * Copyright 2005 $ThePhpWikiProgrammingTeam * Modified: trunk/lib/WikiDB/backend/PDO_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_mysql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PDO_mysql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /* * Copyright 2005 $ThePhpWikiProgrammingTeam * Modified: trunk/lib/WikiDB/backend/PDO_oci8.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_oci8.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PDO_oci8.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /* * Copyright 2007 $ThePhpWikiProgrammingTeam * Modified: trunk/lib/WikiDB/backend/PDO_pgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_pgsql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PDO_pgsql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /* * Copyright 2005 $ThePhpWikiProgrammingTeam * Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PearDB.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/WikiDB/backend.php'; //require_once('lib/FileFinder.php'); //require_once('lib/ErrorManager.php'); Modified: trunk/lib/WikiDB/backend/PearDB_ffpgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /* * Copyright (C) 2001-2009 $ThePhpWikiProgrammingTeam * Copyright (C) 2010 Alain Peyrat, Alcatel-Lucent Modified: trunk/lib/WikiDB/backend/PearDB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PearDB_mysql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/WikiDB/backend/PearDB.php'; // See http://sql-info.de/mysql/gotchas.html for mysql specific quirks. Modified: trunk/lib/WikiDB/backend/PearDB_oci8.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_oci8.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PearDB_oci8.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /** * Oracle extensions for the Pear DB backend. * @author: Phi...@to... Modified: trunk/lib/WikiDB/backend/PearDB_pgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_pgsql.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PearDB_pgsql.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/ErrorManager.php'; require_once 'lib/WikiDB/backend/PearDB.php'; Modified: trunk/lib/WikiDB/backend/PearDB_sqlite.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_sqlite.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/PearDB_sqlite.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,4 +1,4 @@ -<?php // -*-php-*- +<?php /** * SQLite PearDB backend by Matthew Palmer * The SQLite DB will gain popularity with the current MySQL vs PHP license drama. @@ -9,7 +9,6 @@ * sqlite /tmp/phpwiki-sqlite.db < schemas/sqlite.sql */ - require_once 'lib/WikiDB/backend/PearDB.php'; //TODO: create tables on virgin wiki Modified: trunk/lib/WikiDB/backend/dbaBase.php =================================================================== --- trunk/lib/WikiDB/backend/dbaBase.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/dbaBase.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - require_once 'lib/WikiDB/backend.php'; // FIXME:padding of data? Is it needed? dba_optimize() seems to do a good Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/file.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /** * Copyright 1999, 2000, 2001, 2002, 2003 $ThePhpWikiProgrammingTeam * Modified: trunk/lib/WikiDB/backend/flatfile.php =================================================================== --- trunk/lib/WikiDB/backend/flatfile.php 2012-10-02 12:16:57 UTC (rev 8379) +++ trunk/lib/WikiDB/backend/flatfile.php 2012-10-02 12:28:16 UTC (rev 8380) @@ -1,6 +1,5 @@ -<?php // -*-php-*- +<?php - /** * Copyright 1999,2005,2006 $ThePhpWikiProgrammingTeam * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-04 16:56:44
|
Revision: 8599 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8599&view=rev Author: vargenau Date: 2012-12-04 16:56:36 +0000 (Tue, 04 Dec 2012) Log Message: ----------- Use smart quotes Modified Paths: -------------- trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend/flatfile.php Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2012-12-04 13:26:06 UTC (rev 8598) +++ trunk/lib/WikiDB/backend/file.php 2012-12-04 16:56:36 UTC (rev 8599) @@ -108,7 +108,7 @@ if ($version != 0) $pd['version'] = $version; if (!is_array($pd)) - ExitWiki(sprintf(gettext("'%s': corrupt file"), + ExitWiki(sprintf(gettext("“%s”: corrupt file"), htmlspecialchars($filename))); else return $pd; Modified: trunk/lib/WikiDB/backend/flatfile.php =================================================================== --- trunk/lib/WikiDB/backend/flatfile.php 2012-12-04 13:26:06 UTC (rev 8598) +++ trunk/lib/WikiDB/backend/flatfile.php 2012-12-04 16:56:36 UTC (rev 8599) @@ -81,7 +81,7 @@ $pd['pagename'] = $pagename; //if ($version != 0) $pd['version'] = $version; if (!is_array($pd)) - ExitWiki(sprintf(gettext("'%s': corrupt file"), + ExitWiki(sprintf(gettext("“%s”: corrupt file"), htmlspecialchars($filename))); } fclose($fd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-28 13:11:31
|
Revision: 9016 http://sourceforge.net/p/phpwiki/code/9016 Author: vargenau Date: 2014-07-28 13:11:28 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Merge lib/WikiDB/backend/ADODB.php, lib/WikiDB/backend/PDO.php, lib/WikiDB/backend/PearDB.php Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2014-07-28 12:25:57 UTC (rev 9015) +++ trunk/lib/WikiDB/backend/ADODB.php 2014-07-28 13:11:28 UTC (rev 9016) @@ -141,7 +141,6 @@ '(lock_count = $this->_lock_count)' . "\n<br />", E_USER_WARNING); } -// $this->_dbh->setErrorHandling(PEAR_ERROR_PRINT); // prevent recursive loops. $this->unlock(false, 'force'); $this->_dbh->close(); @@ -289,7 +288,6 @@ function _get_pageid($pagename, $create_if_missing = false) { - // check id_cache global $request; $cache =& $request->_dbi->_cache->_id_cache; @@ -355,11 +353,11 @@ extract($this->_table_names); // Use SELECTLIMIT for maximum portability $rs = $dbh->SelectLimit(sprintf("SELECT version" - . " FROM $version_tbl, $page_tbl" - . " WHERE $version_tbl.id=$page_tbl.id" - . " AND pagename=%s" - . " AND version < %d" - . " ORDER BY version DESC", + . " FROM $version_tbl, $page_tbl" + . " WHERE $version_tbl.id=$page_tbl.id" + . " AND pagename=%s" + . " AND version < %d" + . " ORDER BY version DESC", $dbh->qstr($pagename), $version), 1); @@ -394,10 +392,10 @@ . "$version_tbl.versiondata as versiondata"; } $row = $dbh->GetRow(sprintf("SELECT $fields" - . " FROM $page_tbl, $version_tbl" - . " WHERE $page_tbl.id=$version_tbl.id" - . " AND pagename=%s" - . " AND version=%d", + . " FROM $page_tbl, $version_tbl" + . " WHERE $page_tbl.id=$version_tbl.id" + . " AND pagename=%s" + . " AND version=%d", $dbh->qstr($pagename), $version)); return $row ? $this->_extract_version_data_num($row, $want_content) : false; } @@ -555,6 +553,10 @@ } } + /** + * Delete page completely from the database. + * I'm not sure if this is what we want. Maybe just delete the revisions + */ function purge_page($pagename) { $dbh = &$this->_dbh; @@ -595,6 +597,7 @@ */ function set_links($pagename, $links) { + // Update link table. // FIXME: optimize: mysql can do this all in one big INSERT/REPLACE. $dbh = &$this->_dbh; @@ -837,9 +840,6 @@ return $row[0]; } - /* - * - */ function get_all_pages($include_empty = false, $sortby = '', $limit = '', $exclude = '') { $dbh = &$this->_dbh; @@ -932,11 +932,10 @@ } else { $callback = new WikiMethodCb($searchobj, "_pagename_match_clause"); } - $search_clause = $search->makeSqlClauseObj($callback); $sql = "SELECT $fields FROM $table" . " WHERE $join_clause" - . " AND ($search_clause)" + . " AND ($search_clause)" . $orderby; if ($limit) { // extract from,count from limit @@ -1095,15 +1094,15 @@ all empty pages, independent of linkstatus: select pagename as empty from page left join nonempty using(id) where is null(nonempty.id); only all empty pages, which have a linkto: - select page.pagename, linked.pagename as wantedfrom from link, page linked - left join page on link.linkto=page.id left join nonempty on link.linkto=nonempty.id - where nonempty.id is null and linked.id=link.linkfrom; + select page.pagename, linked.pagename as wantedfrom from link, page linked + left join page on link.linkto=page.id left join nonempty on link.linkto=nonempty.id + where nonempty.id is null and linked.id=link.linkfrom; */ - $sql = "SELECT p.pagename, pp.pagename as wantedfrom" + $sql = "SELECT p.pagename, pp.pagename AS wantedfrom" . " FROM $page_tbl p, $link_tbl linked" . " LEFT JOIN $page_tbl pp ON (linked.linkto = pp.id)" . " LEFT JOIN $nonempty_tbl ne ON (linked.linkto = ne.id)" - . " WHERE ne.id is NULL" + . " WHERE ne.id IS NULL" . " AND (p.id = linked.linkfrom)" . $exclude_from . $exclude @@ -1194,7 +1193,7 @@ . " SELECT $recent_tbl.id" . " FROM $recent_tbl, $version_tbl" . " WHERE $recent_tbl.id=$version_tbl.id" - . " AND version=latestversion" + . " AND version=latestversion" // We have some specifics here (Oracle) //. " AND content<>''" . " AND content $notempty" // On Oracle not just "<>''" Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2014-07-28 12:25:57 UTC (rev 9015) +++ trunk/lib/WikiDB/backend/PDO.php 2014-07-28 13:11:28 UTC (rev 9016) @@ -241,6 +241,9 @@ return $sth->fetchAll(PDO::FETCH_NUM); } + /* + * filter (nonempty pages) currently ignored + */ function numPages($filter = false, $exclude = '') { $dbh = &$this->_dbh; @@ -369,7 +372,6 @@ return $cache[$pagename]; } } - // attributes play this game. if ($pagename === '') return 0; @@ -661,6 +663,10 @@ } } + /** + * Delete page completely from the database. + * I'm not sure if this is what we want. Maybe just delete the revisions + */ function purge_page($pagename) { $dbh = &$this->_dbh; @@ -696,6 +702,10 @@ //function update_versiondata($pagename, $version, $data) { //} + /* + * Update link table. + * on DEBUG: delete old, deleted links from page + */ function set_links($pagename, $links) { // Update link table. @@ -748,7 +758,8 @@ * * 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 existing links. + * This is called on every page header GleanDescription, so we can store all the + * existing links. */ function get_links($pagename, $reversed = true, $include_empty = false, $sortby = '', $limit = '', $exclude = '') @@ -862,9 +873,10 @@ } /** - * Title search. + * Title and fulltext search. */ - function text_search($search, $fullsearch = false, $sortby = '', $limit = '', $exclude = '') + function text_search($search, $fullsearch = false, + $sortby = '', $limit = '', $exclude = '') { $dbh = &$this->_dbh; extract($this->_table_names); @@ -891,11 +903,10 @@ } else { $callback = new WikiMethodCb($searchobj, "_pagename_match_clause"); } - $search_clause = $search->makeSqlClauseObj($callback); $sth = $dbh->prepare("SELECT $fields FROM $table" . " WHERE $join_clause" - . " AND ($search_clause)" + . " AND ($search_clause)" . $orderby . $limit); $sth->execute(); @@ -1051,11 +1062,11 @@ left join page on(link.linkto=page.id) left join nonempty on(link.linkto=nonempty.id) where isnull(nonempty.id) and linked.id=link.linkfrom; */ - $sql = "SELECT p.pagename, pp.pagename as wantedfrom" + $sql = "SELECT p.pagename, pp.pagename AS wantedfrom" . " FROM $page_tbl p JOIN $link_tbl linked" . " LEFT JOIN $page_tbl pp ON linked.linkto = pp.id" . " LEFT JOIN $nonempty_tbl ne ON linked.linkto = ne.id" - . " WHERE ne.id is NULL" + . " WHERE ne.id IS NULL" . " AND p.id = linked.linkfrom" . $exclude_from . $exclude @@ -1151,10 +1162,10 @@ . " SELECT $recent_tbl.id" . " FROM $recent_tbl, $version_tbl" . " WHERE $recent_tbl.id=$version_tbl.id" - . " AND version=latestversion" + . " AND version=latestversion" // We have some specifics here (Oracle) //. " AND content<>''" - . " AND content $notempty" + . " AND content $notempty" // On Oracle not just "<>''" . ($pageid ? " AND $recent_tbl.id=$pageid" : "")); $this->unlock(array('nonempty')); } Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2014-07-28 12:25:57 UTC (rev 9015) +++ trunk/lib/WikiDB/backend/PearDB.php 2014-07-28 13:11:28 UTC (rev 9016) @@ -1,5 +1,25 @@ <?php +/* + * Copyright 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + require_once 'lib/WikiDB/backend.php'; class WikiDB_backend_PearDB @@ -92,7 +112,8 @@ if (!$this->_dbh) return; if ($this->_lock_count) { - trigger_error("WARNING: database still locked " . '(lock_count = $this->_lock_count)' . "\n<br />", + trigger_error("WARNING: database still locked " . + '(lock_count = $this->_lock_count)' . "\n<br />", E_USER_WARNING); } $this->_dbh->setErrorHandling(PEAR_ERROR_PRINT); // prevent recursive loops. @@ -106,13 +127,13 @@ } /* - * Test fast wikipage. + * Fast test for wikipage. */ function is_wiki_page($pagename) { $dbh = &$this->_dbh; extract($this->_table_names); - return $dbh->getOne(sprintf("SELECT $page_tbl.id as id" + return $dbh->getOne(sprintf("SELECT $page_tbl.id AS id" . " FROM $nonempty_tbl, $page_tbl" . " WHERE $nonempty_tbl.id=$page_tbl.id" . " AND pagename='%s'", @@ -128,6 +149,9 @@ . " WHERE $nonempty_tbl.id=$page_tbl.id"); } + /* + * filter (nonempty pages) currently ignored + */ function numPages($filter = false, $exclude = '') { $dbh = &$this->_dbh; @@ -245,7 +269,6 @@ function _get_pageid($pagename, $create_if_missing = false) { - // check id_cache global $request; $cache =& $request->_dbi->_cache->_id_cache; @@ -328,14 +351,13 @@ extract($this->_table_names); extract($this->_expressions); - assert(is_string($pagename) and $pagename != ""); + assert(is_string($pagename) and $pagename != ''); assert($version > 0); - //trigger_error("GET_REVISION $pagename $version $want_content", E_USER_NOTICE); // FIXME: optimization: sometimes don't get page data? if ($want_content) { $fields = $this->page_tbl_fields - . ",$page_tbl.pagedata as pagedata," + . ",$page_tbl.pagedata AS pagedata," . $this->version_tbl_fields; } else { $fields = $this->page_tbl_fields . "," @@ -384,11 +406,9 @@ unset($query_result['versiondata']); $data['%pagedata'] = $this->_extract_page_data($query_result); } - return $data; } - /** * Create a new revision of a page. */ @@ -406,7 +426,6 @@ $content = isset($data['%content']) ? (string)$data['%content'] : ''; unset($data['%content']); - unset($data['%pagedata']); $this->lock(); @@ -440,7 +459,6 @@ if (($id = $this->_get_pageid($pagename))) { $dbh->query("DELETE FROM $version_tbl" . " WHERE id=$id AND version=$version"); - $this->_update_recent_table($id); // This shouldn't be needed (as long as the latestversion // never gets deleted.) But, let's be safe. @@ -512,10 +530,14 @@ //function update_versiondata($pagename, $version, $data) { //} + /* + * Update link table. + * on DEBUG: delete old, deleted links from page + */ function set_links($pagename, $links) { // Update link table. - // FIXME: optimize: mysql can do this all in one big INSERT. + // FIXME: optimize: mysql can do this all in one big INSERT/REPLACE. $dbh = &$this->_dbh; extract($this->_table_names); @@ -720,7 +742,6 @@ $callback = new WikiMethodCb($searchobj, "_pagename_match_clause"); } $search_clause = $search->makeSqlClauseObj($callback); - $sql = "SELECT $fields FROM $table" . " WHERE $join_clause" . " AND ($search_clause)" @@ -808,7 +829,6 @@ } else { $result = $dbh->query($sql); } - return new WikiDB_backend_PearDB_iter($this, $result); } @@ -991,12 +1011,11 @@ . " SELECT $recent_tbl.id" . " FROM $recent_tbl, $version_tbl" . " WHERE $recent_tbl.id=$version_tbl.id" - . " AND version=latestversion" + . " AND version=latestversion" // We have some specifics here (Oracle) //. " AND content<>''" . " AND content $notempty" . ($pageid ? " AND $recent_tbl.id=$pageid" : "")); - $this->unlock(); } @@ -1030,8 +1049,9 @@ */ public function unlock($tables = false, $force = false) { - if ($this->_lock_count == 0) + if ($this->_lock_count == 0) { return; + } if (--$this->_lock_count <= 0 || $force) { $this->_unlock_tables(); $this->_lock_count = 0; @@ -1046,7 +1066,6 @@ trigger_error("virtual", E_USER_ERROR); } - /** * Serialize data */ @@ -1274,7 +1293,6 @@ class WikiDB_backend_PearDB_iter extends WikiDB_backend_PearDB_generic_iter { - function next() { $backend = &$this->_backend; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-09-17 10:00:54
|
Revision: 9085 http://sourceforge.net/p/phpwiki/code/9085 Author: vargenau Date: 2014-09-17 10:00:52 +0000 (Wed, 17 Sep 2014) Log Message: ----------- Fix #647 undefined method WikiDB_backend_dba::WikiDB_backend_dbaBase Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB_sqlite.php trunk/lib/WikiDB/backend/dba.php Modified: trunk/lib/WikiDB/backend/ADODB_sqlite.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_sqlite.php 2014-09-17 09:43:14 UTC (rev 9084) +++ trunk/lib/WikiDB/backend/ADODB_sqlite.php 2014-09-17 10:00:52 UTC (rev 9085) @@ -21,7 +21,7 @@ `sqlite $db < $schema`; `echo "CREATE USER wikiuser" | sqlite $db`; } - $this->WikiDB_backend_ADODB($dbparams); + parent::__construct($dbparams); } function _get_pageid($pagename, $create_if_missing = false) Modified: trunk/lib/WikiDB/backend/dba.php =================================================================== --- trunk/lib/WikiDB/backend/dba.php 2014-09-17 09:43:14 UTC (rev 9084) +++ trunk/lib/WikiDB/backend/dba.php 2014-09-17 10:00:52 UTC (rev 9085) @@ -32,7 +32,7 @@ $request->finish(fmt("%s: Can't open dba database", $dbfile)); } - $this->WikiDB_backend_dbaBase($db); + parent::__construct($db); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-27 18:16:11
|
Revision: 9575 http://sourceforge.net/p/phpwiki/code/9575 Author: vargenau Date: 2015-02-27 18:16:08 +0000 (Fri, 27 Feb 2015) Log Message: ----------- Remove unused variables Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/ADODB_mysql.php trunk/lib/WikiDB/backend/ADODB_oci8po.php trunk/lib/WikiDB/backend/ADODB_sqlite.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB_oci8.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2015-02-27 17:54:34 UTC (rev 9574) +++ trunk/lib/WikiDB/backend/ADODB.php 2015-02-27 18:16:08 UTC (rev 9575) @@ -466,7 +466,6 @@ $dbh->BeginTrans(); $dbh->CommitLock($version_tbl); $id = $this->_get_pageid($pagename, true); - $backend_type = $this->backendType(); $dbh->Execute(sprintf("DELETE FROM $version_tbl" . " WHERE id=%d AND version=%d", $id, $version)); @@ -1312,7 +1311,7 @@ $field_list = array(); $old_db = $this->database(); if ($database != $old_db) { - $conn = $this->_dbh->Connect($this->_parsedDSN['hostspec'], + $this->_dbh->Connect($this->_parsedDSN['hostspec'], DBADMIN_USER ? DBADMIN_USER : $this->_parsedDSN['username'], DBADMIN_PASSWD ? DBADMIN_PASSWD : $this->_parsedDSN['password'], $database); @@ -1322,7 +1321,7 @@ } if ($database != $old_db) { $this->_dbh->close(); - $conn = $this->_dbh->Connect($this->_parsedDSN['hostspec'], + $this->_dbh->Connect($this->_parsedDSN['hostspec'], $this->_parsedDSN['username'], $this->_parsedDSN['password'], $old_db); Modified: trunk/lib/WikiDB/backend/ADODB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mysql.php 2015-02-27 17:54:34 UTC (rev 9574) +++ trunk/lib/WikiDB/backend/ADODB_mysql.php 2015-02-27 18:16:08 UTC (rev 9575) @@ -125,7 +125,7 @@ } if (DO_APP_LOCK) { $lock = join('-', $tables); - $result = $this->_dbh->Execute("SELECT RELEASE_LOCK('$lock')"); + $this->_dbh->Execute("SELECT RELEASE_LOCK('$lock')"); } if (DO_FULL_LOCK) { // if this is not enough: @@ -175,7 +175,7 @@ $row = $dbh->GetRow($query); if (!$row) { // have auto-incrementing, atomic version - $rs = $dbh->Execute(sprintf("INSERT INTO $page_tbl" + $dbh->Execute(sprintf("INSERT INTO $page_tbl" . " (id,pagename)" . " VALUES(NULL,%s)", $dbh->qstr($pagename))); @@ -210,7 +210,6 @@ $dbh->BeginTrans(); $dbh->CommitLock($version_tbl); $id = $this->_get_pageid($pagename, true); - $backend_type = $this->backendType(); // optimize: mysql can do this with one REPLACE INTO. $rs = $dbh->Execute(sprintf("REPLACE INTO $version_tbl" . " (id,version,mtime,minor_edit,content,versiondata)" Modified: trunk/lib/WikiDB/backend/ADODB_oci8po.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_oci8po.php 2015-02-27 17:54:34 UTC (rev 9574) +++ trunk/lib/WikiDB/backend/ADODB_oci8po.php 2015-02-27 18:16:08 UTC (rev 9575) @@ -124,7 +124,6 @@ function write_accesslog(&$entry) { - global $request; $dbh = &$this->_dbh; $log_tbl = $entry->_accesslog->logtable; $dbh->query("INSERT INTO $log_tbl" Modified: trunk/lib/WikiDB/backend/ADODB_sqlite.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_sqlite.php 2015-02-27 17:54:34 UTC (rev 9574) +++ trunk/lib/WikiDB/backend/ADODB_sqlite.php 2015-02-27 18:16:08 UTC (rev 9575) @@ -42,7 +42,7 @@ // atomic version // TODO: we have auto-increment since sqlite-2.3.4 // http://www.sqlite.org/faq.html#q1 - $rs = $dbh->Execute(sprintf("INSERT INTO $page_tbl" + $dbh->Execute(sprintf("INSERT INTO $page_tbl" . " (id,pagename)" . " VALUES((SELECT max(id) FROM $page_tbl)+1, %s)", $dbh->qstr($pagename))); Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2015-02-27 17:54:34 UTC (rev 9574) +++ trunk/lib/WikiDB/backend/PDO.php 2015-02-27 18:16:08 UTC (rev 9575) @@ -32,11 +32,6 @@ function __construct($dbparams) { - /** - * @var WikiRequest $request - */ - global $request; - $this->_dbparams = $dbparams; if (strstr($dbparams['dsn'], "://")) { // pear DB syntax $parsed = parseDSN($dbparams['dsn']); Modified: trunk/lib/WikiDB/backend/PearDB_oci8.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_oci8.php 2015-02-27 17:54:34 UTC (rev 9574) +++ trunk/lib/WikiDB/backend/PearDB_oci8.php 2015-02-27 18:16:08 UTC (rev 9575) @@ -75,7 +75,6 @@ function write_accesslog(&$entry) { - global $request; $dbh = &$this->_dbh; $log_tbl = $entry->_accesslog->logtable; // duration problem: sprintf "%f" might use comma e.g. "100,201" in european locales This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-03-05 18:07:09
|
Revision: 9608 http://sourceforge.net/p/phpwiki/code/9608 Author: vargenau Date: 2015-03-05 18:06:57 +0000 (Thu, 05 Mar 2015) Log Message: ----------- Update comments Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php trunk/lib/WikiDB/backend/PearDB_pgsql.php Modified: trunk/lib/WikiDB/backend/PearDB_ffpgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2015-03-05 17:23:44 UTC (rev 9607) +++ trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2015-03-05 18:06:57 UTC (rev 9608) @@ -551,6 +551,9 @@ return new WikiDB_backend_PearDB_generic_iter($this, $result); } + /* + * Rename page in the database. + */ function rename_page($pagename, $to) { $dbh = &$this->_dbh; @@ -590,6 +593,9 @@ parent::increaseHitCount($page_prefix . $pagename); } + /* + * Serialize data + */ function _serialize($data) { return WikiDB_backend_PearDB::_serialize($data); @@ -714,16 +720,15 @@ * TODO: don't parse the words into nodes. rather replace "[ +]" with & and "-" with "!" and " or " with "|" * tsearch2 query language: @@ "word | word", "word & word", ! word * ~* '.*something that does not exist.*' + * + * phrase search for "history lesson": + * + * SELECT id FROM tab WHERE ts_idx_col @@ to_tsquery('history&lesson') + * AND text_col ~* '.*history\\s+lesson.*'; + * + * The full-text index will still be used, and the regex will be used to + * prune the results afterwards. */ - /* - phrase search for "history lesson": - - SELECT id FROM tab WHERE ts_idx_col @@ to_tsquery('history&lesson') - AND text_col ~* '.*history\\s+lesson.*'; - - The full-text index will still be used, and the regex will be used to - prune the results afterwards. - */ function _fulltext_match_clause($node) { $word = strtolower($node->word); Modified: trunk/lib/WikiDB/backend/PearDB_pgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_pgsql.php 2015-03-05 17:23:44 UTC (rev 9607) +++ trunk/lib/WikiDB/backend/PearDB_pgsql.php 2015-03-05 18:06:57 UTC (rev 9608) @@ -264,23 +264,6 @@ } /* - most used words: -select * from stat('select idxfti from version') order by ndoc desc, nentry desc, word limit 10; - word | ndoc | nentry ------------------+------+-------- - plugin | 112 | 418 - page | 85 | 446 - phpwikidocument | 62 | 62 - use | 48 | 169 - help | 46 | 96 - wiki | 44 | 102 - name | 43 | 131 - phpwiki | 42 | 173 - see | 42 | 69 - default | 39 | 124 - */ - - /* * use tsearch2. See schemas/psql-tsearch2.sql and /usr/share/postgresql/contrib/tsearch2.sql * TODO: don't parse the words into nodes. rather replace "[ +]" with & and "-" with "!" and " or " with "|" * tsearch2 query language: @@ "word | word", "word & word", ! word This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-03-06 10:46:45
|
Revision: 9611 http://sourceforge.net/p/phpwiki/code/9611 Author: vargenau Date: 2015-03-06 10:46:43 +0000 (Fri, 06 Mar 2015) Log Message: ----------- Add private, add braces, remove dead code Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/ADODB_mysql.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_pgsql.php trunk/lib/WikiDB/backend/PearDB.php trunk/lib/WikiDB/backend/PearDB_mysql.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2015-03-06 09:52:06 UTC (rev 9610) +++ trunk/lib/WikiDB/backend/ADODB.php 2015-03-06 10:46:43 UTC (rev 9611) @@ -210,7 +210,7 @@ return $row ? $this->_extract_page_data($row[3], $row[2]) : false; } - function _extract_page_data($data, $hits) + private function _extract_page_data($data, $hits) { if (empty($data)) return array('hits' => $hits); @@ -230,7 +230,7 @@ // hit count, who cares? $dbh->Execute(sprintf("UPDATE $page_tbl SET hits=%d WHERE pagename=%s", $newdata['hits'], $dbh->qstr($pagename))); - return; + return true; } $where = sprintf("pagename=%s", $dbh->qstr($pagename)); $dbh->BeginTrans(); @@ -402,7 +402,7 @@ return $row ? $this->_extract_version_data_num($row, $want_content) : false; } - function _extract_version_data_num($row, $want_content) + private function _extract_version_data_num($row, $want_content) { if (!$row) return false; @@ -460,7 +460,7 @@ unset($data['mtime']); assert(!empty($mtime)); - @$content = (string)$data['%content']; + $content = isset($data['%content']) ? (string)$data['%content'] : ''; unset($data['%content']); unset($data['%pagedata']); @@ -590,12 +590,6 @@ return $result; } - // The only thing we might be interested in updating which we can - // do fast in the flags (minor_edit). I think the default - // update_versiondata will work fine... - //function update_versiondata($pagename, $version, $data) { - //} - /* * Update link table. * on DEBUG: delete old, deleted links from page @@ -805,11 +799,6 @@ //. " GROUP BY $want.id" . $exclude . $orderby; - /* - echo "SELECT linkee.id AS id, linkee.pagename AS pagename, related.pagename as linkrelation FROM link, page linkee, page linker JOIN page related ON (link.relation=related.id) WHERE linkfrom=linker.id AND linkto=linkee.id AND linker.pagename='SanDiego'" | mysql phpwiki - id pagename linkrelation - 2268 California located_in - */ if ($limit) { // extract from,count from limit list($offset, $count) = $this->limit($limit); @@ -860,8 +849,7 @@ $exclude = ''; } - //$dbh->SetFetchMode(ADODB_FETCH_ASSOC); - if (strstr($orderby, 'mtime ')) { // was ' mtime' + if (strstr($orderby, 'mtime ')) { // multiple columns possible if ($include_empty) { $sql = "SELECT " . $this->page_tbl_fields @@ -903,7 +891,6 @@ } else { $result = $dbh->Execute($sql); } - //$dbh->SetFetchMode(ADODB_FETCH_NUM); return new WikiDB_backend_ADODB_iter($this, $result, $this->page_tbl_field_list); } @@ -989,8 +976,9 @@ if ($sortby != '-hits') { if ($order = $this->sortby($sortby, 'db')) $orderby = " ORDER BY " . $order; else $orderby = ""; - } else + } else { $orderby = " ORDER BY hits $order"; + } $sql = "SELECT " . $this->page_tbl_fields . " FROM $nonempty_tbl, $page_tbl" @@ -1391,6 +1379,14 @@ } } + function free() + { + if ($this->_result) { + $this->_result->Close(); + $this->_result = false; + } + } + function asArray() { $result = array(); @@ -1398,15 +1394,6 @@ $result[] = $page; return $result; } - - function free() - { - if ($this->_result) { - /* call mysql_free_result($this->_queryID) */ - $this->_result->Close(); - $this->_result = false; - } - } } class WikiDB_backend_ADODB_iter @@ -1444,7 +1431,6 @@ class WikiDB_backend_ADODB_search extends WikiDB_backend_search_sql { // no surrounding quotes because we know it's a string - // function _quote($word) { return $this->_dbh->escapeSimple($word); } } // Following function taken from Pear::DB (prev. from adodb-pear.inc.php). @@ -1578,7 +1564,7 @@ $parsed['socket'] = $proto_opts; } - // Get dabase if any + // Get database if any // $dsn => database if ($dsn) { // /database Modified: trunk/lib/WikiDB/backend/ADODB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mysql.php 2015-03-06 09:52:06 UTC (rev 9610) +++ trunk/lib/WikiDB/backend/ADODB_mysql.php 2015-03-06 10:46:43 UTC (rev 9611) @@ -106,6 +106,7 @@ if (DO_FULL_LOCK) { // if this is not enough: $lock_type = $write_lock ? "WRITE" : "READ"; + $locks = array(); foreach ($this->_table_names as $key => $table) { $locks[] = "$table $lock_type"; } Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2015-03-06 09:52:06 UTC (rev 9610) +++ trunk/lib/WikiDB/backend/PDO.php 2015-03-06 10:46:43 UTC (rev 9611) @@ -280,7 +280,7 @@ return $row ? $this->_extract_page_data($row[3], $row[2]) : false; } - function _extract_page_data($data, $hits) + private function _extract_page_data($data, $hits) { if (empty($data)) return array('hits' => $hits); @@ -302,7 +302,7 @@ $sth->bindParam(1, $newdata['hits'], PDO::PARAM_INT); $sth->bindParam(2, $pagename, PDO::PARAM_STR, 100); $sth->execute(); - return; + return true; } $this->beginTransaction(); $data = $this->get_pagedata($pagename); @@ -372,6 +372,7 @@ return $cache[$pagename]; } } + // attributes play this game. if ($pagename === '') return 0; @@ -487,7 +488,7 @@ return $row ? $this->_extract_version_data_num($row, $want_content) : false; } - function _extract_version_data_num($row, $want_content) + private function _extract_version_data_num($row, $want_content) { if (!$row) return false; @@ -543,7 +544,7 @@ unset($data['mtime']); assert(!empty($mtime)); - @$content = (string)$data['%content']; + $content = isset($data['%content']) ? (string)$data['%content'] : ''; unset($data['%content']); unset($data['%pagedata']); @@ -671,6 +672,7 @@ $this->rollBack(); return false; } + return false; } /* @@ -705,12 +707,6 @@ return $result; } - // The only thing we might be interested in updating which we can - // do fast in the flags (minor_edit). I think the default - // update_versiondata will work fine... - //function update_versiondata($pagename, $version, $data) { - //} - /* * Update link table. * on DEBUG: delete old, deleted links from page @@ -907,7 +903,7 @@ $table .= ", $version_tbl"; $join_clause .= " AND $page_tbl.id=$version_tbl.id AND latestversion=version"; - $fields .= ",$page_tbl.pagedata as pagedata," . $this->version_tbl_fields; + $fields .= ", $page_tbl.pagedata as pagedata, " . $this->version_tbl_fields; $field_list = array_merge($field_list, array('pagedata'), $this->version_tbl_field_list); $callback = new WikiMethodCb($searchobj, "_fulltext_match_clause"); } else { @@ -959,8 +955,9 @@ if ($sortby != '-hits') { if ($order = $this->sortby($sortby, 'db')) $orderby = " ORDER BY " . $order; else $orderby = ""; - } else + } else { $orderby = " ORDER BY hits $order"; + } $sql = "SELECT " . $this->page_tbl_fields . " FROM $nonempty_tbl, $page_tbl" @@ -1536,7 +1533,7 @@ $parsed['socket'] = $proto_opts; } - // Get dabase if any + // Get database if any // $dsn => database if ($dsn) { // /database Modified: trunk/lib/WikiDB/backend/PDO_pgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_pgsql.php 2015-03-06 09:52:06 UTC (rev 9610) +++ trunk/lib/WikiDB/backend/PDO_pgsql.php 2015-03-06 10:46:43 UTC (rev 9611) @@ -37,7 +37,7 @@ if ($limit) { list($offset, $count) = $this->limit($limit); if ($offset) - $limit = " LIMIT $count OFFSET $from"; + $limit = " LIMIT $count OFFSET $offset"; else $limit = " LIMIT $count"; } else Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 09:52:06 UTC (rev 9610) +++ trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 10:46:43 UTC (rev 9611) @@ -187,7 +187,7 @@ return $result ? $this->_extract_page_data($result) : false; } - function _extract_page_data($data) + private function _extract_page_data($data) { if (empty($data)) return array(); elseif (empty($data['pagedata'])) return $data; else { @@ -219,7 +219,7 @@ $this->_get_pageid($pagename, true); // Creates page record } - $hits = !empty($data['hits']) ? (int)$data['hits'] : 0; + $hits = (empty($data['hits'])) ? 0 : (int)$data['hits']; unset($data['hits']); foreach ($newdata as $key => $val) { @@ -469,29 +469,6 @@ } /* - * Delete page from the database with backup possibility. - * i.e save_page('') and DELETE nonempty id - * Can be undone and is seen in RecentChanges. - */ - /* // see parent backend.php - function delete_page($pagename) { - $mtime = time(); - $user =& $GLOBALS['request']->_user; - $vdata = array('author' => $user->getId(), - 'author_id' => $user->getAuthenticatedId(), - 'mtime' => $mtime); - - $this->lock(); - $version = $this->get_latest_version($pagename); - $this->set_versiondata($pagename, $version+1, $vdata); - $this->set_links($pagename, false); - $pagedata = get_pagedata($pagename); - $this->update_pagedata($pagename, array('hits' => $pagedata['hits'])); - $this->unlock(); - } - */ - - /* * Delete page completely from the database. */ function purge_page($pagename) @@ -524,12 +501,6 @@ return $result; } - // The only thing we might be interested in updating which we can - // do fast in the flags (minor_edit). I think the default - // update_versiondata will work fine... - //function update_versiondata($pagename, $version, $data) { - //} - /* * Update link table. * on DEBUG: delete old, deleted links from page @@ -558,10 +529,12 @@ else $relation = 0; // avoid duplicates - if (isset($linkseen[$linkto]) and !$relation) + if (isset($linkseen[$linkto]) and !$relation) { continue; - if (!$relation) + } + if (!$relation) { $linkseen[$linkto] = true; + } $linkid = $this->_get_pageid($linkto, true); if (!$linkid) { echo("No link for $linkto on page $pagename"); @@ -655,10 +628,11 @@ extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); if ($orderby) $orderby = ' ORDER BY ' . $orderby; - if ($exclude) // array of pagenames + if ($exclude) { // array of pagenames $exclude = " AND $page_tbl.pagename NOT IN " . $this->_sql_set($exclude); - else + } else { $exclude = ''; + } if (strstr($orderby, 'mtime ')) { // multiple columns possible if ($include_empty) { @@ -708,8 +682,7 @@ } /* - * Text search (title or full text) - * Todo: exclude + * Title and fulltext search. */ public function text_search($search, $fulltext = false, $sortby = '', $limit = '', $exclude = '') @@ -817,7 +790,6 @@ } else { $orderby = " ORDER BY $order"; } - //$limitclause = $limit ? " LIMIT $limit" : ''; $sql = "SELECT " . $this->page_tbl_fields . " FROM $nonempty_tbl, $page_tbl" @@ -886,17 +858,15 @@ $order = "ASC"; $limit = -$limit; } - // $limitclause = $limit ? " LIMIT $limit" : ''; $where_clause = $join_clause; if ($pick) $where_clause .= " AND " . join(" AND ", $pick); - - // FIXME: use SQL_BUFFER_RESULT for mysql? $sql = "SELECT " . $this->page_tbl_fields . ", " . $this->version_tbl_fields . " FROM $table" . " WHERE $where_clause" . " ORDER BY mtime $order"; + // FIXME: use SQL_BUFFER_RESULT for mysql? if ($limit) { list($from, $count) = $this->limit($limit); $result = $dbh->limitQuery($sql, $from, $count); @@ -920,6 +890,15 @@ $exclude_from = " AND pp.pagename NOT IN " . $this->_sql_set($exclude_from); if ($exclude) // array of pagenames $exclude = " AND p.pagename NOT IN " . $this->_sql_set($exclude); + + /* + all empty pages, independent of linkstatus: + select pagename as empty from page left join nonempty using(id) where is null(nonempty.id); + only all empty pages, which have a linkto: + select page.pagename, linked.pagename as wantedfrom from link, page linked + left join page on link.linkto=page.id left join nonempty on link.linkto=nonempty.id + where nonempty.id is null and linked.id=link.linkfrom; + */ $sql = "SELECT p.pagename, pp.pagename AS wantedfrom" . " FROM $page_tbl p, $link_tbl linked" . " LEFT JOIN $page_tbl pp ON linked.linkto = pp.id" @@ -1249,8 +1228,9 @@ function count() { - if (!$this->_result) + if (!$this->_result) { return false; + } return $this->_result->numRows(); } @@ -1328,7 +1308,6 @@ class WikiDB_backend_PearDB_search extends WikiDB_backend_search_sql { // no surrounding quotes because we know it's a string - // function _quote($word) { return $this->_dbh->addq($word); } } // Local Variables: Modified: trunk/lib/WikiDB/backend/PearDB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysql.php 2015-03-06 09:52:06 UTC (rev 9610) +++ trunk/lib/WikiDB/backend/PearDB_mysql.php 2015-03-06 10:46:43 UTC (rev 9611) @@ -175,6 +175,7 @@ protected function _lock_tables($write_lock = true) { $lock_type = $write_lock ? "WRITE" : "READ"; + $tables = array(); foreach ($this->_table_names as $table) { $tables[] = "$table $lock_type"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-03-06 10:53:43
|
Revision: 9612 http://sourceforge.net/p/phpwiki/code/9612 Author: vargenau Date: 2015-03-06 10:53:35 +0000 (Fri, 06 Mar 2015) Log Message: ----------- Update comments Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php trunk/lib/WikiDB/backend/PearDB_mysql.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 10:46:43 UTC (rev 9611) +++ trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 10:53:35 UTC (rev 9612) @@ -891,14 +891,6 @@ if ($exclude) // array of pagenames $exclude = " AND p.pagename NOT IN " . $this->_sql_set($exclude); - /* - all empty pages, independent of linkstatus: - select pagename as empty from page left join nonempty using(id) where is null(nonempty.id); - only all empty pages, which have a linkto: - select page.pagename, linked.pagename as wantedfrom from link, page linked - left join page on link.linkto=page.id left join nonempty on link.linkto=nonempty.id - where nonempty.id is null and linked.id=link.linkfrom; - */ $sql = "SELECT p.pagename, pp.pagename AS wantedfrom" . " FROM $page_tbl p, $link_tbl linked" . " LEFT JOIN $page_tbl pp ON linked.linkto = pp.id" @@ -909,7 +901,6 @@ . $exclude . $orderby; if ($limit) { - // oci8 error: WHERE NULL = NULL appended list($from, $count) = $this->limit($limit); $result = $dbh->limitQuery($sql, $from, $count * 3); } else { Modified: trunk/lib/WikiDB/backend/PearDB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysql.php 2015-03-06 10:46:43 UTC (rev 9611) +++ trunk/lib/WikiDB/backend/PearDB_mysql.php 2015-03-06 10:53:35 UTC (rev 9612) @@ -105,7 +105,9 @@ . " GROUP BY id"); } - /* ISNULL is mysql specific */ + /* + * Find referenced empty pages. + */ function wanted_pages($exclude_from = '', $exclude = '', $sortby = '', $limit = '') { $dbh = &$this->_dbh; @@ -118,7 +120,8 @@ if ($exclude) // array of pagenames $exclude = " AND p.pagename NOT IN " . $this->_sql_set($exclude); - $sql = "SELECT p.pagename, pp.pagename as wantedfrom" + /* ISNULL is mysql specific */ + $sql = "SELECT p.pagename, pp.pagename AS wantedfrom" . " FROM $page_tbl p, $link_tbl linked" . " LEFT JOIN $page_tbl pp ON (linked.linkto = pp.id)" . " LEFT JOIN $nonempty_tbl ne ON (linked.linkto = ne.id)" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-03-06 17:16:46
|
Revision: 9618 http://sourceforge.net/p/phpwiki/code/9618 Author: vargenau Date: 2015-03-06 17:16:43 +0000 (Fri, 06 Mar 2015) Log Message: ----------- Revert: function _extract_page_data is public Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2015-03-06 13:18:23 UTC (rev 9617) +++ trunk/lib/WikiDB/backend/ADODB.php 2015-03-06 17:16:43 UTC (rev 9618) @@ -210,7 +210,7 @@ return $row ? $this->_extract_page_data($row[3], $row[2]) : false; } - private function _extract_page_data($data, $hits) + public function _extract_page_data($data, $hits) { if (empty($data)) return array('hits' => $hits); Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2015-03-06 13:18:23 UTC (rev 9617) +++ trunk/lib/WikiDB/backend/PDO.php 2015-03-06 17:16:43 UTC (rev 9618) @@ -280,7 +280,7 @@ return $row ? $this->_extract_page_data($row[3], $row[2]) : false; } - private function _extract_page_data($data, $hits) + public function _extract_page_data($data, $hits) { if (empty($data)) return array('hits' => $hits); Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 13:18:23 UTC (rev 9617) +++ trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 17:16:43 UTC (rev 9618) @@ -187,7 +187,7 @@ return $result ? $this->_extract_page_data($result) : false; } - private function _extract_page_data($data) + public function _extract_page_data($data) { if (empty($data)) return array(); elseif (empty($data['pagedata'])) return $data; else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-02-08 09:03:08
|
Revision: 9776 http://sourceforge.net/p/phpwiki/code/9776 Author: vargenau Date: 2016-02-08 09:03:06 +0000 (Mon, 08 Feb 2016) Log Message: ----------- Function _timeout is private Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB_mysql.php trunk/lib/WikiDB/backend/PDO_mysql.php trunk/lib/WikiDB/backend/PearDB_mysqli.php Modified: trunk/lib/WikiDB/backend/ADODB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mysql.php 2016-02-08 09:01:28 UTC (rev 9775) +++ trunk/lib/WikiDB/backend/ADODB_mysql.php 2016-02-08 09:03:06 UTC (rev 9776) @@ -54,7 +54,7 @@ /* * Kill timed out processes (so far only called on about every 50-th save). */ - function _timeout() + private function _timeout() { if (empty($this->_dbparams['timeout'])) return; $result = mysql_query("SHOW processlist"); Modified: trunk/lib/WikiDB/backend/PDO_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_mysql.php 2016-02-08 09:01:28 UTC (rev 9775) +++ trunk/lib/WikiDB/backend/PDO_mysql.php 2016-02-08 09:03:06 UTC (rev 9776) @@ -55,7 +55,7 @@ /** * Kill timed out processes. ( so far only called on about every 50-th save. ) */ - function _timeout() + private function _timeout() { if (empty($this->_dbparams['timeout'])) return; $sth = $this->_dbh->prepare("SHOW processlist"); Modified: trunk/lib/WikiDB/backend/PearDB_mysqli.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysqli.php 2016-02-08 09:01:28 UTC (rev 9775) +++ trunk/lib/WikiDB/backend/PearDB_mysqli.php 2016-02-08 09:03:06 UTC (rev 9776) @@ -30,7 +30,7 @@ /** * Kill timed out processes. ( so far only called on about every 50-th save. ) */ - function _timeout() + private function _timeout() { if (empty($this->_dbparams['timeout'])) return; $result = mysqli_query($this->_dbh->connection, "SHOW processlist"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-14 19:35:08
|
Revision: 10520 http://sourceforge.net/p/phpwiki/code/10520 Author: vargenau Date: 2021-08-14 19:35:00 +0000 (Sat, 14 Aug 2021) Log Message: ----------- Remove unused function set_links1 Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/ADODB_mssqlnative.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2021-08-14 19:33:26 UTC (rev 10519) +++ trunk/lib/WikiDB/backend/ADODB.php 2021-08-14 19:35:00 UTC (rev 10520) @@ -650,91 +650,6 @@ $this->unlock(array('link')); } - /* get all oldlinks in hash => id, relation - check for all new links - */ - function set_links1($pagename, $links) - { - - $dbh = &$this->_dbh; - extract($this->_table_names); - - $this->lock(array('link')); - $pageid = $this->_get_pageid($pagename, true); - - $oldlinks = $dbh->getAssoc("SELECT $link_tbl.linkto as linkto, $link_tbl.relation, page.pagename" - . " FROM $link_tbl" - . " JOIN page ON ($link_tbl.linkto = page.id)" - . " WHERE linkfrom=$pageid"); - /* old new - * X => [1,0 2,0 1,1] X => [1,1 3,0] - * => delete 1,0 2,0 + insert 3,0 - */ - if ($links) { - foreach ($links as $link) { - $linkto = $link['linkto']; - if ($link['relation']) - $relation = $this->_get_pageid($link['relation'], true); - else - $relation = 0; - // avoid duplicates - if (isset($linkseen[$linkto]) and !$relation) { - continue; - } - if (!$relation) { - $linkseen[$linkto] = true; - } - $linkid = $this->_get_pageid($linkto, true); - assert($linkid); - $skip = 0; - // find linkfrom,linkto,relation triple in oldlinks - foreach ($oldlinks as $l) { - if ($relation) { // relation NOT NULL - if ($l['linkto'] == $linkid and $l['relation'] == $relation) { - // found and skip - $skip = 1; - } - } - } - if (!$skip) { - if ($relation) { - $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto, relation)" - . " VALUES ($pageid, $linkid, $relation)"); - } else { - $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto)" - . " VALUES ($pageid, $linkid)"); - } - } - - if (array_key_exists($linkid, $oldlinks)) { - // This was also in the previous page - unset($oldlinks[$linkid]); - } - } - } - // purge page table: delete all non-referenced pages - // for all previously linked pages... - if (DEBUG and $oldlinks) { - // trigger_error("purge page table: delete all non-referenced pages...", E_USER_NOTICE); - foreach ($oldlinks as $id => $name) { - // ...check if the page is empty and has no version - if ($dbh->getRow("SELECT $page_tbl.id FROM $page_tbl" - . " LEFT JOIN $nonempty_tbl USING (id) " - . " LEFT JOIN $version_tbl USING (id)" - . " WHERE $nonempty_tbl.id is NULL" - . " AND $version_tbl.id is NULL" - . " AND $page_tbl.id=$id") - ) { - trigger_error("delete empty and non-referenced link $name ($id)", E_USER_NOTICE); - $dbh->Execute("DELETE FROM $page_tbl WHERE id=$id"); // this purges the link - $dbh->Execute("DELETE FROM $recent_tbl WHERE id=$id"); // may fail - } - } - } - $this->unlock(array('link')); - return true; - } - /** * Find pages which link to or are linked from a page. * Modified: trunk/lib/WikiDB/backend/ADODB_mssqlnative.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2021-08-14 19:33:26 UTC (rev 10519) +++ trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2021-08-14 19:35:00 UTC (rev 10520) @@ -151,92 +151,4 @@ } $this->unlock(array('link')); } - - /* get all oldlinks in hash => id, relation - check for all new links - */ - function set_links1($pagename, $links) - { - - $dbh = &$this->_dbh; - extract($this->_table_names); - - $this->lock(array('link')); - $pageid = $this->_get_pageid($pagename, true); - - $oldlinks = $dbh->getAssoc("SELECT $link_tbl.linkto as linkto, $link_tbl.relation, page.pagename" - . " FROM $link_tbl" - . " JOIN page ON ($link_tbl.linkto = page.id)" - . " WHERE linkfrom=$pageid"); - /* old new - * X => [1,0 2,0 1,1] X => [1,1 3,0] - * => delete 1,0 2,0 + insert 3,0 - */ - if ($links) { - foreach ($links as $link) { - $linkto = $link['linkto']; - if ($link['relation']) - $relation = $this->_get_pageid($link['relation'], true); - else - $relation = 0; - // avoid duplicates - if (isset($linkseen[$linkto]) and !$relation) { - continue; - } - if (!$relation) { - $linkseen[$linkto] = true; - } - $linkid = $this->_get_pageid($linkto, true); - assert($linkid); - $skip = 0; - // find linkfrom,linkto,relation triple in oldlinks - foreach ($oldlinks as $l) { - if ($relation) { // relation NOT NULL - if ($l['linkto'] == $linkid and $l['relation'] == $relation) { - // found and skip - $skip = 1; - } - } - } - if (!$skip) { - if ($relation) { - $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto, relation)" - . " VALUES ($pageid, $linkid, $relation)"); - } else { - $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto)" - . " VALUES ($pageid, $linkid)"); - } - } - - if (array_key_exists($linkid, $oldlinks)) { - // This was also in the previous page - unset($oldlinks[$linkid]); - } - } - } - // purge page table: delete all non-referenced pages - // for all previously linked pages... - if (DEBUG and $oldlinks) { - // trigger_error("purge page table: delete all non-referenced pages...", E_USER_NOTICE); - foreach ($oldlinks as $id => $name) { - // ...check if the page is empty and has no version - if ($id != '') { - if ($dbh->getRow("SELECT $page_tbl.id FROM $page_tbl" - . " LEFT JOIN $nonempty_tbl ON ($nonempty_tbl.id = $page_tbl.id)" //'"id" is not a recognized table hints option' - . " LEFT JOIN $version_tbl ON ($version_tbl.id = $page_tbl.id)" //'"id" is not a recognized table hints option' - . " WHERE $nonempty_tbl.id is NULL" - . " AND $version_tbl.id is NULL" - . " AND $page_tbl.id=$id") - ) { - trigger_error("delete empty and non-referenced link $name ($id)", E_USER_NOTICE); - $dbh->Execute("DELETE FROM $page_tbl WHERE id=$id"); // this purges the link - $dbh->Execute("DELETE FROM $recent_tbl WHERE id=$id"); // may fail - } - } - } - } - $this->unlock(array('link')); - return true; - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-10-06 08:34:20
|
Revision: 10616 http://sourceforge.net/p/phpwiki/code/10616 Author: vargenau Date: 2021-10-06 08:34:18 +0000 (Wed, 06 Oct 2021) Log Message: ----------- Assume recent MySQL Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_mysql.php trunk/lib/WikiDB/backend/PearDB_mysqli.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-10-06 08:31:04 UTC (rev 10615) +++ trunk/lib/WikiDB/backend/PDO.php 2021-10-06 08:34:18 UTC (rev 10616) @@ -120,13 +120,10 @@ $this->_hasTransactions = true; try { $this->_dbh->beginTransaction(); + $this->commit(); } catch (PDOException $e) { $this->_hasTransactions = false; } - $sth = $this->_dbh->prepare("SELECT version()"); - $sth->execute(); - $this->_serverinfo['version'] = $sth->fetchColumn(); - $this->commit(); // required to match the try catch block above! $prefix = isset($dbparams['prefix']) ? $dbparams['prefix'] : ''; $this->_table_names Modified: trunk/lib/WikiDB/backend/PDO_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_mysql.php 2021-10-06 08:31:04 UTC (rev 10615) +++ trunk/lib/WikiDB/backend/PDO_mysql.php 2021-10-06 08:34:18 UTC (rev 10616) @@ -33,20 +33,7 @@ function __construct($dbparams) { parent::__construct($dbparams); - - if (!empty($this->_serverinfo['version'])) { - $arr = explode('.', $this->_serverinfo['version']); - $this->_serverinfo['version'] = (string)(($arr[0] * 100) + $arr[1]) . "." . (integer)$arr[2]; - } - if ($this->_serverinfo['version'] < 323.0) { - // Older MySQL's don't have CASE WHEN ... END - $this->_expressions['maxmajor'] = "MAX(IF(minor_edit=0,version,0))"; - $this->_expressions['maxminor'] = "MAX(IF(minor_edit<>0,version,0))"; - } - - if ($this->_serverinfo['version'] > 401.0) { - $this->_dbh->query("SET NAMES 'UTF-8'"); - } + $this->_dbh->query("SET NAMES 'UTF-8'"); } function backendType() Modified: trunk/lib/WikiDB/backend/PearDB_mysqli.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysqli.php 2021-10-06 08:31:04 UTC (rev 10615) +++ trunk/lib/WikiDB/backend/PearDB_mysqli.php 2021-10-06 08:34:18 UTC (rev 10616) @@ -28,26 +28,6 @@ class WikiDB_backend_PearDB_mysqli extends WikiDB_backend_PearDB { - function __construct($dbparams) - { - parent::__construct($dbparams); - if (DB::isError($this->_dbh)) { - return; - } - //$this->_serverinfo = $this->_dbh->ServerInfo(); - $row = $this->_dbh->GetOne("SELECT version()"); - if (!DB::isError($row) and !empty($row)) { - $arr = explode('.', $row); - $this->_serverinfo['version'] = (string)(($arr[0] * 100) + $arr[1]) . - "." . (integer)$arr[2]; - if ($this->_serverinfo['version'] < 323.0) { - // Older MySQL's don't have CASE WHEN ... END - $this->_expressions['maxmajor'] = "MAX(IF(minor_edit=0,version,0))"; - $this->_expressions['maxminor'] = "MAX(IF(minor_edit<>0,version,0))"; - } - } - } - /** * Kill timed out processes. ( so far only called on about every 50-th save. ) */ @@ -217,11 +197,9 @@ // Note that this will fail silently if the page does not // have a record in the page table. Since it's just the // hit count, who cares? - // LIMIT since 3.23 - $dbh->query(sprintf("UPDATE LOW_PRIORITY %s SET hits=hits+1 WHERE pagename='%s' %s", + $dbh->query(sprintf("UPDATE LOW_PRIORITY %s SET hits=hits+1 WHERE pagename='%s' LIMIT 1", $this->_table_names['page_tbl'], - $dbh->escapeSimple($pagename), - ($this->_serverinfo['version'] >= 323.0) ? "LIMIT 1" : "")); + $dbh->escapeSimple($pagename))); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-05-23 11:43:50
|
Revision: 9838 http://sourceforge.net/p/phpwiki/code/9838 Author: vargenau Date: 2016-05-23 11:43:47 +0000 (Mon, 23 May 2016) Log Message: ----------- Remove & in __construct for WikiDB_backend_iterator derived classes Modified Paths: -------------- trunk/lib/WikiDB/backend/dbaBase.php trunk/lib/WikiDB/backend/dumb/AllRevisionsIter.php trunk/lib/WikiDB/backend/dumb/BackLinkIter.php trunk/lib/WikiDB/backend/dumb/LinkSearchIter.php trunk/lib/WikiDB/backend/dumb/MostPopularIter.php trunk/lib/WikiDB/backend/dumb/MostRecentIter.php trunk/lib/WikiDB/backend/dumb/TextSearchIter.php trunk/lib/WikiDB/backend/dumb/WantedPagesIter.php trunk/lib/WikiDB/backend/file.php Modified: trunk/lib/WikiDB/backend/dbaBase.php =================================================================== --- trunk/lib/WikiDB/backend/dbaBase.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dbaBase.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -696,7 +696,7 @@ extends WikiDB_backend_iterator { // fixed for linkrelations - function __construct(&$backend, &$pages, $options = array()) + function __construct($backend, $pages, $options = array()) { $this->_backend = $backend; $this->_options = $options; Modified: trunk/lib/WikiDB/backend/dumb/AllRevisionsIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/AllRevisionsIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/AllRevisionsIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -13,7 +13,7 @@ * @param $backend object A WikiDB_backend. * @param $pagename string Page whose revisions to get. */ - function __construct(&$backend, $pagename) + function __construct($backend, $pagename) { $this->_backend = &$backend; $this->_pagename = $pagename; Modified: trunk/lib/WikiDB/backend/dumb/BackLinkIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/BackLinkIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/BackLinkIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -11,7 +11,7 @@ class WikiDB_backend_dumb_BackLinkIter extends WikiDB_backend_iterator { - function __construct(&$backend, &$all_pages, $pagename) + function __construct($backend, $all_pages, $pagename) { $this->_pages = $all_pages; $this->_backend = &$backend; Modified: trunk/lib/WikiDB/backend/dumb/LinkSearchIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/LinkSearchIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/LinkSearchIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -38,7 +38,7 @@ class WikiDB_backend_dumb_LinkSearchIter extends WikiDB_backend_iterator { - function __construct(&$backend, &$pageiter, $search, $linktype, + function __construct($backend, $pageiter, $search, $linktype, $relation = false, $options = array()) { /** Modified: trunk/lib/WikiDB/backend/dumb/MostPopularIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/MostPopularIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/MostPopularIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -11,7 +11,7 @@ class WikiDB_backend_dumb_MostPopularIter extends WikiDB_backend_iterator { - function __construct($backend, &$all_pages, $limit) + function __construct($backend, $all_pages, $limit) { $this->_pages = array(); $pages = &$this->_pages; Modified: trunk/lib/WikiDB/backend/dumb/MostRecentIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/MostRecentIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/MostRecentIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -9,7 +9,7 @@ class WikiDB_backend_dumb_MostRecentIter extends WikiDB_backend_iterator { - function __construct(&$backend, &$pages, $params) + function __construct($backend, $pages, $params) { $limit = false; extract($params); Modified: trunk/lib/WikiDB/backend/dumb/TextSearchIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/TextSearchIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/TextSearchIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -2,7 +2,7 @@ class WikiDB_backend_dumb_TextSearchIter extends WikiDB_backend_iterator { - function __construct(&$backend, &$pages, $search, $fulltext = false, + function __construct($backend, $pages, $search, $fulltext = false, $options = array()) { $this->_backend = &$backend; Modified: trunk/lib/WikiDB/backend/dumb/WantedPagesIter.php =================================================================== --- trunk/lib/WikiDB/backend/dumb/WantedPagesIter.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/dumb/WantedPagesIter.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -8,7 +8,7 @@ class WikiDB_backend_dumb_WantedPagesIter extends WikiDB_backend_iterator { - function __construct(&$backend, &$all_pages, $exclude = '', $sortby = '', $limit = '') + function __construct($backend, $all_pages, $exclude = '', $sortby = '', $limit = '') { $this->_allpages = $all_pages; $this->_allpages_array = $all_pages->asArray(); Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2016-05-23 11:38:54 UTC (rev 9837) +++ trunk/lib/WikiDB/backend/file.php 2016-05-23 11:43:47 UTC (rev 9838) @@ -719,7 +719,7 @@ class WikiDB_backend_file_iter extends WikiDB_backend_iterator { - function __construct(&$backend, &$query_result, $options = array()) + function __construct($backend, $query_result, $options = array()) { $this->_backend = &$backend; $this->_result = $query_result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-10-07 13:29:54
|
Revision: 9945 http://sourceforge.net/p/phpwiki/code/9945 Author: vargenau Date: 2016-10-07 13:29:51 +0000 (Fri, 07 Oct 2016) Log Message: ----------- Add SPDX-License-Identifier Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_mysql.php trunk/lib/WikiDB/backend/PDO_oci8.php trunk/lib/WikiDB/backend/PDO_pgsql.php trunk/lib/WikiDB/backend/PearDB.php trunk/lib/WikiDB/backend/PearDB_ffpgsql.php trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend/flatfile.php Modified: trunk/lib/WikiDB/backend/ADODB.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/ADODB.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - -/* - * Copyright 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam +/** + * Copyright © 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/PDO.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - -/* - * Copyright 2005 $ThePhpWikiProgrammingTeam +/** + * Copyright © 2005 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** Modified: trunk/lib/WikiDB/backend/PDO_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_mysql.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/PDO_mysql.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - -/* - * Copyright 2005 $ThePhpWikiProgrammingTeam +/** + * Copyright © 2005 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** Modified: trunk/lib/WikiDB/backend/PDO_oci8.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_oci8.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/PDO_oci8.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - /* - * Copyright 2007 $ThePhpWikiProgrammingTeam + * Copyright © 2007 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** Modified: trunk/lib/WikiDB/backend/PDO_pgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_pgsql.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/PDO_pgsql.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - -/* - * Copyright 2005 $ThePhpWikiProgrammingTeam +/** + * Copyright © 2005 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/PearDB.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - -/* - * Copyright 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam +/** + * Copyright © 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ require_once 'lib/WikiDB/backend.php'; Modified: trunk/lib/WikiDB/backend/PearDB_ffpgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,8 +1,7 @@ <?php - -/* - * Copyright (C) 2001-2009 $ThePhpWikiProgrammingTeam - * Copyright (C) 2010 Alain Peyrat, Alcatel-Lucent +/** + * Copyright © 2001-2009 $ThePhpWikiProgrammingTeam + * Copyright © 2010 Alain Peyrat, Alcatel-Lucent * * This file is part of PhpWiki. * @@ -19,6 +18,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /* Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/file.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - /** - * Copyright 1999, 2000, 2001, 2002, 2003 $ThePhpWikiProgrammingTeam + * Copyright © 1999, 2000, 2001, 2002, 2003 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** Modified: trunk/lib/WikiDB/backend/flatfile.php =================================================================== --- trunk/lib/WikiDB/backend/flatfile.php 2016-10-07 13:27:15 UTC (rev 9944) +++ trunk/lib/WikiDB/backend/flatfile.php 2016-10-07 13:29:51 UTC (rev 9945) @@ -1,7 +1,6 @@ <?php - /** - * Copyright 1999,2005,2006 $ThePhpWikiProgrammingTeam + * Copyright © 1999,2005,2006 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. * @@ -18,6 +17,9 @@ * You should have received a copy of the GNU General Public License along * with PhpWiki; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * */ /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-10-07 16:32:10
|
Revision: 9946 http://sourceforge.net/p/phpwiki/code/9946 Author: vargenau Date: 2016-10-07 16:32:07 +0000 (Fri, 07 Oct 2016) Log Message: ----------- Add standard file header Modified Paths: -------------- trunk/lib/WikiDB/backend/ADODB_mssql.php trunk/lib/WikiDB/backend/ADODB_mssqlnative.php trunk/lib/WikiDB/backend/ADODB_mysql.php trunk/lib/WikiDB/backend/ADODB_oci8po.php trunk/lib/WikiDB/backend/ADODB_postgres7.php trunk/lib/WikiDB/backend/ADODB_sqlite.php trunk/lib/WikiDB/backend/PearDB_mysqli.php trunk/lib/WikiDB/backend/PearDB_oci8.php trunk/lib/WikiDB/backend/PearDB_pgsql.php trunk/lib/WikiDB/backend/PearDB_sqlite.php trunk/lib/WikiDB/backend/dba.php trunk/lib/WikiDB/backend/dbaBase.php Modified: trunk/lib/WikiDB/backend/ADODB_mssql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssql.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/ADODB_mssql.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,26 @@ <?php +/** + * Copyright © 2004-2005 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ /** * MS SQL extensions for the ADODB DB backend. Modified: trunk/lib/WikiDB/backend/ADODB_mssqlnative.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/ADODB_mssqlnative.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,8 +1,31 @@ <?php +/** + * Copyright © 2010 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ /** * MS SQL extensions for the ADODB DB backend. */ + require_once 'lib/WikiDB/backend/ADODB.php'; class WikiDB_backend_ADODB_mssqlnative Modified: trunk/lib/WikiDB/backend/ADODB_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_mysql.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/ADODB_mysql.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,27 @@ <?php +/** + * Copyright © 2002 Lawrence Akka + * Copyright © 2004-2007 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/WikiDB/backend/ADODB.php'; Modified: trunk/lib/WikiDB/backend/ADODB_oci8po.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_oci8po.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/ADODB_oci8po.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,26 @@ <?php +/** + * Copyright © 2004-2005,2007 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ /** * Oracle extensions for the ADODB DB backend. Modified: trunk/lib/WikiDB/backend/ADODB_postgres7.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_postgres7.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/ADODB_postgres7.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,24 @@ <?php +/** + * Copyright © 2005-2007 Reini Urban + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/WikiDB/backend/ADODB.php'; Modified: trunk/lib/WikiDB/backend/ADODB_sqlite.php =================================================================== --- trunk/lib/WikiDB/backend/ADODB_sqlite.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/ADODB_sqlite.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,26 @@ <?php +/** + * Copyright © 2004,2006-2007 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/WikiDB/backend/ADODB.php'; Modified: trunk/lib/WikiDB/backend/PearDB_mysqli.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysqli.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/PearDB_mysqli.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,25 @@ <?php +/** + * Copyright © 2001 Jeff Dairiki + * Copyright © 2004-2006 Reini Urban + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/WikiDB/backend/PearDB.php'; Modified: trunk/lib/WikiDB/backend/PearDB_oci8.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_oci8.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/PearDB_oci8.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,25 @@ <?php +/** + * Copyright © 2004 Philippe Vanhaesendonck + * Copyright © 2004-2007 Reini Urban + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ /** * Oracle extensions for the Pear DB backend. Modified: trunk/lib/WikiDB/backend/PearDB_pgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_pgsql.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/PearDB_pgsql.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,27 @@ <?php +/** + * Copyright © 2001,2003 Jeff Dairiki + * Copyright © 2004-2007 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/ErrorManager.php'; require_once 'lib/WikiDB/backend/PearDB.php'; Modified: trunk/lib/WikiDB/backend/PearDB_sqlite.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_sqlite.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/PearDB_sqlite.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,5 +1,29 @@ <?php /** + * Copyright © 2004 Matthew Palmer + * Copyright © 2004 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ + +/** * SQLite PearDB backend by Matthew Palmer * The SQLite DB will gain popularity with the current MySQL vs PHP license drama. * It's in core since PHP-5.0, MySQL not anymore. Modified: trunk/lib/WikiDB/backend/dba.php =================================================================== --- trunk/lib/WikiDB/backend/dba.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/dba.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,28 @@ <?php +/** + * Copyright © 2001-2002 Jeff Dairiki + * Copyright © 2001-2002 Carsten Klapp + * Copyright © 2004,2006 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/WikiDB/backend/dbaBase.php'; require_once 'lib/DbaDatabase.php'; Modified: trunk/lib/WikiDB/backend/dbaBase.php =================================================================== --- trunk/lib/WikiDB/backend/dbaBase.php 2016-10-07 13:29:51 UTC (rev 9945) +++ trunk/lib/WikiDB/backend/dbaBase.php 2016-10-07 16:32:07 UTC (rev 9946) @@ -1,4 +1,28 @@ <?php +/** + * Copyright © 2001,2003 Jeff Dairiki + * Copyright © 2001-2002 Carsten Klapp + * Copyright © 2004-2010 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with PhpWiki; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ require_once 'lib/WikiDB/backend.php'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2019-04-17 17:32:22
|
Revision: 10101 http://sourceforge.net/p/phpwiki/code/10101 Author: vargenau Date: 2019-04-17 17:32:19 +0000 (Wed, 17 Apr 2019) Log Message: ----------- Add {} Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB_mysqli.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2019-04-17 17:31:09 UTC (rev 10100) +++ trunk/lib/WikiDB/backend/PDO.php 2019-04-17 17:32:19 UTC (rev 10101) @@ -84,7 +84,9 @@ ? $this->_parsedDSN['database'] : $this->_parsedDSN['dbname']; } - if (empty($this->_parsedDSN['password'])) $this->_parsedDSN['password'] = ''; + if (empty($this->_parsedDSN['password'])) { + $this->_parsedDSN['password'] = ''; + } try { // try to load it dynamically (unix only) @@ -106,7 +108,7 @@ or DATABASE_PERSISTENT )); } catch (PDOException $e) { - echo "<br>\nCan't connect to database: %s" . $e->getMessage(); + echo "<br>\nCan't connect to database: " . $e->getMessage(); if (DEBUG & _DEBUG_VERBOSE or DEBUG & _DEBUG_SQL) { echo "<br>\nDSN: '", $dbparams['dsn'], "'"; echo "<br>\n_parsedDSN: '", print_r($this->_parsedDSN), "'"; @@ -590,8 +592,11 @@ } $this->_update_recent_table($id); $this->_update_nonempty_table($id); - if ($rs) $this->commit(); - else $this->rollBack(); + if ($rs) { + $this->commit(); + } else { + $this->rollBack(); + } $this->unlock(array('page', 'recent', 'version', 'nonempty')); } @@ -837,7 +842,9 @@ $dbh = &$this->_dbh; extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); - if ($orderby) $orderby = ' ORDER BY ' . $orderby; + if ($orderby) { + $orderby = ' ORDER BY ' . $orderby; + } if ($exclude) { // array of pagenames $exclude = " AND $page_tbl.pagename NOT IN " . $this->_sql_set($exclude); } else { @@ -895,7 +902,9 @@ $dbh = &$this->_dbh; extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); - if ($orderby) $orderby = ' ORDER BY ' . $orderby; + if ($orderby) { + $orderby = ' ORDER BY ' . $orderby; + } $limit = $this->_limit_sql($limit); $table = "$nonempty_tbl, $page_tbl"; @@ -999,8 +1008,9 @@ extract($this->_table_names); $pick = array(); - if ($since) + if ($since) { $pick[] = "mtime >= $since"; + } if ($include_all_revisions) { // Include all revisions of each page. @@ -1037,8 +1047,9 @@ $limit = -$limit; } $where_clause = $join_clause; - if ($pick) + if ($pick) { $where_clause .= " AND " . join(" AND ", $pick); + } $sql = "SELECT " . $this->page_tbl_fields . ", " . $this->version_tbl_fields . " FROM $table" @@ -1065,10 +1076,12 @@ if ($orderby = $this->sortby($sortby, 'db', array('pagename', 'wantedfrom'))) $orderby = 'ORDER BY ' . $orderby; - if ($exclude_from) // array of pagenames + if ($exclude_from) { // array of pagenames $exclude_from = " AND linked.pagename NOT IN " . $this->_sql_set($exclude_from); - if ($exclude) // array of pagenames + } + if ($exclude) { // array of pagenames $exclude = " AND $page_tbl.pagename NOT IN " . $this->_sql_set($exclude); + } /* all empty pages, independent of linkstatus: @@ -1249,8 +1262,9 @@ */ function _serialize($data) { - if (empty($data)) + if (empty($data)) { return ''; + } assert(is_array($data)); return serialize($data); } Modified: trunk/lib/WikiDB/backend/PearDB_mysqli.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysqli.php 2019-04-17 17:31:09 UTC (rev 10100) +++ trunk/lib/WikiDB/backend/PearDB_mysqli.php 2019-04-17 17:32:19 UTC (rev 10101) @@ -29,7 +29,9 @@ function __construct($dbparams) { parent::__construct($dbparams); - if (DB::isError($this->_dbh)) return; + if (DB::isError($this->_dbh)) { + return; + } //$this->_serverinfo = $this->_dbh->ServerInfo(); $row = $this->_dbh->GetOne("SELECT version()"); if (!DB::isError($row) and !empty($row)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-09 15:25:02
|
Revision: 10279 http://sourceforge.net/p/phpwiki/code/10279 Author: vargenau Date: 2021-06-09 15:24:58 +0000 (Wed, 09 Jun 2021) Log Message: ----------- Use LOCK_SH & LOCK_EX instead of numbers Modified Paths: -------------- trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend/flatfile.php Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2021-06-09 14:08:42 UTC (rev 10278) +++ trunk/lib/WikiDB/backend/file.php 2021-06-09 15:24:58 UTC (rev 10279) @@ -99,7 +99,7 @@ if (!file_exists($filename)) return NULL; if (!filesize($filename)) return array(); if ($fd = @fopen($filename, "rb")) { - $locked = flock($fd, 1); // Read lock + $locked = flock($fd, LOCK_SH); // Read lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } @@ -124,7 +124,7 @@ { $filename = $this->_pagename2filename($type, $pagename, $version); if ($fd = fopen($filename, 'a+b')) { - $locked = flock($fd, 2); // Exclusive blocking lock + $locked = flock($fd, LOCK_EX); // Exclusive blocking lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } Modified: trunk/lib/WikiDB/backend/flatfile.php =================================================================== --- trunk/lib/WikiDB/backend/flatfile.php 2021-06-09 14:08:42 UTC (rev 10278) +++ trunk/lib/WikiDB/backend/flatfile.php 2021-06-09 15:24:58 UTC (rev 10279) @@ -64,7 +64,7 @@ if (!file_exists($filename)) return NULL; if (!filesize($filename)) return array(); if ($fd = @fopen($filename, "rb")) { - $locked = flock($fd, 1); // Read lock + $locked = flock($fd, LOCK_SH); // Read lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } @@ -174,7 +174,7 @@ $pagedata .= MimeifyPageRevision($page, $current); if ($fd = fopen($filename, 'a+b')) { - $locked = flock($fd, 2); // Exclusive blocking lock + $locked = flock($fd, LOCK_EX); // Exclusive blocking lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-02 16:48:10
|
Revision: 10344 http://sourceforge.net/p/phpwiki/code/10344 Author: vargenau Date: 2021-07-02 16:48:08 +0000 (Fri, 02 Jul 2021) Log Message: ----------- PDO: Only variables should be passed by reference Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_oci8.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-07-02 16:13:10 UTC (rev 10343) +++ trunk/lib/WikiDB/backend/PDO.php 2021-07-02 16:48:08 UTC (rev 10344) @@ -327,7 +327,8 @@ . " WHERE pagename=?" . " LIMIT 1"); $sth->bindParam(1, $hits, PDO::PARAM_INT); - $sth->bindParam(2, $this->_serialize($data), PDO::PARAM_LOB); + $serialized_data = $this->_serialize($data); + $sth->bindParam(2, $serialized_data, PDO::PARAM_LOB); $sth->bindParam(3, $pagename, PDO::PARAM_STR, 100); if ($sth->execute()) { $this->commit(); @@ -564,7 +565,8 @@ $sth->bindParam(3, $mtime, PDO::PARAM_INT); $sth->bindParam(4, $minor_edit, PDO::PARAM_INT); $sth->bindParam(5, $content, PDO::PARAM_STR, 100); - $sth->bindParam(6, $this->_serialize($data), PDO::PARAM_STR, 100); + $serialized_data = $this->_serialize($data); + $sth->bindParam(6, $serialized_data, PDO::PARAM_STR, 100); $rs = $sth->execute(); } else { $sth = $dbh->prepare("DELETE FROM $version_tbl" @@ -580,7 +582,8 @@ $sth->bindParam(3, $mtime, PDO::PARAM_INT); $sth->bindParam(4, $minor_edit, PDO::PARAM_INT); $sth->bindParam(5, $content, PDO::PARAM_STR, 100); - $sth->bindParam(6, $this->_serialize($data), PDO::PARAM_STR, 100); + $serialized_data = $this->_serialize($data); + $sth->bindParam(6, $serialized_data, PDO::PARAM_STR, 100); $rs = $sth->execute(); } $this->_update_recent_table($id); @@ -1346,7 +1349,8 @@ $sth->bindParam(5, $entry->request, PDO::PARAM_STR, 255); $sth->bindParam(6, $entry->request_args, PDO::PARAM_STR, 255); $sth->bindParam(7, $entry->request_uri, PDO::PARAM_STR, 255); - $sth->bindParam(8, $entry->_ncsa_time($entry->time), PDO::PARAM_STR, 28); + $ncsa_time = _ncsa_time($entry->time); + $sth->bindParam(8, $ncsa_time, PDO::PARAM_STR, 28); $sth->bindParam(9, $entry->time, PDO::PARAM_INT); $sth->bindParam(10, $entry->status, PDO::PARAM_INT); $sth->bindParam(11, $entry->size, PDO::PARAM_INT); Modified: trunk/lib/WikiDB/backend/PDO_oci8.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_oci8.php 2021-07-02 16:13:10 UTC (rev 10343) +++ trunk/lib/WikiDB/backend/PDO_oci8.php 2021-07-02 16:48:08 UTC (rev 10344) @@ -74,7 +74,8 @@ . "request_file,request_uri,request_time,status,bytes_sent,referer,agent,request_duration)" . " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); // Either use unixtime as %d (long), or the native timestamp format. - $sth->bindParam(1, date('d-M-Y H:i:s', $entry->time)); + $datetime = date('d-M-Y H:i:s', $entry->time); + $sth->bindParam(1, $datetime); $sth->bindParam(2, $entry->host, PDO::PARAM_STR, 100); $sth->bindParam(3, $entry->user, PDO::PARAM_STR, 50); $sth->bindParam(4, $entry->request_method, PDO::PARAM_STR, 10); @@ -81,7 +82,8 @@ $sth->bindParam(5, $entry->request, PDO::PARAM_STR, 255); $sth->bindParam(6, $entry->request_args, PDO::PARAM_STR, 255); $sth->bindParam(7, $entry->request_uri, PDO::PARAM_STR, 255); - $sth->bindParam(8, $entry->_ncsa_time($entry->time), PDO::PARAM_STR, 28); + $ncsa_time = _ncsa_time($entry->time); + $sth->bindParam(8, $ncsa_time, PDO::PARAM_STR, 28); $sth->bindParam(9, $entry->time, PDO::PARAM_INT); $sth->bindParam(10, $entry->status, PDO::PARAM_INT); $sth->bindParam(11, $entry->size, PDO::PARAM_INT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-02 17:39:02
|
Revision: 10346 http://sourceforge.net/p/phpwiki/code/10346 Author: vargenau Date: 2021-07-02 17:38:55 +0000 (Fri, 02 Jul 2021) Log Message: ----------- Add {} Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-07-02 17:17:56 UTC (rev 10345) +++ trunk/lib/WikiDB/backend/PDO.php 2021-07-02 17:38:55 UTC (rev 10346) @@ -200,8 +200,9 @@ */ function close() { - if (!$this->_dbh) + if (!$this->_dbh) { return; + } if ($this->_lock_count) { trigger_error("WARNING: database still locked " . '(lock_count = $this->_lock_count)' . "\n<br />", @@ -280,7 +281,7 @@ return $row ? $this->_extract_page_data($row[3], $row[2]) : false; } - public function _extract_page_data($data, $hits) + public function _extract_page_data($data, $hits) { if (empty($data)) return array('hits' => $hits); @@ -957,12 +958,12 @@ { $dbh = &$this->_dbh; extract($this->_table_names); - $order = "DESC"; if ($limit < 0) { $order = "ASC"; $limit = -$limit; $where = ""; } else { + $order = "DESC"; $where = " AND hits > 0"; } $orderby = ''; Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-07-02 17:17:56 UTC (rev 10345) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-07-02 17:38:55 UTC (rev 10346) @@ -606,7 +606,9 @@ $dbh = &$this->_dbh; extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); - if ($orderby) $orderby = ' ORDER BY ' . $orderby; + if ($orderby) { + $orderby = ' ORDER BY ' . $orderby; + } if ($exclude) { // array of pagenames $exclude = " AND $page_tbl.pagename NOT IN " . $this->_sql_set($exclude); } else { @@ -667,8 +669,9 @@ $dbh = &$this->_dbh; extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); - if ($orderby) $orderby = ' ORDER BY ' . $orderby; - + if ($orderby) { + $orderby = ' ORDER BY ' . $orderby; + } $searchclass = get_class($this) . "_search"; // no need to define it everywhere and then fallback. memory! if (!class_exists($searchclass)) @@ -752,11 +755,11 @@ $dbh = &$this->_dbh; extract($this->_table_names); if ($limit < 0) { - $order = "hits ASC"; + $order = "ASC"; $limit = -$limit; $where = ""; } else { - $order = "hits DESC"; + $order = "DESC"; $where = " AND hits > 0"; } $orderby = ''; @@ -764,7 +767,7 @@ if ($order = $this->sortby($sortby, 'db')) $orderby = " ORDER BY " . $order; } else { - $orderby = " ORDER BY $order"; + $orderby = " ORDER BY hits $order"; } $sql = "SELECT " . $this->page_tbl_fields @@ -797,8 +800,9 @@ extract($this->_table_names); $pick = array(); - if ($since) + if ($since) { $pick[] = "mtime >= $since"; + } if ($include_all_revisions) { // Include all revisions of each page. @@ -835,8 +839,9 @@ $limit = -$limit; } $where_clause = $join_clause; - if ($pick) + if ($pick) { $where_clause .= " AND " . join(" AND ", $pick); + } $sql = "SELECT " . $this->page_tbl_fields . ", " . $this->version_tbl_fields . " FROM $table" @@ -862,10 +867,12 @@ if ($orderby = $this->sortby($sortby, 'db', array('pagename', 'wantedfrom'))) $orderby = 'ORDER BY ' . $orderby; - if ($exclude_from) // array of pagenames + if ($exclude_from) { // array of pagenames $exclude_from = " AND pp.pagename NOT IN " . $this->_sql_set($exclude_from); - if ($exclude) // array of pagenames + } + if ($exclude) { // array of pagenames $exclude = " AND p.pagename NOT IN " . $this->_sql_set($exclude); + } $sql = "SELECT p.pagename, pp.pagename AS wantedfrom" . " FROM $page_tbl p, $link_tbl linked" @@ -1019,8 +1026,9 @@ */ function _serialize($data) { - if (empty($data)) + if (empty($data)) { return ''; + } assert(is_array($data)); return serialize($data); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-30 08:59:38
|
Revision: 10401 http://sourceforge.net/p/phpwiki/code/10401 Author: vargenau Date: 2021-07-30 08:59:36 +0000 (Fri, 30 Jul 2021) Log Message: ----------- No need for default value Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php trunk/lib/WikiDB/backend/PearDB_ffpgsql.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-07-29 19:44:34 UTC (rev 10400) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-07-30 08:59:36 UTC (rev 10401) @@ -192,7 +192,7 @@ return; } - $this->lock(array($page_tbl), true); + $this->lock(array($page_tbl)); $data = $this->get_pagedata($pagename); if (!$data) { $data = array(); @@ -271,7 +271,7 @@ $id = $dbh->getOne($query); if (empty($id)) { - $this->lock(array($page_tbl), true); // write lock + $this->lock(array($page_tbl)); // write lock $max_id = $dbh->getOne("SELECT MAX(id) FROM $page_tbl"); $id = $max_id + 1; // requires createSequence and on mysql lock the interim table ->getSequenceName @@ -458,7 +458,7 @@ extract($this->_table_names); $this->lock(); - if (($id = $this->_get_pageid($pagename, false))) { + if (($id = $this->_get_pageid($pagename))) { $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$id"); $dbh->query("DELETE FROM $recent_tbl WHERE id=$id"); $dbh->query("DELETE FROM $version_tbl WHERE id=$id"); @@ -910,8 +910,8 @@ extract($this->_table_names); $this->lock(); - if (($id = $this->_get_pageid($pagename, false))) { - if ($new = $this->_get_pageid($to, false)) { + if (($id = $this->_get_pageid($pagename))) { + if ($new = $this->_get_pageid($to)) { // Cludge Alert! // This page does not exist (already verified before), but exists in the page table. // So we delete this page. Modified: trunk/lib/WikiDB/backend/PearDB_ffpgsql.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2021-07-29 19:44:34 UTC (rev 10400) +++ trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2021-07-30 08:59:36 UTC (rev 10401) @@ -117,7 +117,7 @@ return; } - $this->lock(array($page_tbl), true); + $this->lock(array($page_tbl)); $data = $this->get_pagedata($pagename); if (!$data) { $data = array(); @@ -254,7 +254,7 @@ $id = $dbh->getOne($query); if (empty($id)) { - $this->lock(array($page_tbl), true); // write lock + $this->lock(array($page_tbl)); // write lock $max_id = $dbh->getOne("SELECT MAX(id) FROM $page_tbl"); $id = $max_id + 1; // requires createSequence and on mysql lock the interim table ->getSequenceName @@ -277,7 +277,7 @@ extract($this->_table_names); $this->lock(); - if (($id = $this->_get_pageid($pagename, false))) { + if (($id = $this->_get_pageid($pagename))) { $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$id"); $dbh->query("DELETE FROM $recent_tbl WHERE id=$id"); $dbh->query("DELETE FROM $version_tbl WHERE id=$id"); @@ -583,8 +583,8 @@ extract($this->_table_names); $this->lock(); - if (($id = $this->_get_pageid($pagename, false))) { - if ($new = $this->_get_pageid($to, false)) { + if (($id = $this->_get_pageid($pagename))) { + if ($new = $this->_get_pageid($to)) { // Cludge Alert! // This page does not exist (already verified before), but exists in the page table. // So we delete this page. @@ -757,8 +757,6 @@ // $word = str_replace(" ", "&", $word); // phrase fix // @alu: use _quote maybe instead of direct pg_escape_string - $word = pg_escape_string($word); - - return $word; + return pg_escape_string($word); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-11 12:19:03
|
Revision: 10489 http://sourceforge.net/p/phpwiki/code/10489 Author: vargenau Date: 2021-08-11 12:19:00 +0000 (Wed, 11 Aug 2021) Log Message: ----------- lib/WikiDB/backend/file.php & lib/WikiDB/backend/flatfile.php: add protected Modified Paths: -------------- trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend/flatfile.php Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2021-08-11 10:44:37 UTC (rev 10488) +++ trunk/lib/WikiDB/backend/file.php 2021-08-11 12:19:00 UTC (rev 10489) @@ -85,7 +85,7 @@ // ********************************************************************* // common file load / save functions: - function _pagename2filename($type, $pagename, $version) + protected function _pagename2filename($type, $pagename, $version) { if ($version == 0) return $this->_dir_names[$type] . '/' . urlencode($pagename); @@ -93,7 +93,7 @@ return $this->_dir_names[$type] . '/' . urlencode($pagename) . '--' . $version; } - function _loadPage($type, $pagename, $version, $set_pagename = true) + protected function _loadPage($type, $pagename, $version, $set_pagename = true) { $filename = $this->_pagename2filename($type, $pagename, $version); if (!file_exists($filename)) return NULL; @@ -120,7 +120,7 @@ return NULL; } - function _savePage($type, $pagename, $version, $data) + protected function _savePage($type, $pagename, $version, $data) { $filename = $this->_pagename2filename($type, $pagename, $version); if ($fd = fopen($filename, 'a+b')) { @@ -141,7 +141,7 @@ } } - function _removePage($type, $pagename, $version) + protected function _removePage($type, $pagename, $version) { $filename = $this->_pagename2filename($type, $pagename, $version); if (!file_exists($filename)) return NULL; @@ -151,10 +151,8 @@ } // ********************************************************************* - - // ********************************************************************* // Load/Save Version-Data - function _loadVersionData($pagename, $version) + protected function _loadVersionData($pagename, $version) { if ($this->_page_version_data != NULL) { if (($this->_page_version_data['pagename'] == $pagename) && @@ -175,7 +173,7 @@ return NULL; } - function _saveVersionData($pagename, $version, $data) + protected function _saveVersionData($pagename, $version, $data) { $this->_savePage('ver_data', $pagename, $version, $data); @@ -188,7 +186,7 @@ // ********************************************************************* // Load/Save Page-Data - function _loadPageData($pagename) + protected function _loadPageData($pagename) { if (isset($this->_page_data)) { if ($this->_page_data['pagename'] == $pagename) { @@ -206,7 +204,7 @@ return array(); // no values found } - function _savePageData($pagename, $data) + protected function _savePageData($pagename, $data) { $this->_savePage('page_data', $pagename, 0, $data); } @@ -213,7 +211,7 @@ // ********************************************************************* // Load/Save Latest-Version - function _saveLatestVersions() + protected function _saveLatestVersions() { $data = $this->_latest_versions; if ($data == NULL) @@ -221,7 +219,7 @@ $this->_savePage('latest_ver', 'latest_versions', 0, $data); } - function _setLatestVersion($pagename, $version) + protected function _setLatestVersion($pagename, $version) { // make sure the page version list is loaded: $this->_getLatestVersion($pagename); @@ -235,7 +233,7 @@ $this->_saveLatestVersions(); } - function _loadLatestVersions() + protected function _loadLatestVersions() { if ($this->_latest_versions != NULL) return; @@ -247,7 +245,7 @@ $this->_latest_versions = array(); // empty array } - function _getLatestVersion($pagename) + protected function _getLatestVersion($pagename) { $this->_loadLatestVersions(); if (array_key_exists($pagename, $this->_latest_versions) == false) @@ -257,7 +255,7 @@ // ********************************************************************* // Load/Save Page-Links - function _loadPageLinks($pagename) + protected function _loadPageLinks($pagename) { $pd = $this->_loadPage('links', $pagename, 0, false); if ($pd != NULL) { @@ -267,7 +265,7 @@ } } - function _savePageLinks($pagename, $links) + protected function _savePageLinks($pagename, $links) { $this->_savePage('links', $pagename, 0, $links); } @@ -725,7 +723,7 @@ return true; } - function _parse_searchwords($search) + protected function _parse_searchwords($search) { $search = strtolower(trim($search)); if (!$search) Modified: trunk/lib/WikiDB/backend/flatfile.php =================================================================== --- trunk/lib/WikiDB/backend/flatfile.php 2021-08-11 10:44:37 UTC (rev 10488) +++ trunk/lib/WikiDB/backend/flatfile.php 2021-08-11 12:19:00 UTC (rev 10489) @@ -42,7 +42,7 @@ // ********************************************************************* // common file load / save functions: // FilenameForPage is from loadsave.php - function _pagename2filename($type, $pagename, $version) + protected function _pagename2filename($type, $pagename, $version) { $fpagename = FilenameForPage($pagename); if (strstr($fpagename, "/")) { @@ -52,7 +52,7 @@ } // Load/Save Page-Data - function _loadPageData($pagename) + protected function _loadPageData($pagename) { if ($this->_page_data != NULL) { if ($this->_page_data['pagename'] == $pagename) { @@ -97,7 +97,7 @@ * If the given ($pagename,$version) is already in the database, * this method completely overwrites any stored data for that version. */ - function _saveVersionData($pagename, $version, $data) + protected function _saveVersionData($pagename, $version, $data) { // check if this is a newer version: if ($this->_getLatestVersion($pagename) < $version) { @@ -116,7 +116,7 @@ // Store as full page_data flatfile // pagedata: date, pagename, hits // versiondata: _cached_html and the rest - function _savePageData($pagename, $data) + protected function _savePageData($pagename, $data) { $type = 'page_data'; $version = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-13 13:33:57
|
Revision: 10506 http://sourceforge.net/p/phpwiki/code/10506 Author: vargenau Date: 2021-08-13 13:33:55 +0000 (Fri, 13 Aug 2021) Log Message: ----------- _tryroot_from_upgrade no longer used Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-13 08:32:19 UTC (rev 10505) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-13 13:33:55 UTC (rev 10506) @@ -107,11 +107,7 @@ echo "<br>\n_parsedDSN: '", print_r($this->_parsedDSN), "'"; echo "<br>\nparsed: '", print_r($parsed), "'"; } - if (isset($dbparams['_tryroot_from_upgrade'])) - trigger_error(sprintf("Can't connect to database: %s", $e->getMessage()), - E_USER_WARNING); - else - exit(); + exit(); } if (DEBUG & _DEBUG_SQL) { // not yet implemented $this->_dbh->debug = true; Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-08-13 08:32:19 UTC (rev 10505) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-08-13 13:33:55 UTC (rev 10506) @@ -49,10 +49,7 @@ if (DB::isError($dbh)) { trigger_error(sprintf("Can't connect to database: %s", $this->_pear_error_message($dbh)), - isset($dbparams['_tryroot_from_upgrade']) // hack! - ? E_USER_WARNING : E_USER_ERROR); - if (isset($dbparams['_tryroot_from_upgrade'])) - return; + E_USER_ERROR); } $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_pear_error_callback')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |