API: Ignore expired blocks in ApiQueryBase::showHiddenUsersAddBlockInfo()
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 15 Oct 2018 15:21:44 +0000 (11:21 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 15 Oct 2018 15:21:44 +0000 (11:21 -0400)
This probably went unnoticed for so long because expired blocks are
regularly cleared as long as new blocks continue being issued, so people
found that the problem "fixed" itself.

Bug: T206944
Change-Id: I6559e1ec23f4469d19684b4d931913acbccb56d4

includes/api/ApiQueryBase.php

index b9ed9f2..8630561 100644 (file)
@@ -436,9 +436,14 @@ abstract class ApiQueryBase extends ApiBase {
         * @return void
         */
        public function showHiddenUsersAddBlockInfo( $showBlockInfo ) {
+               $db = $this->getDB();
+
                $this->addTables( 'ipblocks' );
                $this->addJoinConds( [
-                       'ipblocks' => [ 'LEFT JOIN', 'ipb_user=user_id' ],
+                       'ipblocks' => [ 'LEFT JOIN', [
+                               'ipb_user=user_id',
+                               'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ),
+                       ] ],
                ] );
 
                $this->addFields( 'ipb_deleted' );