Merge "Revert "Use display name in category page subheadings if provided""
[lhc/web/wiklou.git] / includes / specials / pagers / ImageListPager.php
index 40706fa..7fc4a95 100644 (file)
@@ -74,7 +74,7 @@ class ImageListPager extends TablePager {
                        $nt = Title::newFromText( $this->mSearch );
 
                        if ( $nt ) {
-                               $dbr = wfGetDB( DB_SLAVE );
+                               $dbr = wfGetDB( DB_REPLICA );
                                $this->mQueryConds[] = 'LOWER(img_name)' .
                                        $dbr->buildLike( $dbr->anyString(),
                                                strtolower( $nt->getDBkey() ), $dbr->anyString() );
@@ -136,7 +136,7 @@ class ImageListPager extends TablePager {
                if ( $this->mSearch !== '' ) {
                        $nt = Title::newFromText( $this->mSearch );
                        if ( $nt ) {
-                               $dbr = wfGetDB( DB_SLAVE );
+                               $dbr = wfGetDB( DB_REPLICA );
                                $conds[] = 'LOWER(' . $prefix . '_name)' .
                                        $dbr->buildLike( $dbr->anyString(),
                                                strtolower( $nt->getDBkey() ), $dbr->anyString() );
@@ -272,7 +272,7 @@ class ImageListPager extends TablePager {
                        }
                        unset( $field );
 
-                       $dbr = wfGetDB( DB_SLAVE );
+                       $dbr = wfGetDB( DB_REPLICA );
                        if ( $dbr->implicitGroupby() ) {
                                $options = [ 'GROUP BY' => 'img_name' ];
                        } else {
@@ -429,8 +429,11 @@ class ImageListPager extends TablePager {
                                // If statement for paranoia
                                if ( $file ) {
                                        $thumb = $file->transform( [ 'width' => 180, 'height' => 360 ] );
-
-                                       return $thumb->toHtml( [ 'desc-link' => true ] );
+                                       if ( $thumb ) {
+                                               return $thumb->toHtml( [ 'desc-link' => true ] );
+                                       } else {
+                                               return wfMessage( 'thumbnail_error', '' )->escaped();
+                                       }
                                } else {
                                        return htmlspecialchars( $value );
                                }