From: <ru...@us...> - 2009-01-07 08:58:10
|
Revision: 6374 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6374&view=rev Author: rurban Date: 2009-01-07 08:58:06 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Be pedantic about suppressed warnings (just for the debugger) Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2009-01-07 08:56:46 UTC (rev 6373) +++ trunk/lib/WikiDB/backend/PearDB.php 2009-01-07 08:58:06 UTC (rev 6374) @@ -193,7 +193,7 @@ $this->_get_pageid($pagename, true); // Creates page record } - @$hits = (int)$data['hits']; + $hits = !empty($data['hits']) ? (int)$data['hits'] : 0; unset($data['hits']); foreach ($newdata as $key => $val) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-03-08 12:43:03
|
Revision: 6661 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6661&view=rev Author: vargenau Date: 2009-03-08 12:42:56 +0000 (Sun, 08 Mar 2009) Log Message: ----------- Add function reset in class WikiDB_backend_PearDB_generic_iter (copy from ADODB) Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2009-03-08 09:22:33 UTC (rev 6660) +++ trunk/lib/WikiDB/backend/PearDB.php 2009-03-08 12:42:56 UTC (rev 6661) @@ -1209,6 +1209,12 @@ return $record; } + function reset () { + if ($this->_result) { + $this->_result->MoveFirst(); + } + } + function free () { if ($this->_result) { $this->_result->free(); @@ -1258,277 +1264,6 @@ // function _quote($word) { return $this->_dbh->addq($word); } } -// $Log: not supported by cvs2svn $ -// Revision 1.108 2007/06/07 21:37:39 rurban -// add native asArray methods to generic iters (for DebugInfo) -// -// Revision 1.107 2007/05/28 20:13:46 rurban -// Overwrite all attributes at once at page->save to delete dangling meta -// -// Revision 1.106 2007/01/04 16:57:32 rurban -// Clarify API: sortby,limit and exclude are strings. fix upgrade test connection -// -// Revision 1.105 2006/12/23 13:03:32 rurban -// reorder deletion -// -// Revision 1.104 2006/12/23 11:44:56 rurban -// deal with strict references and the order of deletion -// -// Revision 1.103 2006/12/03 17:11:53 rurban -// #1535832 by matt brown: Check for base 64 encoded version data -// -// Revision 1.102 2006/12/02 21:57:27 rurban -// fix WantedPages SQL: no JOIN -// clarify first condition in CASE WHEN -// -// Revision 1.101 2006/11/29 19:49:05 rurban -// fix CASE WHEN SQL syntax error from previous commit -// -// Revision 1.100 2006/11/19 13:59:11 rurban -// Replace IF by CASE in exists_link() -// -// Revision 1.99 2006/10/08 12:40:51 rurban -// minor cleanup: remove unused vars -// -// Revision 1.98 2006/06/03 08:50:41 rurban -// revert wrong pear DB nextID() usage, our old is easier -// -// Revision 1.97 2006/05/14 12:28:03 rurban -// mysql 5.x fix for wantedpages join -// -// Revision 1.96 2006/04/15 12:28:53 rurban -// use pear nextID -// -// Revision 1.95 2006/02/22 21:52:28 rurban -// whitespace only -// -// Revision 1.94 2005/11/14 22:24:33 rurban -// fix fulltext search, -// Eliminate stoplist words, -// don't extract %pagedate twice in ADODB, -// add SemanticWeb support: link(relation), -// major postgresql update: stored procedures, tsearch2 for fulltext -// -// Revision 1.93 2005/10/10 19:42:15 rurban -// fix wanted_pages SQL syntax -// -// Revision 1.92 2005/09/14 06:04:43 rurban -// optimize searching for ALL (ie %), use the stoplist on PDO -// -// Revision 1.91 2005/09/11 14:55:05 rurban -// implement fulltext stoplist -// -// Revision 1.90 2005/09/11 13:25:12 rurban -// enhance LIMIT support -// -// Revision 1.89 2005/09/10 21:30:16 rurban -// enhance titleSearch -// -// Revision 1.88 2005/08/06 13:20:05 rurban -// add comments -// -// Revision 1.87 2005/02/10 19:04:24 rurban -// move getRow up one level to our backend class -// -// Revision 1.86 2005/01/29 19:51:02 rurban -// Bugs item #1077769 fixed by frugal. -// Deleted the wrong page. Fix all other tables also. -// -// Revision 1.85 2005/01/25 08:03:35 rurban -// support DATABASE_PERSISTENT besides dsn database?persistent=false; move lock_count up (per Charles Corrigan) -// -// Revision 1.84 2005/01/18 20:55:47 rurban -// reformatting and two bug fixes: adding missing parens -// -// Revision 1.83 2005/01/18 10:11:29 rurban -// Oops. Again thanks to Charles Corrigan -// -// Revision 1.82 2005/01/18 08:55:51 rurban -// fix quoting -// -// Revision 1.81 2005/01/17 08:53:09 rurban -// pagedata fix by Charles Corrigan -// -// Revision 1.80 2004/12/22 18:33:31 rurban -// fix page _id_cache logic for _get_pageid create_if_missing -// -// Revision 1.79 2004/12/10 02:45:27 rurban -// SQL optimization: -// put _cached_html from pagedata into a new seperate blob, not huge serialized string. -// it is only rarelely needed: for current page only, if-not-modified -// but was extracted for every simple page iteration. -// -// Revision 1.78 2004/12/08 12:55:51 rurban -// support new non-destructive delete_page via generic backend method -// -// Revision 1.77 2004/12/06 19:50:04 rurban -// enable action=remove which is undoable and seeable in RecentChanges: ADODB ony for now. -// renamed delete_page to purge_page. -// enable action=edit&version=-1 to force creation of a new version. -// added BABYCART_PATH config -// fixed magiqc in adodb.inc.php -// and some more docs -// -// Revision 1.76 2004/11/30 17:45:53 rurban -// exists_links backend implementation -// -// Revision 1.75 2004/11/28 20:42:33 rurban -// Optimize PearDB _extract_version_data and _extract_page_data. -// -// Revision 1.74 2004/11/27 14:39:05 rurban -// simpified regex search architecture: -// no db specific node methods anymore, -// new sql() method for each node -// parallel to regexp() (which returns pcre) -// regex types bitmasked (op's not yet) -// new regex=sql -// clarified WikiDB::quote() backend methods: -// ->quote() adds surrounsing quotes -// ->qstr() (new method) assumes strings and adds no quotes! (in contrast to ADODB) -// pear and adodb have now unified quote methods for all generic queries. -// -// Revision 1.73 2004/11/26 18:39:02 rurban -// new regex search parser and SQL backends (90% complete, glob and pcre backends missing) -// -// Revision 1.72 2004/11/25 17:20:51 rurban -// and again a couple of more native db args: backlinks -// -// Revision 1.71 2004/11/23 13:35:48 rurban -// add case_exact search -// -// Revision 1.70 2004/11/21 11:59:26 rurban -// remove final \n to be ob_cache independent -// -// Revision 1.69 2004/11/20 17:49:39 rurban -// add fast exclude support to SQL get_all_pages -// -// Revision 1.68 2004/11/20 17:35:58 rurban -// improved WantedPages SQL backends -// PageList::sortby new 3rd arg valid_fields (override db fields) -// WantedPages sql pager inexact for performance reasons: -// assume 3 wantedfrom per page, to be correct, no getTotal() -// support exclude argument for get_all_pages, new _sql_set() -// -// Revision 1.67 2004/11/10 19:32:24 rurban -// * optimize increaseHitCount, esp. for mysql. -// * prepend dirs to the include_path (phpwiki_dir for faster searches) -// * Pear_DB version logic (awful but needed) -// * fix broken ADODB quote -// * _extract_page_data simplification -// -// Revision 1.66 2004/11/10 15:29:21 rurban -// * requires newer Pear_DB (as the internal one): quote() uses now escapeSimple for strings -// * ACCESS_LOG_SQL: fix cause request not yet initialized -// * WikiDB: moved SQL specific methods upwards -// * new Pear_DB quoting: same as ADODB and as newer Pear_DB. -// fixes all around: WikiGroup, WikiUserNew SQL methods, SQL logging -// -// Revision 1.65 2004/11/09 17:11:17 rurban -// * revert to the wikidb ref passing. there's no memory abuse there. -// * use new wikidb->_cache->_id_cache[] instead of wikidb->_iwpcache, to effectively -// store page ids with getPageLinks (GleanDescription) of all existing pages, which -// are also needed at the rendering for linkExistingWikiWord(). -// pass options to pageiterator. -// use this cache also for _get_pageid() -// This saves about 8 SELECT count per page (num all pagelinks). -// * fix passing of all page fields to the pageiterator. -// * fix overlarge session data which got broken with the latest ACCESS_LOG_SQL changes -// -// Revision 1.64 2004/11/07 16:02:52 rurban -// new sql access log (for spam prevention), and restructured access log class -// dbh->quote (generic) -// pear_db: mysql specific parts seperated (using replace) -// -// Revision 1.63 2004/11/01 10:43:58 rurban -// seperate PassUser methods into seperate dir (memory usage) -// fix WikiUser (old) overlarge data session -// remove wikidb arg from various page class methods, use global ->_dbi instead -// ... -// -// Revision 1.62 2004/10/14 19:19:34 rurban -// loadsave: check if the dumped file will be accessible from outside. -// and some other minor fixes. (cvsclient native not yet ready) -// -// Revision 1.61 2004/10/14 17:19:17 rurban -// allow most_popular sortby arguments -// -// Revision 1.60 2004/07/09 10:06:50 rurban -// Use backend specific sortby and sortable_columns method, to be able to -// select between native (Db backend) and custom (PageList) sorting. -// Fixed PageList::AddPageList (missed the first) -// Added the author/creator.. name to AllPagesBy... -// display no pages if none matched. -// Improved dba and file sortby(). -// Use &$request reference -// -// Revision 1.59 2004/07/08 21:32:36 rurban -// Prevent from more warnings, minor db and sort optimizations -// -// Revision 1.58 2004/07/08 16:56:16 rurban -// use the backendType abstraction -// -// Revision 1.57 2004/07/05 12:57:54 rurban -// add mysql timeout -// -// Revision 1.56 2004/07/04 10:24:43 rurban -// forgot the expressions -// -// Revision 1.55 2004/07/03 16:51:06 rurban -// optional DBADMIN_USER:DBADMIN_PASSWD for action=upgrade (if no ALTER permission) -// added atomic mysql REPLACE for PearDB as in ADODB -// fixed _lock_tables typo links => link -// fixes unserialize ADODB bug in line 180 -// -// Revision 1.54 2004/06/29 08:52:24 rurban -// Use ...version() $need_content argument in WikiDB also: -// To reduce the memory footprint for larger sets of pagelists, -// we don't cache the content (only true or false) and -// we purge the pagedata (_cached_html) also. -// _cached_html is only cached for the current pagename. -// => Vastly improved page existance check, ACL check, ... -// -// Now only PagedList info=content or size needs the whole content, esp. if sortable. -// -// Revision 1.53 2004/06/27 10:26:03 rurban -// oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes -// -// Revision 1.52 2004/06/25 14:15:08 rurban -// reduce memory footprint by caching only requested pagedate content (improving most page iterators) -// -// Revision 1.51 2004/05/12 10:49:55 rurban -// require_once fix for those libs which are loaded before FileFinder and -// its automatic include_path fix, and where require_once doesn't grok -// dirname(__FILE__) != './lib' -// upgrade fix with PearDB -// navbar.tmpl: remove spaces for IE button alignment -// -// Revision 1.50 2004/05/06 17:30:39 rurban -// CategoryGroup: oops, dos2unix eol -// improved phpwiki_version: -// pre -= .0001 (1.3.10pre: 1030.099) -// -p1 += .001 (1.3.9-p1: 1030.091) -// improved InstallTable for mysql and generic SQL versions and all newer tables so far. -// abstracted more ADODB/PearDB methods for action=upgrade stuff: -// backend->backendType(), backend->database(), -// backend->listOfFields(), -// backend->listOfTables(), -// -// Revision 1.49 2004/05/03 21:35:30 rurban -// don't use persistent connections with postgres -// -// Revision 1.48 2004/04/26 20:44:35 rurban -// locking table specific for better databases -// -// Revision 1.47 2004/04/20 00:06:04 rurban -// themable paging support -// -// Revision 1.46 2004/04/19 21:51:41 rurban -// php5 compatibility: it works! -// -// Revision 1.45 2004/04/16 14:19:39 rurban -// updated ADODB notes -// - // (c-file-style: "gnu") // Local Variables: // mode: php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-07-15 16:04:03
|
Revision: 7615 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7615&view=rev Author: vargenau Date: 2010-07-15 16:03:57 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Fix paging (forgot this one) Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2010-07-15 15:56:21 UTC (rev 7614) +++ trunk/lib/WikiDB/backend/PearDB.php 2010-07-15 16:03:57 UTC (rev 7615) @@ -1190,6 +1190,7 @@ $this->_backend = &$backend; $this->_result = $query_result; + $this->_options = $field_list; } function count() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-04-13 13:02:53
|
Revision: 8042 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8042&view=rev Author: vargenau Date: 2011-04-13 13:02:42 +0000 (Wed, 13 Apr 2011) Log Message: ----------- Avoid warning Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2011-04-13 12:02:20 UTC (rev 8041) +++ trunk/lib/WikiDB/backend/PearDB.php 2011-04-13 13:02:42 UTC (rev 8042) @@ -40,7 +40,7 @@ $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_pear_notice_filter')); $this->_pearerrhandler = true; } - + // Open connection to database $this->_dsn = $dbparams['dsn']; $this->_dbparams = $dbparams; @@ -59,7 +59,7 @@ isset($dbparams['_tryroot_from_upgrade']) // hack! ? E_USER_WARNING : E_USER_ERROR); if (isset($dbparams['_tryroot_from_upgrade'])) - return; + return; } $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_pear_error_callback')); @@ -84,9 +84,9 @@ 'maxversion' => "MAX(version)", 'notempty' => "<>''", 'iscontent' => "content<>''"); - + } - + /** * Close database connection. */ @@ -120,7 +120,7 @@ . " AND pagename='%s'", $dbh->escapeSimple($pagename))); } - + function get_all_pagenames() { $dbh = &$this->_dbh; extract($this->_table_names); @@ -136,7 +136,7 @@ . " FROM $nonempty_tbl, $page_tbl" . " WHERE $nonempty_tbl.id=$page_tbl.id"); } - + function increaseHitCount($pagename) { $dbh = &$this->_dbh; // Hits is the only thing we can update in a fast manner. @@ -192,7 +192,7 @@ $data = array(); $this->_get_pageid($pagename, true); // Creates page record } - + $hits = !empty($data['hits']) ? (int)$data['hits'] : 0; unset($data['hits']); @@ -239,7 +239,7 @@ } function _get_pageid($pagename, $create_if_missing = false) { - + // check id_cache global $request; $cache =& $request->_dbi->_cache->_id_cache; @@ -254,7 +254,7 @@ $dbh = &$this->_dbh; $page_tbl = $this->_table_names['page_tbl']; - + $query = sprintf("SELECT id FROM $page_tbl WHERE pagename='%s'", $dbh->escapeSimple($pagename)); @@ -291,7 +291,7 @@ function get_previous_version($pagename, $version) { $dbh = &$this->_dbh; extract($this->_table_names); - + return (int)$dbh->getOne(sprintf("SELECT version" . " FROM $version_tbl, $page_tbl" @@ -305,7 +305,7 @@ $dbh->escapeSimple($pagename), $version)); } - + /** * Get version data. * @@ -321,7 +321,7 @@ 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) { @@ -358,10 +358,10 @@ base64_decode($query_result['versiondata']); } $data = $this->_unserialize($query_result['versiondata']); - + $data['mtime'] = $query_result['mtime']; $data['is_minor_edit'] = !empty($query_result['minor_edit']); - + if (isset($query_result['content'])) $data['%content'] = $query_result['content']; elseif ($query_result['have_content']) @@ -387,19 +387,19 @@ function set_versiondata($pagename, $version, $data) { $dbh = &$this->_dbh; $version_tbl = $this->_table_names['version_tbl']; - + $minor_edit = (int) !empty($data['is_minor_edit']); unset($data['is_minor_edit']); - + $mtime = (int)$data['mtime']; unset($data['mtime']); assert(!empty($mtime)); - @$content = (string) $data['%content']; + $content = isset($data['%content']) ? (string)$data['%content'] : ''; unset($data['%content']); unset($data['%pagedata']); - + $this->lock(); $id = $this->_get_pageid($pagename, true); @@ -415,10 +415,10 @@ $this->_update_recent_table($id); $this->_update_nonempty_table($id); - + $this->unlock(); } - + /** * Delete an old revision of a page. */ @@ -469,7 +469,7 @@ function purge_page($pagename) { $dbh = &$this->_dbh; extract($this->_table_names); - + $this->lock(); if ( ($id = $this->_get_pageid($pagename, false)) ) { $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$id"); @@ -532,6 +532,7 @@ $linkid = $this->_get_pageid($linkto, true); if (!$linkid) { echo("No link for $linkto on page $pagename"); + //printSimpleTrace(debug_backtrace()); trigger_error("No link for $linkto on page $pagename"); } assert($linkid); @@ -542,7 +543,7 @@ } $this->unlock(); } - + /** * Find pages which link to or are linked from a page. * @@ -588,7 +589,7 @@ } else { $result = $dbh->query($sql); } - + return new WikiDB_backend_PearDB_iter($this, $result); } @@ -671,7 +672,7 @@ } return new WikiDB_backend_PearDB_iter($this, $result, $options); } - + /** * Title search. * Todo: exclude @@ -690,7 +691,7 @@ if (!class_exists($searchclass)) $searchclass = "WikiDB_backend_PearDB_search"; $searchobj = new $searchclass($search, $dbh); - + $table = "$nonempty_tbl, $page_tbl"; $join_clause = "$nonempty_tbl.id=$page_tbl.id"; $fields = $this->page_tbl_fields; @@ -708,7 +709,7 @@ $callback = new WikiMethodCb($searchobj, "_pagename_match_clause"); } $search_clause = $search->makeSqlClauseObj($callback); - + $sql = "SELECT $fields FROM $table" . " WHERE $join_clause" . " AND ($search_clause)" @@ -719,7 +720,7 @@ } else { $result = $dbh->query($sql); } - + $iter = new WikiDB_backend_PearDB_iter($this, $result); $iter->stoplisted = @$searchobj->stoplisted; return $iter; @@ -810,6 +811,7 @@ if ($since) $pick[] = "mtime >= $since"; + if ($include_all_revisions) { // Include all revisions of each page. $table = "$page_tbl, $version_tbl"; @@ -829,7 +831,7 @@ $join_clause = "$page_tbl.id=$recent_tbl.id"; $table .= ", $version_tbl"; $join_clause .= " AND $version_tbl.id=$page_tbl.id"; - + if ($exclude_major_revisions) { // Include only most recent minor revision $pick[] = 'version=latestminor'; @@ -914,7 +916,7 @@ function rename_page ($pagename, $to) { $dbh = &$this->_dbh; extract($this->_table_names); - + $this->lock(); if (($id = $this->_get_pageid($pagename, false)) ) { if ($new = $this->_get_pageid($to, false)) { @@ -974,7 +976,7 @@ //. " AND content<>''" . " AND content $notempty" . ( $pageid ? " AND $recent_tbl.id=$pageid" : "")); - + $this->unlock(); } @@ -998,7 +1000,7 @@ function _lock_tables($write_lock) { trigger_error("virtual", E_USER_ERROR); } - + /** * Release a write lock on the tables in the SQL database. * @@ -1042,7 +1044,7 @@ function _unserialize($data) { return empty($data) ? array() : unserialize($data); } - + /** * Callback for PEAR (DB) errors. * @@ -1053,7 +1055,7 @@ function _pear_error_callback($error) { if ($this->_is_false_error($error)) return; - + $this->_dbh->setErrorHandling(PEAR_ERROR_PRINT); // prevent recursive loops. $this->close(); trigger_error($this->_pear_error_message($error), E_USER_ERROR); @@ -1082,13 +1084,13 @@ //" <--kludge for brain-dead syntax coloring return false; } - + if (! in_array('ismanip', get_class_methods('DB'))) { // Pear shipped with PHP 4.0.4pl1 (and before, presumably) // does not have the DB::isManip method. return true; } - + if (DB::isManip($query)) { // If Pear thinks it's an isManip then it wouldn't have thrown // the error we're testing for.... @@ -1185,7 +1187,7 @@ // This shouldn't happen, I thought. $backend->_pear_error_callback($query_result); } - + $this->_backend = &$backend; $this->_result = $query_result; $this->_options = $field_list; @@ -1196,7 +1198,7 @@ return false; return $this->_result->numRows(); } - + function next() { if (!$this->_result) return false; @@ -1206,7 +1208,7 @@ $this->free(); return false; } - + return $record; } @@ -1245,7 +1247,7 @@ $this->free(); return false; } - + $pagedata = $backend->_extract_page_data($record); $rec = array('pagename' => $record['pagename'], 'pagedata' => $pagedata); @@ -1254,7 +1256,7 @@ $rec['versiondata'] = $backend->_extract_version_data($record); $rec['version'] = $record['version']; } - + return $rec; } } @@ -1271,5 +1273,5 @@ // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-21 12:58:47
|
Revision: 8511 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8511&view=rev Author: vargenau Date: 2012-11-21 12:58:40 +0000 (Wed, 21 Nov 2012) Log Message: ----------- Remove unused require_once Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2012-11-21 11:29:43 UTC (rev 8510) +++ trunk/lib/WikiDB/backend/PearDB.php 2012-11-21 12:58:40 UTC (rev 8511) @@ -1,8 +1,6 @@ <?php require_once 'lib/WikiDB/backend.php'; -//require_once('lib/FileFinder.php'); -//require_once('lib/ErrorManager.php'); class WikiDB_backend_PearDB extends WikiDB_backend @@ -14,7 +12,6 @@ // Find and include PEAR's DB.php. maybe we should force our private version again... // if DB would have exported its version number, it would be easier. @require_once('DB/common.php'); // Either our local pear copy or the system one - // check the version! $name = "escapeSimple"; // TODO: apparently some Pear::Db version adds LIMIT 1,0 to getOne(), // which is invalid for "select version()" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-30 09:00:20
|
Revision: 10402 http://sourceforge.net/p/phpwiki/code/10402 Author: vargenau Date: 2021-07-30 09:00:18 +0000 (Fri, 30 Jul 2021) Log Message: ----------- Remove unused function _pear_notice_filter Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-07-30 08:59:36 UTC (rev 10401) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-07-30 09:00:18 UTC (rev 10402) @@ -1110,22 +1110,6 @@ return str_replace($this->_dsn, $safe_dsn, $message); } - /* - * Filter PHP errors notices from PEAR DB code. - * - * The PEAR DB code which ships with PHP 4.0.6 produces spurious - * errors and notices. This is an error callback (for use with - * ErrorManager which will filter out those spurious messages.) - * @see _is_false_error, ErrorManager - */ - function _pear_notice_filter($err) - { - return ($err->isNotice() - && preg_match('|DB[/\\\\]common.php$|', $err->errfile) - && $err->errline == 126 - && preg_match('/Undefined offset: +0\b/', $err->errstr)); - } - /* some variables and functions for DB backend abstraction (action=upgrade) */ function database() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-17 14:49:12
|
Revision: 8667 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8667&view=rev Author: vargenau Date: 2012-12-17 14:49:06 +0000 (Mon, 17 Dec 2012) Log Message: ----------- Add is_object check Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2012-12-17 13:32:16 UTC (rev 8666) +++ trunk/lib/WikiDB/backend/PearDB.php 2012-12-17 14:49:06 UTC (rev 8667) @@ -1286,9 +1286,14 @@ function next() { $backend = &$this->_backend; - if (!$this->_result) + if (!$this->_result) { return false; + } + if (!is_object($this->_result)) { + return false; + } + $record = $this->_result->fetchRow(DB_FETCHMODE_ASSOC); if (!$record) { $this->free(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-17 15:27:37
|
Revision: 8978 http://sourceforge.net/p/phpwiki/code/8978 Author: vargenau Date: 2014-07-17 15:27:35 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Use public when needed Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2014-07-17 15:18:20 UTC (rev 8977) +++ trunk/lib/WikiDB/backend/PearDB.php 2014-07-17 15:27:35 UTC (rev 8978) @@ -1071,7 +1071,7 @@ * * @param A PEAR_error object. */ - protected function _pear_error_callback($error) + public function _pear_error_callback($error) { if ($this->_is_false_error($error)) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-03-09 10:06:06
|
Revision: 9620 http://sourceforge.net/p/phpwiki/code/9620 Author: vargenau Date: 2015-03-09 10:05:59 +0000 (Mon, 09 Mar 2015) Log Message: ----------- Comment only Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2015-03-06 17:21:47 UTC (rev 9619) +++ trunk/lib/WikiDB/backend/PearDB.php 2015-03-09 10:05:59 UTC (rev 9620) @@ -682,7 +682,7 @@ } /* - * Title and fulltext search. + * Text search (title or full text) */ public function text_search($search, $fulltext = false, $sortby = '', $limit = '', $exclude = '') @@ -691,7 +691,6 @@ extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); if ($orderby) $orderby = ' ORDER BY ' . $orderby; - //else " ORDER BY rank($field, to_tsquery('$searchon')) DESC"; $searchclass = get_class($this) . "_search"; // no need to define it everywhere and then fallback. memory! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2017-07-11 13:47:04
|
Revision: 10023 http://sourceforge.net/p/phpwiki/code/10023 Author: vargenau Date: 2017-07-11 13:47:03 +0000 (Tue, 11 Jul 2017) Log Message: ----------- Indent Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2017-07-10 16:26:33 UTC (rev 10022) +++ trunk/lib/WikiDB/backend/PearDB.php 2017-07-11 13:47:03 UTC (rev 10023) @@ -399,7 +399,8 @@ if (isset($query_result['content'])) $data['%content'] = $query_result['content']; elseif ($query_result['have_content']) - $data['%content'] = true; else + $data['%content'] = true; + else $data['%content'] = ''; // FIXME: this is ugly. 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:31:13
|
Revision: 10100 http://sourceforge.net/p/phpwiki/code/10100 Author: vargenau Date: 2019-04-17 17:31:09 +0000 (Wed, 17 Apr 2019) Log Message: ----------- Let us use our PEAR DB Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2019-04-17 07:44:25 UTC (rev 10099) +++ trunk/lib/WikiDB/backend/PearDB.php 2019-04-17 17:31:09 UTC (rev 10100) @@ -31,35 +31,9 @@ function __construct($dbparams) { - // Find and include PEAR's DB.php. maybe we should force our private version again... - // if DB would have exported its version number, it would be easier. - @require_once('DB/common.php'); // Either our local pear copy or the system one - $name = "escapeSimple"; - // TODO: apparently some Pear::Db version adds LIMIT 1,0 to getOne(), - // which is invalid for "select version()" - if (!in_array($name, get_class_methods("DB_common"))) { - $finder = new FileFinder(); - $dir = dirname(__FILE__) . "/../../pear"; - $finder->_prepend_to_include_path($dir); - include_once("$dir/DB/common.php"); // use our version instead. - if (!in_array($name, get_class_methods("DB_common"))) { - $pearFinder = new PearFileFinder("lib/pear"); - $pearFinder->includeOnce('DB.php'); - } else { - include_once("$dir/DB.php"); - } - } else { - include_once 'DB.php'; - } + require_once('lib/pear/DB/common.php'); + require_once('lib/pear/DB.php'); - // Install filter to handle bogus error notices from buggy DB.php's. - // TODO: check the Pear_DB version, but how? - if (DEBUG) { - global $ErrorManager; - $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_pear_notice_filter')); - $this->_pearerrhandler = true; - } - // Open connection to database $this->_dsn = $dbparams['dsn']; $this->_dbparams = $dbparams; @@ -111,8 +85,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 />", @@ -189,10 +164,13 @@ return $result ? $this->_extract_page_data($result) : false; } - public function _extract_page_data($data) + public function _extract_page_data($data) { - if (empty($data)) return array(); - elseif (empty($data['pagedata'])) return $data; else { + if (empty($data)) { + return array(); + } elseif (empty($data['pagedata'])) { + return $data; + } else { $data = array_merge($data, $this->_unserialize($data['pagedata'])); unset($data['pagedata']); return $data; @@ -1066,8 +1044,9 @@ */ public function _pear_error_callback($error) { - if ($this->_is_false_error($error)) + if ($this->_is_false_error($error)) { return; + } $this->_dbh->setErrorHandling(PEAR_ERROR_PRINT); // prevent recursive loops. $this->close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-24 10:30:56
|
Revision: 10322 http://sourceforge.net/p/phpwiki/code/10322 Author: vargenau Date: 2021-06-24 10:30:58 +0000 (Thu, 24 Jun 2021) Log Message: ----------- Remove undefined variable $options Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-06-23 17:46:03 UTC (rev 10321) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-06-24 10:30:58 UTC (rev 10322) @@ -655,7 +655,7 @@ } else { $result = $dbh->query($sql); } - return new WikiDB_backend_PearDB_iter($this, $result, $options); + return new WikiDB_backend_PearDB_iter($this, $result); } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-28 17:12:40
|
Revision: 10384 http://sourceforge.net/p/phpwiki/code/10384 Author: vargenau Date: 2021-07-28 17:12:38 +0000 (Wed, 28 Jul 2021) Log Message: ----------- backendType: check for "mysqli" also Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-07-28 15:12:26 UTC (rev 10383) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-07-28 17:12:38 UTC (rev 10384) @@ -1154,7 +1154,7 @@ function listOfFields($database, $table) { - if ($this->backendType() == 'mysql') { + if (($this->backendType() == 'mysql') || ($this->backendType() == 'mysqli')) { $fields = array(); assert(!empty($database)); assert(!empty($table)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-01 16:32:46
|
Revision: 10528 http://sourceforge.net/p/phpwiki/code/10528 Author: vargenau Date: 2021-09-01 16:32:44 +0000 (Wed, 01 Sep 2021) Log Message: ----------- PearDB.php: move functions getRow and _sql_set Modified Paths: -------------- trunk/lib/WikiDB/backend/PearDB.php Modified: trunk/lib/WikiDB/backend/PearDB.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB.php 2021-09-01 16:12:07 UTC (rev 10527) +++ trunk/lib/WikiDB/backend/PearDB.php 2021-09-01 16:32:44 UTC (rev 10528) @@ -77,6 +77,12 @@ } + /* with one result row */ + function getRow($sql) + { + return $this->_dbh->getRow($sql); + } + /** * Close database connection. */ @@ -207,17 +213,6 @@ else $data[$key] = $val; } - - /* Portability issue -- not all DBMS supports huge strings - * so we need to 'bind' instead of building a simple SQL statment. - * Note that we do not need to escapeSimple when we bind - $dbh->query(sprintf("UPDATE $page_tbl" - . " SET hits=%d, pagedata='%s'" - . " WHERE pagename='%s'", - $hits, - $dbh->escapeSimple($this->_serialize($data)), - $dbh->escapeSimple($pagename))); - */ $dbh->query("UPDATE $page_tbl" . " SET hits=?, pagedata=?" . " WHERE pagename=?", @@ -757,6 +752,15 @@ return "pagename LIKE '%$word%' OR content LIKE '%$word%'"; } + function _sql_set(&$pagenames) + { + $s = '('; + foreach ($pagenames as $p) { + $s .= ("'" . $this->_dbh->escapeSimple($p) . "',"); + } + return substr($s, 0, -1) . ")"; + } + /* * Find highest or lowest hit counts. */ @@ -902,15 +906,6 @@ return new WikiDB_backend_PearDB_generic_iter($this, $result); } - function _sql_set(&$pagenames) - { - $s = '('; - foreach ($pagenames as $p) { - $s .= ("'" . $this->_dbh->escapeSimple($p) . "',"); - } - return substr($s, 0, -1) . ")"; - } - /** * Rename page in the database. * @@ -954,13 +949,13 @@ $this->lock(); $dbh->query("DELETE FROM $recent_tbl" - . ($pageid ? " WHERE id=$pageid" : "")); + . ($pageid ? " WHERE id=$pageid" : "")); $dbh->query("INSERT INTO $recent_tbl" - . " (id, latestversion, latestmajor, latestminor)" - . " SELECT id, $maxversion, $maxmajor, $maxminor" - . " FROM $version_tbl" - . ($pageid ? " WHERE id=$pageid" : "") - . " GROUP BY id"); + . " (id, latestversion, latestmajor, latestminor)" + . " SELECT id, $maxversion, $maxmajor, $maxminor" + . " FROM $version_tbl" + . ($pageid ? " WHERE id=$pageid" : "") + . " GROUP BY id"); $this->unlock(); } @@ -1140,11 +1135,6 @@ return $this->_dbh->connection; } - function getRow($query) - { - return $this->_dbh->getRow($query); - } - function listOfTables() { return $this->_dbh->getListOf('tables'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |