Hello,

I have got issue with ListFiles page in mediawiki 1.35.1
Filtering worked not very good, was case-sensitive and not always got text in middle of file name. I looked in DB and saw that img_name column is varbinary, but pagers/ImageListPager.php tries to do case-insensitive select with LOWERing both sides of strings. But LOWER does not work for varbinary
So I think that following change will be reasonable:

--- ImageListPager.php.orig     2021-10-14 16:31:52.000000000 +0300
+++ ImageListPager.php  2021-10-14 16:00:10.127694733 +0300
@@ -90,9 +90,10 @@

                        if ( $nt ) {
                                $dbr = wfGetDB( DB_REPLICA );
- $this->mQueryConds[] = 'LOWER(img_name)' . + $this->mQueryConds[] = 'LOWER(CONVERT(img_name USING utf8))' . $dbr->buildLike( $dbr->anyString(), - strtolower( $nt->getDBkey() ), $dbr->anyString() ); + mb_strtolower( $nt->getDBkey() ), $dbr->anyString() );
+
                        }
                }

@@ -161,9 +162,9 @@
                        $nt = Title::newFromText( $this->mSearch );
                        if ( $nt ) {
                                $dbr = wfGetDB( DB_REPLICA );
- $conds[] = 'LOWER(' . $prefix . '_name)' . + $conds[] = 'LOWER(CONVERT(' . $prefix . '_name USING utf8))' . $dbr->buildLike( $dbr->anyString(), - strtolower( $nt->getDBkey() ), $dbr->anyString() ); + mb_strtolower( $nt->getDBkey() ), $dbr->anyString() );
                        }
                }



--
Sergey
_______________________________________________
Wikitech-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

Reply via email to