Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86995


Change subject: Avoid using DB avoidErrors() method
......................................................................

Avoid using DB avoidErrors() method

Change-Id: Iea0526714a941fea2f5b1c25b24da12167420c6e
---
M includes/specials/SpecialUploads.php
1 file changed, 11 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/95/86995/1

diff --git a/includes/specials/SpecialUploads.php 
b/includes/specials/SpecialUploads.php
index fdb0970..f9d93aa 100644
--- a/includes/specials/SpecialUploads.php
+++ b/includes/specials/SpecialUploads.php
@@ -81,15 +81,18 @@
                }
 
                $limit = $this->getUploadCountThreshold() + 1;
-               $dbr->ignoreErrors( true );
                // not using SQL's count(*) because it's more expensive with 
big number of rows
-               $res = $dbr->select(
-                       'image',
-                       'img_size',
-                       array( 'img_user_text' => $username ),
-                       __METHOD__,
-                       array( 'LIMIT' => $limit )
-               );
+               try {
+                       $res = $dbr->select(
+                               'image',
+                               'img_size',
+                               array( 'img_user_text' => $username ),
+                               __METHOD__,
+                               array( 'LIMIT' => $limit )
+                       );
+               } catch ( DBQueryError $e ) {
+                       $res = false;
+               }
                return ( $res ) ? $res->numRows() : false;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86995
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea0526714a941fea2f5b1c25b24da12167420c6e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to