Cleanup of function compare() [name changed]

Name changed from strcompare() to compare().

Fix of ft_pagesorter() function in "fulltext.php".
ft_pagesorter() is used by _ft_pageLookup(), which is used by ft_pageLookup().

Functions that call ft_pageLookup() and now have the expected results:
Action\Search.php:69, execute(): run the search
Ajax.php:50, callQsearch(): Searches for matching pagenames
Ajax.php:352, callLinkwiz(): List matching namespaces and pages for the link wizard

Screens fixed:
- Search (list of matching pagenames)
- Quick search (when typing)
- Internal link suggestion when editing a page (when nothing was typed)

Fix of menuSort() function in "Ui/Admin.php".

Screens fixed:
- Administration

Fix of sort_search_fulltext() function in "search.php".
This function does not seem to be used anywhere.
This commit is contained in:
Moisés Braga Ribeiro 2020-05-15 06:40:04 -03:00
parent 741d531ee5
commit 15a1d63cf1
4 changed files with 7 additions and 7 deletions

View File

@ -159,7 +159,7 @@ class Admin extends Ui {
* @return int
*/
protected function menuSort($a, $b) {
$strcmp = strcompare($a['prompt'], $b['prompt']);
$strcmp = compare($a['prompt'], $b['prompt']);
if($strcmp != 0) return $strcmp;
if($a['sort'] === $b['sort']) return 0;
return ($a['sort'] < $b['sort']) ? -1 : 1;

View File

@ -370,7 +370,7 @@ function ft_pagesorter($a, $b){
}elseif($ac > $bc){
return 1;
}
return strcompare($a,$b);
return compare($a,$b);
}
/**

View File

@ -368,7 +368,7 @@ function sort_search_fulltext($a,$b){
}elseif($a['count'] < $b['count']){
return 1;
}else{
return strcompare($a['id'],$b['id']);
return compare($a['id'],$b['id']);
}
}

View File

@ -59,14 +59,14 @@ function _sort_filenames_without_collator($first, $second) {
* Replacement for strcmp() in search.php, line 371, where all string would be lowercase (function not used anywhere).
* Replacement for strcasecmp() in Ui/Admin.php, line 162.
*/
function strcompare($first, $second){
function compare($first, $second) {
global $collator;
_init_collator();
if(!isset($collator))
return strcasecmp($first, $second);
else
if (isset($collator))
return $collator->compare($first, $second);
else
return strcasecmp($first, $second);
}
/**