From: <var...@us...> - 2014-10-07 14:19:21
|
Revision: 9215 http://sourceforge.net/p/phpwiki/code/9215 Author: vargenau Date: 2014-10-07 14:19:17 +0000 (Tue, 07 Oct 2014) Log Message: ----------- Only variables can be passed by reference Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2014-10-07 14:16:56 UTC (rev 9214) +++ trunk/lib/WikiDB/backend/PDO.php 2014-10-07 14:19:17 UTC (rev 9215) @@ -638,11 +638,14 @@ $insert = $dbh->prepare("INSERT INTO $version_tbl" . " (id,version,mtime,minor_edit,content,versiondata)" . " VALUES(?,?,?,?,?,?)"); + $version_plus_1 = $version + 1; + $zero = 0; + $empty_string = ''; $insert->bindParam(1, $id, PDO::PARAM_INT); - $insert->bindParam(2, $version + 1, PDO::PARAM_INT); + $insert->bindParam(2, $version_plus_1, PDO::PARAM_INT); $insert->bindParam(3, $mtime, PDO::PARAM_INT); - $insert->bindParam(4, 0, PDO::PARAM_INT); - $insert->bindParam(5, '', PDO::PARAM_STR, 100); + $insert->bindParam(4, $zero, PDO::PARAM_INT); + $insert->bindParam(5, $empty_string, PDO::PARAM_STR, 100); $insert->bindParam(6, $this->_serialize($meta), PDO::PARAM_STR, 100); if ($insert->execute() and $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$id") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-02-11 17:46:58
|
Revision: 9799 http://sourceforge.net/p/phpwiki/code/9799 Author: vargenau Date: 2016-02-11 17:46:56 +0000 (Thu, 11 Feb 2016) Log Message: ----------- Add variable initialisation Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2016-02-11 10:04:41 UTC (rev 9798) +++ trunk/lib/WikiDB/backend/PDO.php 2016-02-11 17:46:56 UTC (rev 9799) @@ -1318,7 +1318,7 @@ { $dbh = &$this->_dbh; $log_tbl = $entry->_accesslog->logtable; - $dbh->prepare("INSERT INTO $log_tbl" + $sth = $dbh->prepare("INSERT INTO $log_tbl" . " (time_stamp,remote_host,remote_user,request_method,request_line,request_args," . "request_file,request_uri,request_time,status,bytes_sent,referer,agent,request_duration)" . " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-02-11 18:00:44
|
Revision: 9800 http://sourceforge.net/p/phpwiki/code/9800 Author: vargenau Date: 2016-02-11 18:00:42 +0000 (Thu, 11 Feb 2016) Log Message: ----------- Add variable initialisation Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2016-02-11 17:46:56 UTC (rev 9799) +++ trunk/lib/WikiDB/backend/PDO.php 2016-02-11 18:00:42 UTC (rev 9800) @@ -47,6 +47,9 @@ unset($parsed['phptype']); unset($parsed['dbsyntax']); $dbparams['dsn'] = $driver . ":"; + if (!isset($this->_dbh)) { + $this->_dbh = new stdClass(); + } $this->_dbh->database = $parsed['database']; // mysql needs to map database=>dbname, hostspec=>host. TODO for the others. $dsnmap = array('mysql' => array('database' => 'dbname', 'hostspec' => 'host') 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:38:57
|
Revision: 9837 http://sourceforge.net/p/phpwiki/code/9837 Author: vargenau Date: 2016-05-23 11:38:54 +0000 (Mon, 23 May 2016) Log Message: ----------- Use consistent case Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2016-05-23 10:13:16 UTC (rev 9836) +++ trunk/lib/WikiDB/backend/PDO.php 2016-05-23 11:38:54 UTC (rev 9837) @@ -175,10 +175,10 @@ $this->_dbh->commit(); } - function rollback() + function rollBack() { if ($this->_hasTransactions) - $this->_dbh->rollback(); + $this->_dbh->rollBack(); } /* no result */ @@ -633,7 +633,7 @@ $this->beginTransaction(); //$dbh->CommitLock($recent_tbl); if (($id = $this->_get_pageid($pagename, false)) === false) { - $this->rollback(); + $this->rollBack(); return false; } $mtime = time(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2017-08-10 15:01:56
|
Revision: 10029 http://sourceforge.net/p/phpwiki/code/10029 Author: vargenau Date: 2017-08-10 15:01:53 +0000 (Thu, 10 Aug 2017) Log Message: ----------- Align PDO code with Pear Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2017-08-10 14:27:11 UTC (rev 10028) +++ trunk/lib/WikiDB/backend/PDO.php 2017-08-10 15:01:53 UTC (rev 10029) @@ -225,9 +225,9 @@ $dbh = &$this->_dbh; extract($this->_table_names); $sth = $dbh->prepare("SELECT $page_tbl.id AS id" - . " FROM $nonempty_tbl, $page_tbl" - . " WHERE $nonempty_tbl.id=$page_tbl.id" - . " AND pagename=?"); + . " FROM $nonempty_tbl, $page_tbl" + . " WHERE $nonempty_tbl.id=$page_tbl.id" + . " AND pagename=?"); $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); if ($sth->execute()) return $sth->fetchColumn(); @@ -426,10 +426,10 @@ $dbh = &$this->_dbh; extract($this->_table_names); $sth = $dbh->prepare("SELECT latestversion" - . " FROM $page_tbl, $recent_tbl" - . " WHERE $page_tbl.id=$recent_tbl.id" - . " AND pagename=?" - . " LIMIT 1"); + . " FROM $page_tbl, $recent_tbl" + . " WHERE $page_tbl.id=$recent_tbl.id" + . " AND pagename=?" + . " LIMIT 1"); $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); $sth->execute(); return $sth->fetchColumn(); @@ -473,8 +473,9 @@ // FIXME: optimization: sometimes don't get page data? if ($want_content) { - $fields = $this->page_tbl_fields . ", $page_tbl.pagedata AS pagedata" - . ', ' . $this->version_tbl_fields; + $fields = $this->page_tbl_fields + . ",$page_tbl.pagedata AS pagedata," + . $this->version_tbl_fields; } else { $fields = $this->page_tbl_fields . ", '' AS pagedata" . ", $version_tbl.version AS version, $version_tbl.mtime AS mtime, " @@ -482,11 +483,11 @@ . "$version_tbl.versiondata as versiondata"; } $sth = $dbh->prepare("SELECT $fields" - . " FROM $page_tbl, $version_tbl" - . " WHERE $page_tbl.id=$version_tbl.id" - . " AND pagename=?" - . " AND version=?" - . " LIMIT 1"); + . " FROM $page_tbl, $version_tbl" + . " WHERE $page_tbl.id=$version_tbl.id" + . " AND pagename=?" + . " AND version=?" + . " LIMIT 1"); $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); $sth->bindParam(2, $version, PDO::PARAM_INT); $sth->execute(); @@ -691,9 +692,9 @@ $this->lock(array('version', 'recent', 'nonempty', 'page', 'link')); if (($id = $this->_get_pageid($pagename, false))) { + $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"); - $dbh->query("DELETE FROM $recent_tbl WHERE id=$id"); - $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$id"); $this->set_links($pagename, array()); $sth = $dbh->prepare("SELECT COUNT(*) FROM $link_tbl WHERE linkto=$id"); $sth->execute(); @@ -837,13 +838,14 @@ 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 = ''; + } $limit = $this->_limit_sql($limit); - if (strstr($orderby, 'mtime ')) { // was ' mtime' + if (strstr($orderby, 'mtime ')) { // multiple columns possible if ($include_empty) { $sql = "SELECT " . $this->page_tbl_fields @@ -885,7 +887,7 @@ } /* - * Title and fulltext search. + * Text search (title or full text) */ public function text_search($search, $fulltext = false, $sortby = '', $limit = '', $exclude = '') @@ -958,9 +960,10 @@ } else { $where = " AND hits > 0"; } + $orderby = ''; if ($sortby != '-hits') { - if ($order = $this->sortby($sortby, 'db')) $orderby = " ORDER BY " . $order; - else $orderby = ""; + if ($order = $this->sortby($sortby, 'db')) + $orderby = " ORDER BY " . $order; } else { $orderby = " ORDER BY hits $order"; } @@ -1108,13 +1111,13 @@ // Cludge Alert! // This page does not exist (already verified before), but exists in the page table. // So we delete this page. - $dbh->query("DELETE FROM $page_tbl WHERE id=$new"); + $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$new"); + $dbh->query("DELETE FROM $recent_tbl WHERE id=$new"); $dbh->query("DELETE FROM $version_tbl WHERE id=$new"); - $dbh->query("DELETE FROM $recent_tbl WHERE id=$new"); - $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$new"); // We have to fix all referring tables to the old id $dbh->query("UPDATE $link_tbl SET linkfrom=$id WHERE linkfrom=$new"); $dbh->query("UPDATE $link_tbl SET linkto=$id WHERE linkto=$new"); + $dbh->query("DELETE FROM $page_tbl WHERE id=$new"); } $sth = $dbh->prepare("UPDATE $page_tbl SET pagename=? WHERE id=?"); $sth->bindParam(1, $to, PDO::PARAM_STR, 100); @@ -1137,11 +1140,11 @@ $backend_type = $this->backendType(); if (substr($backend_type, 0, 5) == 'mysql') { $sth = $dbh->prepare("REPLACE 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"); $sth->execute(); } else { $this->lock(array('recent')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2019-04-18 16:58:57
|
Revision: 10107 http://sourceforge.net/p/phpwiki/code/10107 Author: vargenau Date: 2019-04-18 16:58:56 +0000 (Thu, 18 Apr 2019) Log Message: ----------- PDO: dbh->exec("SELECT --> dbh->query("SELECT Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2019-04-18 16:39:10 UTC (rev 10106) +++ trunk/lib/WikiDB/backend/PDO.php 2019-04-18 16:58:56 UTC (rev 10107) @@ -255,7 +255,7 @@ { $dbh = &$this->_dbh; extract($this->_table_names); - $sth = $dbh->exec("SELECT count(*)" + $sth = $dbh->query("SELECT count(*)" . " FROM $nonempty_tbl, $page_tbl" . " WHERE $nonempty_tbl.id=$page_tbl.id"); return $sth->fetchColumn(); 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:13:17
|
Revision: 10343 http://sourceforge.net/p/phpwiki/code/10343 Author: vargenau Date: 2021-07-02 16:13:10 +0000 (Fri, 02 Jul 2021) Log Message: ----------- PDO: allow "mysqli" as well as "mysql" for DSN Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-07-02 09:24:10 UTC (rev 10342) +++ trunk/lib/WikiDB/backend/PDO.php 2021-07-02 16:13:10 UTC (rev 10343) @@ -31,7 +31,6 @@ class WikiDB_backend_PDO extends WikiDB_backend { - function __construct($dbparams) { $this->_dbparams = $dbparams; @@ -46,6 +45,9 @@ * e.g: odbc:DSN=SAMPLE;UID=db2inst1;PWD=ibmdb2, mysql:host=127.0.0.1;dbname=testdb */ $driver = $parsed['phptype']; + if ($driver == "mysqli") { + $driver = "mysql"; + } unset($parsed['phptype']); unset($parsed['dbsyntax']); $dbparams['dsn'] = $driver . ":"; @@ -54,8 +56,7 @@ } $this->_dbh->database = $parsed['database']; // mysql needs to map database=>dbname, hostspec=>host. TODO for the others. - $dsnmap = array('mysql' => array('database' => 'dbname', 'hostspec' => 'host') - ); + $dsnmap = array('mysql' => array('database' => 'dbname', 'hostspec' => 'host')); foreach (array('protocol', 'hostspec', 'port', 'socket', 'database') as $option) { if (!empty($parsed[$option])) { $optionname = (isset($dsnmap[$driver][$option]) and !isset($parsed[$optionname])) @@ -89,14 +90,6 @@ } try { - // try to load it dynamically (unix only) - if (!loadPhpExtension("pdo_$driver")) { - echo $GLOBALS['php_errormsg'], "<br>\n"; - trigger_error(sprintf("dl() problem: Required extension '%s' could not be loaded!", - "pdo_$driver"), - E_USER_WARNING); - } - // persistent is defined as DSN option, or with a config value. // phptype://username:password@hostspec/database?persistent=false $this->_dbh = new PDO($dbparams['dsn'], @@ -1505,7 +1498,7 @@ $parsed['dbsyntax'] = $str; } - if (!count($dsn)) { + if ($dsn == null) { return $parsed; } 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:18:03
|
Revision: 10345 http://sourceforge.net/p/phpwiki/code/10345 Author: vargenau Date: 2021-07-02 17:17:56 +0000 (Fri, 02 Jul 2021) Log Message: ----------- PDO: fix fetchColumn call Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-07-02 16:48:08 UTC (rev 10344) +++ trunk/lib/WikiDB/backend/PDO.php 2021-07-02 17:17:56 UTC (rev 10345) @@ -346,7 +346,7 @@ $sth = $dbh->prepare("SELECT cached_html FROM $page_tbl WHERE pagename=? LIMIT 1"); $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); $sth->execute(); - return $sth->fetchColumn(PDO::FETCH_NUM); + return $sth->fetchColumn(0); } function set_cached_html($pagename, $data) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-11 10:37:21
|
Revision: 10484 http://sourceforge.net/p/phpwiki/code/10484 Author: vargenau Date: 2021-08-11 10:37:20 +0000 (Wed, 11 Aug 2021) Log Message: ----------- Add missing parameter to be compatible with parent Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-11 10:35:39 UTC (rev 10483) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-11 10:37:20 UTC (rev 10484) @@ -790,8 +790,9 @@ * existing links. */ function get_links($pagename, $reversed = true, $include_empty = false, - $sortby = '', $limit = '', $exclude = '') - { + $sortby = '', $limit = '', $exclude = '', + $want_relations = false) +{ $dbh = &$this->_dbh; extract($this->_table_names); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-13 18:06:06
|
Revision: 10510 http://sourceforge.net/p/phpwiki/code/10510 Author: vargenau Date: 2021-08-13 18:06:03 +0000 (Fri, 13 Aug 2021) Log Message: ----------- lib/WikiDB/backend/PDO.php: fix SQL syntax Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-13 16:02:02 UTC (rev 10509) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-13 18:06:03 UTC (rev 10510) @@ -138,7 +138,7 @@ $page_tbl = $this->_table_names['page_tbl']; $version_tbl = $this->_table_names['version_tbl']; $this->page_tbl_fields = "$page_tbl.id AS id, $page_tbl.pagename AS pagename, " - . "$page_tbl.hits hits"; + . "$page_tbl.hits AS hits"; $this->page_tbl_field_list = array('id', 'pagename', 'hits'); $this->version_tbl_fields = "$version_tbl.version AS version, " . "$version_tbl.mtime AS mtime, " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-14 14:54:59
|
Revision: 10516 http://sourceforge.net/p/phpwiki/code/10516 Author: vargenau Date: 2021-08-14 14:54:57 +0000 (Sat, 14 Aug 2021) Log Message: ----------- PDO: function set_links merged from PearDB Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-14 14:04:00 UTC (rev 10515) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-14 14:54:57 UTC (rev 10516) @@ -716,8 +716,6 @@ * * @param string $pagename Page name * @param array $links List of page(names) which page links to. - * - * on DEBUG: delete old, deleted links from page */ function set_links($pagename, $links) { @@ -730,40 +728,37 @@ $this->lock(array('link')); $pageid = $this->_get_pageid($pagename, true); + $dbh->query("DELETE FROM $link_tbl WHERE linkfrom=$pageid"); if ($links) { - $dbh->query("DELETE FROM $link_tbl WHERE linkfrom=$pageid"); + $linkseen = array(); foreach ($links as $link) { - if (isset($linkseen[$link])) + $linkto = $link['linkto']; + if ($linkto === "") { // ignore attributes continue; - $linkseen[$link] = true; - $linkid = $this->_get_pageid($link, true); + } + if (isset($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); + if (!$linkid) { + echo("No link for $linkto on page $pagename"); + trigger_error("No link for $linkto on page $pagename"); + } assert($linkid); - $dbh->query("INSERT INTO $link_tbl (linkfrom, linkto)" - . " VALUES ($pageid, $linkid)"); + $dbh->query("INSERT INTO $link_tbl (linkfrom, linkto, relation)" + . " VALUES ($pageid, $linkid, $relation)"); } - } elseif (DEBUG) { - // purge page table: delete all non-referenced pages - // for all previously linked pages... - $sth = $dbh->prepare("SELECT $link_tbl.linkto as id FROM $link_tbl" . - " WHERE linkfrom=$pageid"); - $sth->execute(); - foreach ($sth->fetchAll(PDO::FETCH_NUM) as $id) { - // ...check if the page is empty and has no version - $sth1 = $dbh->prepare("SELECT $page_tbl.id FROM $page_tbl" - . " LEFT JOIN $nonempty_tbl USING (id) " - . " LEFT JOIN $version_tbl USING (id)" - . " WHERE ISNULL($nonempty_tbl.id) AND" - . " ISNULL($version_tbl.id) AND $page_tbl.id=$id"); - $sth1->execute(); - if ($sth1->fetchColumn()) { - $dbh->query("DELETE FROM $page_tbl WHERE id=$id"); // this purges the link - $dbh->query("DELETE FROM $recent_tbl WHERE id=$id"); // may fail - } - } - $dbh->query("DELETE FROM $link_tbl WHERE linkfrom=$pageid"); + unset($linkseen); } $this->unlock(array('link')); - return true; } /** @@ -788,7 +783,7 @@ function get_links($pagename, $reversed = true, $include_empty = false, $sortby = '', $limit = '', $exclude = '', $want_relations = false) -{ + { $dbh = &$this->_dbh; extract($this->_table_names); 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:14:40
|
Revision: 10518 http://sourceforge.net/p/phpwiki/code/10518 Author: vargenau Date: 2021-08-14 19:14:38 +0000 (Sat, 14 Aug 2021) Log Message: ----------- lib/WikiDB/backend/PDO.php: bindParam with a variable, factor code, use default value Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-14 17:59:15 UTC (rev 10517) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-14 19:14:38 UTC (rev 10518) @@ -452,7 +452,7 @@ * @param int $version Which version to get * @param bool $want_content Do we need content? * - * @return array The version data, or false if specified version does not exist. + * @return array|false The version data, or false if specified version does not exist. */ function get_versiondata($pagename, $version, $want_content = false) { @@ -556,14 +556,6 @@ $sth = $dbh->prepare("REPLACE INTO $version_tbl" . " (id,version,mtime,minor_edit,content,versiondata)" . " VALUES(?,?,?,?,?,?)"); - $sth->bindParam(1, $id, PDO::PARAM_INT); - $sth->bindParam(2, $version, PDO::PARAM_INT); - $sth->bindParam(3, $mtime, PDO::PARAM_INT); - $sth->bindParam(4, $minor_edit, PDO::PARAM_INT); - $sth->bindParam(5, $content, 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" . " WHERE id=? AND version=?"); @@ -573,15 +565,15 @@ $sth = $dbh->prepare("INSERT INTO $version_tbl" . " (id,version,mtime,minor_edit,content,versiondata)" . " VALUES(?,?,?,?,?,?)"); - $sth->bindParam(1, $id, PDO::PARAM_INT); - $sth->bindParam(2, $version, PDO::PARAM_INT); - $sth->bindParam(3, $mtime, PDO::PARAM_INT); - $sth->bindParam(4, $minor_edit, PDO::PARAM_INT); - $sth->bindParam(5, $content, PDO::PARAM_STR, 100); - $serialized_data = $this->_serialize($data); - $sth->bindParam(6, $serialized_data, PDO::PARAM_STR, 100); - $rs = $sth->execute(); } + $sth->bindParam(1, $id, PDO::PARAM_INT); + $sth->bindParam(2, $version, PDO::PARAM_INT); + $sth->bindParam(3, $mtime, PDO::PARAM_INT); + $sth->bindParam(4, $minor_edit, PDO::PARAM_INT); + $sth->bindParam(5, $content, 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); $this->_update_nonempty_table($id); if ($rs) { @@ -633,7 +625,7 @@ $this->beginTransaction(); //$dbh->CommitLock($recent_tbl); - if (($id = $this->_get_pageid($pagename, false)) === false) { + if (($id = $this->_get_pageid($pagename)) === false) { $this->rollBack(); return false; } @@ -653,12 +645,13 @@ $version_plus_1 = $version + 1; $zero = 0; $empty_string = ''; + $meta_serialized = $this->_serialize($meta); $insert->bindParam(1, $id, PDO::PARAM_INT); $insert->bindParam(2, $version_plus_1, PDO::PARAM_INT); $insert->bindParam(3, $mtime, PDO::PARAM_INT); $insert->bindParam(4, $zero, PDO::PARAM_INT); $insert->bindParam(5, $empty_string, PDO::PARAM_STR, 100); - $insert->bindParam(6, $this->_serialize($meta), PDO::PARAM_STR, 100); + $insert->bindParam(6, $meta_serialized, PDO::PARAM_STR, 100); if ($insert->execute() and $dbh->query("DELETE FROM $nonempty_tbl WHERE id=$id") and $this->set_links($pagename, array()) @@ -688,7 +681,7 @@ extract($this->_table_names); $this->lock(array('version', 'recent', 'nonempty', 'page', 'link')); - 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"); @@ -1126,8 +1119,8 @@ extract($this->_table_names); $this->lock(array('page', 'version', 'recent', 'nonempty', 'link')); - 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. @@ -1381,8 +1374,7 @@ if (!is_object($this->_result)) { return false; } - $count = $this->_result->rowCount(); - return $count; + return $this->_result->rowCount(); } function next() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-16 09:56:13
|
Revision: 10522 http://sourceforge.net/p/phpwiki/code/10522 Author: vargenau Date: 2021-08-16 09:56:12 +0000 (Mon, 16 Aug 2021) Log Message: ----------- Fix SQL quoting for PDO in search Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-16 08:06:55 UTC (rev 10521) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-16 09:56:12 UTC (rev 10522) @@ -1422,7 +1422,36 @@ class WikiDB_backend_PDO_search extends WikiDB_backend_search_sql { - // no surrounding quotes because we know it's a string + function _pagename_match_clause($node) + { + $word = $node->sql(); + if ($word == '%') { // ALL shortcut + return "1=1"; + } else { + $dbh = &$this->_dbh; + $word = $dbh->quote($word); + return ($this->_case_exact + ? "pagename LIKE $word" + : "LOWER(pagename) LIKE $word"); + } + } + + function _fulltext_match_clause($node) + { + // force word-style %word% for fulltext search + $dbh = &$this->_dbh; + $word = strtolower($node->word); + $word = $dbh->quote('%' . $word . '%'); + // eliminate stoplist words + if ($this->isStoplisted($node)) { + return "1=1"; // and (pagename or 1) => and 1 + } else { + return $this->_pagename_match_clause($node) + // probably convert this MATCH AGAINST or SUBSTR/POSITION without wildcards + . ($this->_case_exact ? " OR content LIKE $word" + : " OR LOWER(content) LIKE $word"); + } + } } // Following function taken from Pear::DB (prev. from adodb-pear.inc.php). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-17 16:43:45
|
Revision: 10525 http://sourceforge.net/p/phpwiki/code/10525 Author: vargenau Date: 2021-08-17 16:43:43 +0000 (Tue, 17 Aug 2021) Log Message: ----------- fetchAll cannot have mode PDO::FETCH_NUM Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-16 16:32:48 UTC (rev 10524) +++ trunk/lib/WikiDB/backend/PDO.php 2021-08-17 16:43:43 UTC (rev 10525) @@ -235,7 +235,7 @@ . " FROM $nonempty_tbl, $page_tbl" . " WHERE $nonempty_tbl.id=$page_tbl.id" . " LIMIT 1"); - return $sth->fetchAll(PDO::FETCH_NUM); + return $sth->fetchAll(); // which mode?? } /* 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:12:08
|
Revision: 10527 http://sourceforge.net/p/phpwiki/code/10527 Author: vargenau Date: 2021-09-01 16:12:07 +0000 (Wed, 01 Sep 2021) Log Message: ----------- PDO.php: better check $id Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-08-17 16:44:58 UTC (rev 10526) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-01 16:12:07 UTC (rev 10527) @@ -384,7 +384,7 @@ if (!$create_if_missing) { return $id; } - if (!$id) { + if (empty($id)) { //mysql, mysqli or mysqlt if (substr($dbh->databaseType, 0, 5) == 'mysql') { // have auto-incrementing, atomic version This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-03 07:49:08
|
Revision: 10531 http://sourceforge.net/p/phpwiki/code/10531 Author: vargenau Date: 2021-09-03 07:49:05 +0000 (Fri, 03 Sep 2021) Log Message: ----------- Make RecentChanges work with PDO Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-09-03 07:12:24 UTC (rev 10530) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-03 07:49:05 UTC (rev 10531) @@ -1402,7 +1402,7 @@ if (!is_object($result)) { return false; } - $this->_backend = &$backend; + $backend = &$this->_backend; $rec = $result->fetch(PDO::FETCH_ASSOC); if (isset($rec['pagedata'])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-03 10:12:31
|
Revision: 10533 http://sourceforge.net/p/phpwiki/code/10533 Author: vargenau Date: 2021-09-03 10:12:29 +0000 (Fri, 03 Sep 2021) Log Message: ----------- PDO: better test $this->_result Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-09-03 08:40:08 UTC (rev 10532) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-03 10:12:29 UTC (rev 10533) @@ -1391,7 +1391,7 @@ function free() { - if ($this->_result) { + if (isset($this->_result)) { unset($this->_result); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-03 11:30:27
|
Revision: 10535 http://sourceforge.net/p/phpwiki/code/10535 Author: vargenau Date: 2021-09-03 11:30:25 +0000 (Fri, 03 Sep 2021) Log Message: ----------- PDO: better check _unserialize Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-09-03 10:18:08 UTC (rev 10534) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-03 11:30:25 UTC (rev 10535) @@ -1273,7 +1273,13 @@ */ function _unserialize($data) { - return empty($data) ? array() : unserialize($data); + if ($data === "") { + return array(); + } else if (is_string($data)) { + return unserialize($data); + } else { + return array(); + } } /* some variables and functions for DB backend abstraction (action=upgrade) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-03 16:30:00
|
Revision: 10537 http://sourceforge.net/p/phpwiki/code/10537 Author: vargenau Date: 2021-09-03 16:29:57 +0000 (Fri, 03 Sep 2021) Log Message: ----------- PDO: let us unlock the same as we locked Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-09-03 13:24:39 UTC (rev 10536) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-03 16:29:57 UTC (rev 10537) @@ -1137,7 +1137,7 @@ $sth->bindParam(2, $id, PDO::PARAM_INT); $sth->execute(); } - $this->unlock(array('page')); + $this->unlock(array('page', 'version', 'recent', 'nonempty', 'link')); return $id; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-06 17:22:03
|
Revision: 10546 http://sourceforge.net/p/phpwiki/code/10546 Author: vargenau Date: 2021-09-06 17:22:01 +0000 (Mon, 06 Sep 2021) Log Message: ----------- Add braces Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-09-06 17:19:47 UTC (rev 10545) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-06 17:22:01 UTC (rev 10546) @@ -1307,6 +1307,9 @@ /* * LIMIT with OFFSET is not SQL specified. + * + * This function must be overloaded in specific backends. + * * mysql: LIMIT $offset, $count * pgsql,sqlite: LIMIT $count OFFSET $offset * InterBase,FireBird: ROWS $offset TO $last @@ -1329,10 +1332,12 @@ if ($offset) { $limit = " LIMIT $count"; trigger_error("unsupported OFFSET in SQL ignored", E_USER_WARNING); - } else + } else { $limit = " LIMIT $count"; - } else + } + } else { $limit = ''; + } return $limit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-29 15:07:59
|
Revision: 10600 http://sourceforge.net/p/phpwiki/code/10600 Author: vargenau Date: 2021-09-29 15:07:58 +0000 (Wed, 29 Sep 2021) Log Message: ----------- lib/WikiDB/backend/PDO.php: fix SQL syntax Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-09-29 09:43:26 UTC (rev 10599) +++ trunk/lib/WikiDB/backend/PDO.php 2021-09-29 15:07:58 UTC (rev 10600) @@ -470,7 +470,7 @@ . ",$page_tbl.pagedata AS pagedata," . $this->version_tbl_fields; } else { - $fields = $this->page_tbl_fields . ", '' AS pagedata" + $fields = $this->page_tbl_fields . ", $page_tbl.pagedata AS pagedata" . ", $version_tbl.version AS version, $version_tbl.mtime AS mtime, " . "$version_tbl.minor_edit AS minor_edit, $iscontent AS have_content, " . "$version_tbl.versiondata as versiondata"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2022-01-27 14:41:04
|
Revision: 10950 http://sourceforge.net/p/phpwiki/code/10950 Author: vargenau Date: 2022-01-27 14:41:03 +0000 (Thu, 27 Jan 2022) Log Message: ----------- Add size for PDO::PARAM_STR Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2022-01-27 13:58:39 UTC (rev 10949) +++ trunk/lib/WikiDB/backend/PDO.php 2022-01-27 14:41:03 UTC (rev 10950) @@ -1348,7 +1348,7 @@ $sth->bindParam(11, $entry->size, PDO::PARAM_INT); $sth->bindParam(12, $entry->referer, PDO::PARAM_STR, 255); $sth->bindParam(13, $entry->user_agent, PDO::PARAM_STR, 255); - $sth->bindParam(14, $entry->duration, PDO::PARAM_STR); + $sth->bindParam(14, $entry->duration, PDO::PARAM_STR, 20); $sth->execute(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2022-01-27 15:05:44
|
Revision: 10953 http://sourceforge.net/p/phpwiki/code/10953 Author: vargenau Date: 2022-01-27 15:05:43 +0000 (Thu, 27 Jan 2022) Log Message: ----------- Add class properties Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2022-01-27 15:01:46 UTC (rev 10952) +++ trunk/lib/WikiDB/backend/PDO.php 2022-01-27 15:05:43 UTC (rev 10953) @@ -31,6 +31,14 @@ class WikiDB_backend_PDO extends WikiDB_backend { + public $_dbparams; + public $_dsn; + public $_table_names; + public $page_tbl_field_list; + public $version_tbl_field_list; + public $_lock_count; + public $_current_lock; + function __construct($dbparams) { $this->_dbparams = $dbparams; @@ -941,7 +949,7 @@ * This is only for already resolved wildcards: * " WHERE $page_tbl.pagename NOT IN ".$this->_sql_set(array('page1','page2')); */ - function _sql_set(&$pagenames) + function _sql_set($pagenames) { $s = '('; foreach ($pagenames as $p) { @@ -1313,11 +1321,9 @@ { if ($limit) { list($offset, $count) = $this->limit($limit); + $limit = " LIMIT $count"; if ($offset) { - $limit = " LIMIT $count"; trigger_error("unsupported OFFSET in SQL ignored", E_USER_WARNING); - } else { - $limit = " LIMIT $count"; } } else { $limit = ''; @@ -1395,6 +1401,8 @@ class WikiDB_backend_PDO_iter extends WikiDB_backend_PDO_generic_iter { + public $_backend; + function next() { $result = &$this->_result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2022-02-01 09:10:07
|
Revision: 10967 http://sourceforge.net/p/phpwiki/code/10967 Author: vargenau Date: 2022-02-01 09:10:03 +0000 (Tue, 01 Feb 2022) Log Message: ----------- Use MAX_PAGENAME_LENGTH in bindParam Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2022-02-01 08:54:54 UTC (rev 10966) +++ trunk/lib/WikiDB/backend/PDO.php 2022-02-01 09:10:03 UTC (rev 10967) @@ -225,7 +225,7 @@ . " FROM $nonempty_tbl, $page_tbl" . " WHERE $nonempty_tbl.id=$page_tbl.id" . " AND pagename=?"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); if ($sth->execute()) return $sth->fetchColumn(); else @@ -263,7 +263,7 @@ $sth = $dbh->prepare("UPDATE $page_tbl SET hits=hits+1" . " WHERE pagename=?" . " LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); } @@ -276,7 +276,7 @@ $page_tbl = $this->_table_names['page_tbl']; $sth = $dbh->prepare("SELECT id,pagename,hits,pagedata FROM $page_tbl" . " WHERE pagename=? LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); $row = $sth->fetch(PDO::FETCH_NUM); return $row ? $this->_extract_page_data($row[3], $row[2]) : false; @@ -303,7 +303,7 @@ // hit count, who cares? $sth = $dbh->prepare("UPDATE $page_tbl SET hits=? WHERE pagename=? LIMIT 1"); $sth->bindParam(1, $newdata['hits'], PDO::PARAM_INT); - $sth->bindParam(2, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(2, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); return true; } @@ -332,7 +332,7 @@ $sth->bindParam(1, $hits, PDO::PARAM_INT); $serialized_data = $this->_serialize($data); $sth->bindParam(2, $serialized_data, PDO::PARAM_LOB); - $sth->bindParam(3, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(3, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); if ($sth->execute()) { $this->commit(); return true; @@ -347,7 +347,7 @@ $dbh = &$this->_dbh; $page_tbl = $this->_table_names['page_tbl']; $sth = $dbh->prepare("SELECT cached_html FROM $page_tbl WHERE pagename=? LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); return $sth->fetchColumn(0); } @@ -362,7 +362,7 @@ . " WHERE pagename=?" . " LIMIT 1"); $sth->bindParam(1, $data, PDO::PARAM_STR); - $sth->bindParam(2, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(2, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); } @@ -383,7 +383,7 @@ $dbh = &$this->_dbh; $page_tbl = $this->_table_names['page_tbl']; $sth = $dbh->prepare("SELECT id FROM $page_tbl WHERE pagename=? LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); $id = $sth->fetchColumn(); if (!$create_if_missing) { @@ -396,7 +396,7 @@ $sth = $dbh->prepare("INSERT INTO $page_tbl" . " (id,pagename)" . " VALUES (NULL,?)"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); $id = $dbh->lastInsertId(); } else { @@ -409,7 +409,7 @@ . " VALUES (?,?,0)"); $id++; $sth->bindParam(1, $id, PDO::PARAM_INT); - $sth->bindParam(2, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(2, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); if ($sth->execute()) $this->commit(); else @@ -429,7 +429,7 @@ . " WHERE $page_tbl.id=$recent_tbl.id" . " AND pagename=?" . " LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); return $sth->fetchColumn(); } @@ -445,7 +445,7 @@ . " AND version < ?" . " ORDER BY version DESC" . " LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->bindParam(2, $version, PDO::PARAM_INT); $sth->execute(); return $sth->fetchColumn(); @@ -486,7 +486,7 @@ . " AND pagename=?" . " AND version=?" . " LIMIT 1"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->bindParam(2, $version, PDO::PARAM_INT); $sth->execute(); $row = $sth->fetch(PDO::FETCH_NUM); @@ -813,7 +813,7 @@ . $exclude . $orderby . $limit); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); return new WikiDB_backend_PDO_iter($this, $sth, $this->page_tbl_field_list); } @@ -835,8 +835,8 @@ . " WHERE linkfrom=linker.id AND linkto=linkee.id" . " AND $have.pagename=?" . " AND $want.pagename=?"); - $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); - $sth->bindParam(2, $link, PDO::PARAM_STR, 100); + $sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); + $sth->bindParam(2, $link, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->execute(); return $sth->fetchColumn(); } @@ -1126,7 +1126,7 @@ $this->lock(array('page', 'version', 'recent', 'nonempty', 'link')); $id = $this->_get_pageid($pagename); $sth = $dbh->prepare("UPDATE $page_tbl SET pagename=? WHERE id=?"); - $sth->bindParam(1, $to, PDO::PARAM_STR, 100); + $sth->bindParam(1, $to, PDO::PARAM_STR, MAX_PAGENAME_LENGTH); $sth->bindParam(2, $id, PDO::PARAM_INT); $sth->execute(); $this->unlock(array('page', 'version', 'recent', 'nonempty', 'link')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2022-02-02 11:44:26
|
Revision: 10970 http://sourceforge.net/p/phpwiki/code/10970 Author: vargenau Date: 2022-02-02 11:44:23 +0000 (Wed, 02 Feb 2022) Log Message: ----------- Use private when possible Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2022-02-02 11:41:35 UTC (rev 10969) +++ trunk/lib/WikiDB/backend/PDO.php 2022-02-02 11:44:23 UTC (rev 10970) @@ -34,10 +34,10 @@ public $_dbparams; public $_dsn; public $_table_names; - public $page_tbl_field_list; - public $version_tbl_field_list; - public $_lock_count; - public $_current_lock; + private $page_tbl_field_list; + private $version_tbl_field_list; + private $_lock_count; + private $_current_lock; function __construct($dbparams) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |