|
From: <ru...@us...> - 2009-06-04 08:22:00
|
Revision: 6854
http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6854&view=rev
Author: rurban
Date: 2009-06-04 08:21:59 +0000 (Thu, 04 Jun 2009)
Log Message:
-----------
Detect broken - double serialized vdata - pages.
Fix paging count.
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2009-06-04 08:12:59 UTC (rev 6853)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2009-06-04 08:21:59 UTC (rev 6854)
@@ -83,7 +83,7 @@
}
function check($args=false) {
- // cleanup v?Pagename UNKNOWN
+ // cleanup v?Pagename UNKNOWN0x0
$errs = array();
$pagedb = &$this->_pagedb;
for ($page = $pagedb->firstkey(); $page !== false; $page = $pagedb->nextkey()) {
@@ -98,9 +98,11 @@
$vdata = $this->_versiondb->get($version.":".$page);
if ($vdata === false)
continue; // linkrelations
+ // we also had for some internal version vdata is serialized strings (of array),
+ // need to unserialize it twice. We rather purge it.
if (!is_string($vdata)
or $vdata == 'UNKNOWN |
|
From: <ru...@us...> - 2009-09-16 08:03:38
|
Revision: 7121
http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7121&view=rev
Author: rurban
Date: 2009-09-16 08:03:30 +0000 (Wed, 16 Sep 2009)
Log Message:
-----------
* rename_page() fix typo $GLOBAS
* break long lines
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2009-09-15 17:05:52 UTC (rev 7120)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2009-09-16 08:03:30 UTC (rev 7121)
@@ -86,7 +86,10 @@
// cleanup v?Pagename UNKNOWN0x0
$errs = array();
$pagedb = &$this->_pagedb;
- for ($page = $pagedb->firstkey(); $page !== false; $page = $pagedb->nextkey()) {
+ for ($page = $pagedb->firstkey();
+ $page !== false;
+ $page = $pagedb->nextkey())
+ {
if (!$page) {
$errs[] = "empty page $page";
trigger_error("empty page $page deleted", E_USER_WARNING);
@@ -98,7 +101,7 @@
$vdata = $this->_versiondb->get($version.":".$page);
if ($vdata === false)
continue; // linkrelations
- // we also had for some internal version vdata is serialized strings (of array),
+ // we also had for some internal version vdata is serialized strings,
// need to unserialize it twice. We rather purge it.
if (!is_string($vdata)
or $vdata == 'UNKNOWN |
|
From: <ru...@us...> - 2009-09-16 08:20:22
|
Revision: 7122
http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7122&view=rev
Author: rurban
Date: 2009-09-16 08:20:16 +0000 (Wed, 16 Sep 2009)
Log Message:
-----------
* rename_page: delete at last
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2009-09-16 08:03:30 UTC (rev 7121)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2009-09-16 08:20:16 UTC (rev 7122)
@@ -228,7 +228,6 @@
return false;
$links = $this->_linkdb->get_links($pagename, false, false);
- $this->_pagedb->delete($pagename);
$data['pagename'] = $to;
$this->_pagedb->set($to,
(int)$version . ':'
@@ -245,6 +244,7 @@
$this->_linkdb->set_links($to, $links);
// better: update all back-/inlinks for all outlinks.
+ $this->_pagedb->delete($pagename);
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2020-03-29 15:08:18
|
Revision: 10161
http://sourceforge.net/p/phpwiki/code/10161
Author: vargenau
Date: 2020-03-29 15:08:17 +0000 (Sun, 29 Mar 2020)
Log Message:
-----------
dba _has_link needs to work for both forward and backlinks (only backlinks are actually sorted, and backlinks are a plain array). Performance isn't critical as it's only used from dba check -- patches by Christof Meerwald
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2020-03-29 15:05:53 UTC (rev 10160)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2020-03-29 15:08:17 UTC (rev 10161)
@@ -958,13 +958,11 @@
function _has_link($which, $page, $link)
{
$links = $this->_get_links($which, $page);
- // since links are always sorted, break if >
- // TODO: binary search
+ // NOTE: only backlinks are sorted, so need to do linear search
foreach ($links as $l) {
- if ($l['linkto'] == $link)
+ $linkto = is_array($l) ? $l['linkto'] : $l;
+ if ($linkto == $link)
return true;
- if ($l['linkto'] > $link)
- return false;
}
return false;
}
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:44:39
|
Revision: 10488
http://sourceforge.net/p/phpwiki/code/10488
Author: vargenau
Date: 2021-08-11 10:44:37 +0000 (Wed, 11 Aug 2021)
Log Message:
-----------
Use same parameter name as parent, PHP Doc
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2021-08-11 10:42:06 UTC (rev 10487)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2021-08-11 10:44:37 UTC (rev 10488)
@@ -214,7 +214,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)
{
@@ -525,7 +525,7 @@
* linkdb and check the pagematch there.
*
* @param object$pages A TextSearchQuery object for the pagename filter.
- * @param object $query A SearchQuery object (Text or Numeric) for the linkvalues,
+ * @param object $linkvalue A SearchQuery object (Text or Numeric) for the linkvalues,
* linkto, linkfrom (=backlink), relation or attribute values.
* @param string $linktype One of the 4 linktypes "linkto",
* "linkfrom" (=backlink), "relation" or "attribute".
@@ -535,7 +535,7 @@
* @return object A WikiDB_backend_iterator.
* @see WikiDB::linkSearch
*/
- function link_search($pages, $query, $linktype,
+ function link_search($pages, $linkvalue, $linktype,
$relation = false, $options = array())
{
/**
@@ -575,14 +575,14 @@
Just take the defined placeholders from the query(ies)
if there are more attributes than query variables.
*/
- if ($query->getType() != 'text'
+ if ($linkvalue->getType() != 'text'
and !$relation
- and ((count($vars = $query->getVars()) > 1)
+ and ((count($vars = $linkvalue->getVars()) > 1)
or (count($attribs) > count($vars)))
) {
// names must strictly match. no * allowed
- if (!$query->can_match($attribs)) continue;
- if (!($result = $query->match($attribs))) continue;
+ if (!$linkvalue->can_match($attribs)) continue;
+ if (!($result = $linkvalue->match($attribs))) continue;
foreach ($result as $r) {
$r['pagename'] = $pagename;
$links[] = $r;
@@ -591,7 +591,7 @@
// textsearch or simple value. no strict bind by name needed
foreach ($attribs as $attribute => $value) {
if ($relation and !$relation->match($attribute)) continue;
- if (!$query->match($value)) continue;
+ if (!$linkvalue->match($value)) continue;
$links[] = array('pagename' => $pagename,
'linkname' => $attribute,
'linkvalue' => $value);
@@ -606,7 +606,7 @@
foreach ($_links as $link) { // linkto => page, linkrelation => page
if (!isset($link['relation']) or !$link['relation']) continue;
if ($relation and !$relation->match($link['relation'])) continue;
- if (!$query->match($link['linkto'])) continue;
+ if (!$linkvalue->match($link['linkto'])) continue;
$links[] = array('pagename' => $pagename,
'linkname' => $link['relation'],
'linkvalue' => $link['linkto']);
@@ -616,7 +616,7 @@
foreach ($_links as $link) { // linkto => page
if (is_array($link))
$link = $link['linkto'];
- if (!$query->match($link)) continue;
+ if (!$linkvalue->match($link)) continue;
$links[] = array('pagename' => $pagename,
'linkname' => '',
'linkvalue' => $link);
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:01:49
|
Revision: 10952
http://sourceforge.net/p/phpwiki/code/10952
Author: vargenau
Date: 2022-01-27 15:01:46 +0000 (Thu, 27 Jan 2022)
Log Message:
-----------
Add class properties
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2022-01-27 14:41:25 UTC (rev 10951)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2022-01-27 15:01:46 UTC (rev 10952)
@@ -65,6 +65,11 @@
class WikiDB_backend_dbaBase
extends WikiDB_backend
{
+ public $_db;
+ public $_linkdb;
+ public $_pagedb;
+ public $_dbdb;
+
function __construct(&$dba)
{
$this->_db = &$dba;
@@ -380,7 +385,6 @@
$count = 0;
for ($page = $pagedb->firstkey(); $page !== false; $page = $pagedb->nextkey()) {
if (!$page) {
- assert(!empty($page));
continue;
}
if ($exclude and in_array($page, $exclude)) continue;
@@ -408,7 +412,6 @@
}
for ($page = $pagedb->firstkey(); $page !== false; $page = $pagedb->nextkey()) {
if (!$page) {
- assert(!empty($page));
continue;
}
if ($exclude and in_array($page, $exclude)) continue;
@@ -746,6 +749,8 @@
extends WikiDB_backend_iterator
{
// fixed for linkrelations
+ public $_backend;
+
function __construct($backend, $pages, $options = array())
{
$this->_backend = $backend;
@@ -803,6 +808,9 @@
class WikiDB_backend_dbaBase_linktable
{
+ public $found_relations;
+ public $_db;
+
function __construct(&$dba)
{
$this->_db = &$dba;
@@ -826,7 +834,6 @@
$linksonly[] = array('pagename' => $link['linkto']);
}
}
- return $linksonly;
} else {
$links = $this->_get_links($reversed ? 'i' : 'o', $page);
$linksonly = array();
@@ -836,8 +843,8 @@
} else
$linksonly[] = $link;
}
- return $linksonly;
}
+ return $linksonly;
}
// fixed: relations ready
@@ -999,7 +1006,7 @@
return $data ? unserialize($data) : array();
}
- function _set_links($which, $page, &$links)
+ function _set_links($which, $page, $links)
{
$key = $which . $page;
if ($links)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ru...@us...> - 2010-06-10 06:53:17
|
Revision: 7516
http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7516&view=rev
Author: rurban
Date: 2010-06-10 06:53:11 +0000 (Thu, 10 Jun 2010)
Log Message:
-----------
remove wrong remove warning with dba. _versiondb->get always returns a serialized string
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2010-06-10 06:35:40 UTC (rev 7515)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2010-06-10 06:53:11 UTC (rev 7516)
@@ -185,12 +185,11 @@
function delete_page($pagename) {
$version = $this->get_latest_version($pagename);
$data = $this->_versiondb->get((int)$version . ":$pagename");
- // fix broken pages
+ // returns serialized string
if (!is_array($data) or empty($data)) {
if (is_string($data) and ($vdata = @unserialize($data))) {
- trigger_error("Fixed broken page version $pagename. Run 'Check WikiDB'",
- E_USER_NOTICE);
$data = $vdata;
+ unset($vdata);
} else // already empty page
$data = array();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2015-03-04 13:51:32
|
Revision: 9595
http://sourceforge.net/p/phpwiki/code/9595
Author: vargenau
Date: 2015-03-04 13:51:29 +0000 (Wed, 04 Mar 2015)
Log Message:
-----------
PHP Doc
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2015-03-04 13:28:25 UTC (rev 9594)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2015-03-04 13:51:29 UTC (rev 9595)
@@ -179,7 +179,16 @@
return false;
}
- //check $want_content
+ /**
+ * Get version data.
+ *
+ * @param string $pagename Name of the page
+ * @param int $version Which version to get
+ * @param bool $want_content Do we need content?
+ *
+ * @return array hash The version data, or false if specified version does not
+ * exist.
+ */
function get_versiondata($pagename, $version, $want_content = false)
{
$data = $this->_versiondb->get((int)$version . ":$pagename");
@@ -196,7 +205,7 @@
}
}
- /**
+ /*
* Can be undone and is seen in RecentChanges.
* See backend.php
*/
@@ -225,7 +234,7 @@
$this->set_links($pagename, array());
}
- /**
+ /*
* Completely delete all page revisions from the database.
*/
function purge_page($pagename)
@@ -277,7 +286,7 @@
return true;
}
- /**
+ /*
* Delete an old revision of a page.
*/
function delete_versiondata($pagename, $version)
@@ -302,7 +311,7 @@
}
}
- /**
+ /*
* Create a new revision of a page.
*/
function set_versiondata($pagename, $version, $data)
@@ -416,7 +425,7 @@
));
}
- /**
+ /*
* @return array of all linkrelations
* Faster than the dumb WikiDB method.
*/
@@ -460,14 +469,14 @@
* the link key, we iterate here directly over the
* linkdb and check the pagematch there.
*
- * @param $pages object A TextSearchQuery object for the pagename filter.
- * @param $query object A SearchQuery object (Text or Numeric) for the linkvalues,
+ * @param object$pages A TextSearchQuery object for the pagename filter.
+ * @param object $query A SearchQuery object (Text or Numeric) for the linkvalues,
* linkto, linkfrom (=backlink), relation or attribute values.
- * @param $linktype string One of the 4 linktypes "linkto",
+ * @param string $linktype One of the 4 linktypes "linkto",
* "linkfrom" (=backlink), "relation" or "attribute".
* Maybe also "relation+attribute" for the advanced search.
- * @param $relation object A TextSearchQuery for the linkname or false.
- * @param $options array Currently ignored. hash of sortby, limit, exclude.
+ * @param bool|object $relation A TextSearchQuery for the linkname or false.
+ * @param array $options Currently ignored. hash of sortby, limit, exclude.
* @return object A WikiDB_backend_iterator.
* @see WikiDB::linkSearch
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2015-04-23 18:49:35
|
Revision: 9694
http://sourceforge.net/p/phpwiki/code/9694
Author: vargenau
Date: 2015-04-23 18:49:33 +0000 (Thu, 23 Apr 2015)
Log Message:
-----------
Use chr(0) instead of null byte
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2015-04-23 18:39:01 UTC (rev 9693)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2015-04-23 18:49:33 UTC (rev 9694)
@@ -118,7 +118,7 @@
// we also had for some internal version vdata is serialized strings,
// need to unserialize it twice. We rather purge it.
if (!is_string($vdata)
- or $vdata == 'UNKNOWN+ or $vdata == 'UNKNOWN'.chr(0)
or !is_array(unserialize($vdata))
) {
$errs[] = "empty revision $version for $page";
@@ -192,7 +192,7 @@
function get_versiondata($pagename, $version, $want_content = false)
{
$data = $this->_versiondb->get((int)$version . ":$pagename");
- if (empty($data) or $data == 'UNKNOWN+ if (empty($data) or $data == 'UNKNOWN'.chr(0)) return false;
else {
$vdata = unserialize($data);
if (DEBUG and empty($vdata)) { // requires ->check
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2016-10-10 19:43:58
|
Revision: 9959
http://sourceforge.net/p/phpwiki/code/9959
Author: vargenau
Date: 2016-10-10 19:43:56 +0000 (Mon, 10 Oct 2016)
Log Message:
-----------
Use __construct
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2016-10-10 19:39:29 UTC (rev 9958)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2016-10-10 19:43:56 UTC (rev 9959)
@@ -777,7 +777,7 @@
class WikiDB_backend_dbaBase_linktable
{
- function WikiDB_backend_dbaBase_linktable(&$dba)
+ function __construct(&$dba)
{
$this->_db = &$dba;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2021-09-17 11:09:29
|
Revision: 10562
http://sourceforge.net/p/phpwiki/code/10562
Author: vargenau
Date: 2021-09-17 11:09:28 +0000 (Fri, 17 Sep 2021)
Log Message:
-----------
Better test with array_key_exists to avoid warning
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2021-09-17 11:07:11 UTC (rev 10561)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2021-09-17 11:09:28 UTC (rev 10562)
@@ -497,7 +497,7 @@
$links = $linkdb->_get_links('o', substr($link, 1));
foreach ($links as $link) { // linkto => page, linkrelation => page
if (is_array($link)
- and $link['relation']
+ and array_key_exists('relation', $link)
and !in_array($link['relation'], $relations)
) {
$is_attribute = empty($link['linkto']); // a relation has both
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2021-09-17 13:25:47
|
Revision: 10564
http://sourceforge.net/p/phpwiki/code/10564
Author: vargenau
Date: 2021-09-17 13:25:45 +0000 (Fri, 17 Sep 2021)
Log Message:
-----------
Better test with array_key_exists to avoid warning
Modified Paths:
--------------
trunk/lib/WikiDB/backend/dbaBase.php
Modified: trunk/lib/WikiDB/backend/dbaBase.php
===================================================================
--- trunk/lib/WikiDB/backend/dbaBase.php 2021-09-17 11:14:06 UTC (rev 10563)
+++ trunk/lib/WikiDB/backend/dbaBase.php 2021-09-17 13:25:45 UTC (rev 10564)
@@ -819,12 +819,12 @@
$links = $this->_get_links($reversed ? 'i' : 'o', $page);
$linksonly = array();
foreach ($links as $link) { // linkto => page, linkrelation => page
- if (is_array($link) and isset($link['relation'])) {
+ if (is_array($link) and array_key_exists('relation', $link)) {
if ($link['relation'])
$this->found_relations++;
$linksonly[] = array('pagename' => $link['linkto'],
'linkrelation' => $link['relation']);
- } else { // empty relations are stripped
+ } elseif (array_key_exists('linkto', $link)) { // empty relations are stripped
$linksonly[] = array('pagename' => $link['linkto']);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|