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