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. |