Permalink
Browse files

handling term inserted later when looking for removal - reportd by Ja…

  • Loading branch information...
FlominatorTM committed Oct 2, 2016
1 parent ca48d45 commit beae572f57e4d093b0c688377bd2e467f3a1f0bd
Showing with 24 additions and 6 deletions.
  1. +22 −6 wikiblame.php
  2. +1 −0 wikiblame_inc/de.php
  3. +1 −0 wikiblame_inc/en.php
@@ -860,7 +860,7 @@ function needle_regex($needle)
function binary_search($middle, $from)
{
global $needle, $versions, $server, $messages, $binary_search_inverse, $binary_search_retries, $needle_ever_found, $limit;
global $needle, $versions, $server, $messages, $binary_search_inverse, $binary_search_retries, $binary_search_restarted, $needle_ever_found, $limit;
//echo "binary_search(".$middle.",".$from.")";
if($middle<1)
@@ -873,16 +873,32 @@ function binary_search($middle, $from)
if($middle==$from)
{
log_search("no_differences");
//looking for insertion => maybe it was always there
//=> checking first revision => highest array index
$first_index = count($versions)-1;
$rev_text = get_revision(idfromurl($versions[$first_index]));
$found_in_first_revision = stristr($rev_text, $needle);
if($binary_search_inverse == "true")
{
echo ('<br>'.$messages['no_differences']);
if($found_in_first_revision || $binary_search_restarted)
{
//already missing then, link to earlier search
echo ('<br>'.$messages['no_differences']);
}
else
{
$binary_search_restarted = true;
//probably went into wrong direction initially
//restarting from beginning with other direction as before
echo $messages['inverse_restart'].'<br>';
binary_search(floor(count($versions)/4), floor(count($versions)/2));
}
}
else
{
//looking for insertion => maybe it was always there => checking first revision => highest array index
$first_index = count($versions)-1;
$rev_text = get_revision(idfromurl($versions[$first_index]));
if(stristr($rev_text, $needle))
if($found_in_first_revision)
{
$revLink = str_replace("/w/", "http://".$server."/w/", $versions[$first_index])."</a>";
$msg = str_replace('__NEEDLE__', "<b>$needle</b>", $messages['first_version_present']);
@@ -63,6 +63,7 @@
$messages['search_in_progress_text'] = 'Die Versionsgeschichte des Artikels _ARTICLELINK_ wird nach <b>_NEEDLE_</b> als einfachem Text durchsucht';
$messages['search_in_progress_wikitags'] = 'Die Versionsgeschichte von _ARTICLELINK_ wird nach <b>_NEEDLE_</b> als Wikitext durchsucht';
$messages['no_differences'] = 'Keine Unterschiede in den durchsuchten Versionen gefunden';
$messages['inverse_restart'] = 'Keine Einfügung oder Löschung gefunden, wurde der Suchbegriff vielleicht später eingefügt?';
$messages['first_version'] = 'Die Änderung muss in der ersten oder letzten Version passiert sein?';
$messages['first_version_present'] = '__NEEDLE__ war bereits in der ältesten durchsuchten Version vom __REVISIONLINK__ enthalten.';
$messages['earlier_versions_available'] = 'Es existieren wahrscheinlich ältere Versionen.';
@@ -71,6 +71,7 @@
$messages['search_in_progress_wikitags'] = 'The version history of _ARTICLELINK_ is being searched for <b>_NEEDLE_</b> as wiki text';
$messages['no_differences'] = 'No differences found in searched revisions.';
$messages['inverse_restart'] = 'No insertion or removal found, was the search term inserted later?';
$messages['first_version'] = 'Change must have happened in first or latest revision?';
$messages['first_version_present'] = '__NEEDLE__ was already present in the oldest revision searched dating from __REVISIONLINK__.';
$messages['earlier_versions_available'] = 'There are probably older revisions.';

0 comments on commit beae572

Please sign in to comment.