SF.net SVN: phpwiki:[10947] trunk/lib
vargenau--- via phpwiki-checkins <[email protected]> Thu, 27 Jan 2022 08:04:15 +0000
| Newsgroups | gmane.comp.web.wiki.phpwiki.checkins |
|---|---|
| Message-ID | <[email protected]> |
Revision: 10947
http://sourceforge.net/p/phpwiki/code/10947
Author: vargenau
Date: 2022-01-27 08:04:14 +0000 (Thu, 27 Jan 2022)
Log Message:
-----------
Cleanup
Modified Paths:
--------------
trunk/lib/WikiDB/PDO.php
trunk/lib/WikiDB/SQL.php
trunk/lib/WikiDB/backend/PDO.php
trunk/lib/WikiDB/backend/PearDB.php
trunk/lib/WikiDB.php
Modified: trunk/lib/WikiDB/PDO.php
===================================================================
--- trunk/lib/WikiDB/PDO.php 2022-01-26 21:03:44 UTC (rev 10946)
+++ trunk/lib/WikiDB/PDO.php 2022-01-27 08:04:14 UTC (rev 10947)
@@ -68,7 +68,6 @@
*/
public function isWikiPage($pagename)
{
- $pagename = (string)$pagename;
if ($pagename === '') {
return false;
}
Modified: trunk/lib/WikiDB/SQL.php
===================================================================
--- trunk/lib/WikiDB/SQL.php 2022-01-26 21:03:44 UTC (rev 10946)
+++ trunk/lib/WikiDB/SQL.php 2022-01-27 08:04:14 UTC (rev 10947)
@@ -70,7 +70,6 @@
*/
public function isWikiPage($pagename)
{
- $pagename = (string)$pagename;
if ($pagename === '') {
return false;
}
Modified: trunk/lib/WikiDB/backend/PDO.php
===================================================================
--- trunk/lib/WikiDB/backend/PDO.php 2022-01-26 21:03:44 UTC (rev 10946)
+++ trunk/lib/WikiDB/backend/PDO.php 2022-01-27 08:04:14 UTC (rev 10947)
@@ -1116,24 +1116,11 @@
extract($this->_table_names);
$this->lock(array('page', 'version', 'recent', 'nonempty', 'link'));
- 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.
- $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");
- // 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);
- $sth->bindParam(2, $id, PDO::PARAM_INT);
- $sth->execute();
- }
+ $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(2, $id, PDO::PARAM_INT);
+ $sth->execute();
$this->unlock(array('page', 'version', 'recent', 'nonempty', 'link'));
return $id;
}
Modified: trunk/lib/WikiDB/backend/PearDB.php
===================================================================
--- trunk/lib/WikiDB/backend/PearDB.php 2022-01-26 21:03:44 UTC (rev 10946)
+++ trunk/lib/WikiDB/backend/PearDB.php 2022-01-27 08:04:14 UTC (rev 10947)
@@ -919,22 +919,9 @@
extract($this->_table_names);
$this->lock();
- 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.
- $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");
- // 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");
- }
- $dbh->query(sprintf("UPDATE $page_tbl SET pagename='%s' WHERE id=$id",
- $dbh->escapeSimple($to)));
- }
+ $id = $this->_get_pageid($pagename);
+ $dbh->query(sprintf("UPDATE $page_tbl SET pagename='%s' WHERE id=$id",
+ $dbh->escapeSimple($to)));
$this->unlock();
return $id;
}
Modified: trunk/lib/WikiDB.php
===================================================================
--- trunk/lib/WikiDB.php 2022-01-26 21:03:44 UTC (rev 10946)
+++ trunk/lib/WikiDB.php 2022-01-27 08:04:14 UTC (rev 10947)
@@ -95,7 +95,7 @@
$this->touch();
// devel checking.
- if ((int)DEBUG & _DEBUG_SQL) {
+ if (DEBUG & _DEBUG_SQL) {
$this->_backend->check();
}
// might be changed when opening the database fails
@@ -232,7 +232,7 @@
public function deletePage($pagename)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -271,7 +271,7 @@
public function purgePage($pagename)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -530,7 +530,7 @@
public function renamePage($from, $to, $updateWikiLinks = false)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -652,7 +652,7 @@
public function set($key, $newval)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -751,20 +751,6 @@
{
$this->_wikidb = &$wikidb;
$this->_pagename = $pagename;
- if ((int)DEBUG) {
- if (!(is_string($pagename) and $pagename != '')) {
- if (function_exists("xdebug_get_function_stack")) {
- echo "xdebug_get_function_stack(): ";
- var_dump(xdebug_get_function_stack());
- } else {
- printSimpleTrace(debug_backtrace());
- }
- trigger_error("empty pagename", E_USER_WARNING);
- return;
- }
- } else {
- assert(is_string($pagename) and $pagename != '');
- }
}
/**
@@ -807,7 +793,7 @@
public function deleteRevision($version)
{
if ($this->_wikidb->readonly) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -863,7 +849,7 @@
public function mergeRevision($version)
{
if ($this->_wikidb->readonly) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -933,7 +919,7 @@
public function createRevision($version, &$content, $metadata, $links)
{
if ($this->_wikidb->readonly) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -1025,7 +1011,7 @@
global $request;
if ($this->_wikidb->readonly) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -1053,7 +1039,7 @@
//
// We're doing this here rather than in createRevision because
// postgresql can't optimize while locked.
- if (((int)DEBUG & _DEBUG_SQL)
+ if ((DEBUG & _DEBUG_SQL)
or (DATABASE_OPTIMISE_FREQUENCY > 0 and
(time() % DATABASE_OPTIMISE_FREQUENCY == 0))
) {
@@ -1368,7 +1354,7 @@
and method_exists($backend, 'set_cached_html')
) {
if ($this->_wikidb->readonly) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -1388,7 +1374,7 @@
}
if (isset($this->_wikidb->readonly) and ($this->_wikidb->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -1413,7 +1399,7 @@
public function increaseHitCount()
{
if ($this->_wikidb->readonly) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database");
}
return;
@@ -2003,19 +1989,19 @@
$pagename = $next['pagename'];
$version = $next['version'];
$versiondata = $next['versiondata'];
- if ((int)DEBUG) {
+ if (DEBUG) {
if (!(is_string($pagename) and $pagename != '')) {
trigger_error("empty pagename", E_USER_WARNING);
return false;
}
} else assert(is_string($pagename) and $pagename != '');
- if ((int)DEBUG) {
+ if (DEBUG) {
if (!is_array($versiondata)) {
trigger_error("empty versiondata", E_USER_WARNING);
return false;
}
} else assert(is_array($versiondata));
- if ((int)DEBUG) {
+ if (DEBUG) {
if (!($version > 0)) {
trigger_error("invalid version", E_USER_WARNING);
return false;
@@ -2204,7 +2190,7 @@
{
assert(is_string($pagename) && $pagename != '');
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -2234,7 +2220,7 @@
public function delete_page($pagename)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -2247,7 +2233,7 @@
public function purge_page($pagename)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return false;
@@ -2299,7 +2285,7 @@
//unset($this->_versiondata_cache[$pagename][$version]);
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -2315,7 +2301,7 @@
public function update_versiondata($pagename, $version, $data)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
@@ -2332,7 +2318,7 @@
public function delete_versiondata($pagename, $version)
{
if (!empty($this->readonly)) {
- if ((int)DEBUG) {
+ if (DEBUG) {
trigger_error("readonly database", E_USER_WARNING);
}
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.