SECURITY: rate-limit and prevent blocked users from changing email
[lhc/web/wiklou.git] / includes / api / ApiQueryBlocks.php
index 95f8cda..5615f46 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 use Wikimedia\Rdbms\IResultWrapper;
-use MediaWiki\Block\BlockRestriction;
+use MediaWiki\MediaWikiServices;
 
 /**
  * Query module to enumerate all user blocks
@@ -292,7 +292,8 @@ class ApiQueryBlocks extends ApiQueryBase {
                        }
                }
 
-               $restrictions = BlockRestriction::loadByBlockId( $partialIds );
+               $blockRestrictionStore = MediaWikiServices::getInstance()->getBlockRestrictionStore();
+               $restrictions = $blockRestrictionStore->loadByBlockId( $partialIds );
 
                $data = [];
                $keys = [
@@ -305,7 +306,9 @@ class ApiQueryBlocks extends ApiQueryBase {
                        switch ( $restriction->getType() ) {
                                case 'page':
                                        $value = [ 'id' => $restriction->getValue() ];
-                                       self::addTitleInfo( $value, $restriction->getTitle() );
+                                       if ( $restriction->getTitle() ) {
+                                               self::addTitleInfo( $value, $restriction->getTitle() );
+                                       }
                                        break;
                                default:
                                        $value = $restriction->getValue();