| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
namespace MediaWiki\Block; |
| 24 |
|
| 25 |
use InvalidArgumentException; |
| 26 |
use MediaWiki\Block\Restriction\ActionRestriction; |
| 27 |
use MediaWiki\Block\Restriction\NamespaceRestriction; |
| 28 |
use MediaWiki\Block\Restriction\PageRestriction; |
| 29 |
use MediaWiki\Block\Restriction\Restriction; |
| 30 |
use MediaWiki\Html\Html; |
| 31 |
use MediaWiki\MainConfigNames; |
| 32 |
use MediaWiki\MediaWikiServices; |
| 33 |
use MediaWiki\Title\Title; |
| 34 |
use MediaWiki\User\UserIdentity; |
| 35 |
use stdClass; |
| 36 |
use UnexpectedValueException; |
| 37 |
use Wikimedia\IPUtils; |
| 38 |
use Wikimedia\Rdbms\IDatabase; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
class DatabaseBlock extends AbstractBlock { |
| 49 |
|
| 50 |
private $auto; |
| 51 |
|
| 52 |
|
| 53 |
private $parentBlockId; |
| 54 |
|
| 55 |
|
| 56 |
private $id; |
| 57 |
|
| 58 |
|
| 59 |
private $isAutoblocking; |
| 60 |
|
| 61 |
|
| 62 |
private $restrictions; |
| 63 |
|
| 64 |
|
| 65 |
private $blocker; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
public function __construct( array $options = [] ) { |
| 88 |
parent::__construct( $options ); |
| 89 |
|
| 90 |
$defaults = [ |
| 91 |
'id' => null, |
| 92 |
'parentBlockId' => null, |
| 93 |
'auto' => false, |
| 94 |
'expiry' => '', |
| 95 |
'createAccount' => false, |
| 96 |
'enableAutoblock' => false, |
| 97 |
'blockEmail' => false, |
| 98 |
'allowUsertalk' => false, |
| 99 |
'sitewide' => true, |
| 100 |
'by' => null, |
| 101 |
'restrictions' => null, |
| 102 |
]; |
| 103 |
|
| 104 |
$options += $defaults; |
| 105 |
|
| 106 |
$this->id = $options['id']; |
| 107 |
$this->parentBlockId = $options['parentBlockId']; |
| 108 |
|
| 109 |
if ( $options['by'] instanceof UserIdentity ) { |
| 110 |
$this->setBlocker( $options['by'] ); |
| 111 |
} |
| 112 |
|
| 113 |
if ( isset( $options['decodedExpiry'] ) ) { |
| 114 |
$this->setExpiry( $options['decodedExpiry'] ); |
| 115 |
} else { |
| 116 |
$this->setExpiry( $this->getDBConnection( DB_REPLICA )->decodeExpiry( $options['expiry'] ) ); |
| 117 |
} |
| 118 |
|
| 119 |
if ( $options['restrictions'] !== null ) { |
| 120 |
$this->setRestrictions( $options['restrictions'] ); |
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
$this->auto = (bool)$options['auto']; |
| 125 |
$this->isAutoblocking( (bool)$options['enableAutoblock'] ); |
| 126 |
$this->isSitewide( (bool)$options['sitewide'] ); |
| 127 |
$this->isEmailBlocked( (bool)$options['blockEmail'] ); |
| 128 |
$this->isCreateAccountBlocked( (bool)$options['createAccount'] ); |
| 129 |
$this->isUsertalkEditAllowed( (bool)$options['allowUsertalk'] ); |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
public static function newFromID( $id ) { |
| 140 |
wfDeprecated( __METHOD__, '1.42' ); |
| 141 |
return MediaWikiServices::getInstance()->getDatabaseBlockStore() |
| 142 |
->newFromID( $id ); |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
public static function getQueryInfo() { |
| 166 |
wfDeprecated( __METHOD__, '1.43' ); |
| 167 |
return MediaWikiServices::getInstance()->getDatabaseBlockStore() |
| 168 |
->getQueryInfo( DatabaseBlockStore::SCHEMA_IPBLOCKS ); |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
public function equals( DatabaseBlock $block ) { |
| 179 |
return ( |
| 180 |
(string)$this->target == (string)$block->target |
| 181 |
&& $this->type == $block->type |
| 182 |
&& $this->auto == $block->auto |
| 183 |
&& $this->isHardblock() == $block->isHardblock() |
| 184 |
&& $this->isCreateAccountBlocked() == $block->isCreateAccountBlocked() |
| 185 |
&& $this->getExpiry() == $block->getExpiry() |
| 186 |
&& $this->isAutoblocking() == $block->isAutoblocking() |
| 187 |
&& $this->getHideName() == $block->getHideName() |
| 188 |
&& $this->isEmailBlocked() == $block->isEmailBlocked() |
| 189 |
&& $this->isUsertalkEditAllowed() == $block->isUsertalkEditAllowed() |
| 190 |
&& $this->getReasonComment()->text == $block->getReasonComment()->text |
| 191 |
&& $this->isSitewide() == $block->isSitewide() |
| 192 |
|
| 193 |
|
| 194 |
&& $this->getBlockRestrictionStore()->equals( |
| 195 |
$this->getRestrictions(), $block->getRestrictions() |
| 196 |
) |
| 197 |
); |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
public static function getRangeCond( $start, $end = null ) { |
| 210 |
wfDeprecated( __METHOD__, '1.43' ); |
| 211 |
return MediaWikiServices::getInstance()->getDatabaseBlockStore() |
| 212 |
->getRangeCond( $start, $end, DatabaseBlockStore::SCHEMA_IPBLOCKS ); |
| 213 |
} |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
public static function newFromRow( $row ) { |
| 221 |
$services = MediaWikiServices::getInstance(); |
| 222 |
$db = $services->getConnectionProvider()->getReplicaDatabase(); |
| 223 |
return $services->getDatabaseBlockStore()->newFromRow( $db, $row ); |
| 224 |
} |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
public function delete() { |
| 233 |
return MediaWikiServices::getInstance() |
| 234 |
->getDatabaseBlockStoreFactory() |
| 235 |
->getDatabaseBlockStore( $this->getWikiId() ) |
| 236 |
->deleteBlock( $this ); |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
public function insert() { |
| 250 |
return MediaWikiServices::getInstance() |
| 251 |
->getDatabaseBlockStoreFactory() |
| 252 |
->getDatabaseBlockStore( $this->getWikiId() ) |
| 253 |
->insertBlock( $this ); |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
public function update() { |
| 265 |
return MediaWikiServices::getInstance() |
| 266 |
->getDatabaseBlockStoreFactory() |
| 267 |
->getDatabaseBlockStore( $this->getWikiId() ) |
| 268 |
->updateBlock( $this ); |
| 269 |
} |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
public static function isExemptedFromAutoblocks( $ip ) { |
| 280 |
return MediaWikiServices::getInstance()->getAutoblockExemptionList() |
| 281 |
->isExempt( $ip ); |
| 282 |
} |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
public function doAutoblock( $autoblockIP ) { |
| 293 |
return MediaWikiServices::getInstance() |
| 294 |
->getDatabaseBlockStoreFactory() |
| 295 |
->getDatabaseBlockStore( $this->getWikiId() ) |
| 296 |
->doAutoblock( $this, $autoblockIP ); |
| 297 |
} |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
public function isExpired() { |
| 304 |
$timestamp = wfTimestampNow(); |
| 305 |
wfDebug( __METHOD__ . " checking current " . $timestamp . " vs $this->expiry" ); |
| 306 |
|
| 307 |
return $this->getExpiry() && $timestamp > $this->getExpiry(); |
| 308 |
} |
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
public function updateTimestamp() { |
| 316 |
MediaWikiServices::getInstance() |
| 317 |
->getDatabaseBlockStoreFactory() |
| 318 |
->getDatabaseBlockStore( $this->getWikiId() ) |
| 319 |
->updateTimestamp( $this ); |
| 320 |
} |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
public function getRangeStart() { |
| 327 |
switch ( $this->type ) { |
| 328 |
case self::TYPE_USER: |
| 329 |
return ''; |
| 330 |
case self::TYPE_IP: |
| 331 |
return IPUtils::toHex( $this->target ); |
| 332 |
case self::TYPE_RANGE: |
| 333 |
[ $start, ] = IPUtils::parseRange( $this->target ); |
| 334 |
return $start; |
| 335 |
default: |
| 336 |
throw new UnexpectedValueException( "Block with invalid type" ); |
| 337 |
} |
| 338 |
} |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
public function getRangeEnd() { |
| 345 |
switch ( $this->type ) { |
| 346 |
case self::TYPE_USER: |
| 347 |
return ''; |
| 348 |
case self::TYPE_IP: |
| 349 |
return IPUtils::toHex( $this->target ); |
| 350 |
case self::TYPE_RANGE: |
| 351 |
[ , $end ] = IPUtils::parseRange( $this->target ); |
| 352 |
return $end; |
| 353 |
default: |
| 354 |
throw new UnexpectedValueException( "Block with invalid type" ); |
| 355 |
} |
| 356 |
} |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
public function getId( $wikiId = self::LOCAL ): ?int { |
| 362 |
$this->assertWiki( $wikiId ); |
| 363 |
return $this->id; |
| 364 |
} |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
public function setId( $blockId ) { |
| 374 |
$this->id = (int)$blockId; |
| 375 |
|
| 376 |
if ( is_array( $this->restrictions ) ) { |
| 377 |
$this->restrictions = $this->getBlockRestrictionStore()->setBlockId( |
| 378 |
$blockId, $this->restrictions |
| 379 |
); |
| 380 |
} |
| 381 |
|
| 382 |
return $this; |
| 383 |
} |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
public function getParentBlockId() { |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
return $this->parentBlockId ?: null; |
| 394 |
} |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
public function isHardblock( $x = null ): bool { |
| 402 |
wfSetVar( $this->isHardblock, $x ); |
| 403 |
|
| 404 |
|
| 405 |
return $this->getType() == self::TYPE_USER |
| 406 |
? true |
| 407 |
: $this->isHardblock; |
| 408 |
} |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
public function isAutoblocking( $x = null ) { |
| 417 |
wfSetVar( $this->isAutoblocking, $x ); |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
return $this->getType() == self::TYPE_USER |
| 422 |
? $this->isAutoblocking |
| 423 |
: false; |
| 424 |
} |
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
public function getRedactedName() { |
| 431 |
if ( $this->auto ) { |
| 432 |
return Html::element( |
| 433 |
'span', |
| 434 |
[ 'class' => 'mw-autoblockid' ], |
| 435 |
wfMessage( 'autoblockid', $this->id )->text() |
| 436 |
); |
| 437 |
} else { |
| 438 |
return htmlspecialchars( $this->getTargetName() ); |
| 439 |
} |
| 440 |
} |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
public static function getAutoblockExpiry( $timestamp ) { |
| 451 |
wfDeprecated( __METHOD__, '1.42' ); |
| 452 |
return MediaWikiServices::getInstance()->getDatabaseBlockStore() |
| 453 |
->getAutoblockExpiry( $timestamp ); |
| 454 |
} |
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
public static function newFromTarget( |
| 478 |
$specificTarget, |
| 479 |
$vagueTarget = null, |
| 480 |
$fromPrimary = false |
| 481 |
) { |
| 482 |
return MediaWikiServices::getInstance()->getDatabaseBlockStore() |
| 483 |
->newFromTarget( $specificTarget, $vagueTarget, $fromPrimary ); |
| 484 |
} |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
public static function newListFromTarget( |
| 496 |
$specificTarget, |
| 497 |
$vagueTarget = null, |
| 498 |
$fromPrimary = false |
| 499 |
) { |
| 500 |
return MediaWikiServices::getInstance()->getDatabaseBlockStore() |
| 501 |
->newListFromTarget( $specificTarget, $vagueTarget, $fromPrimary ); |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
public static function getBlocksForIPList( array $ipChain, $applySoftBlocks, $fromPrimary = false ) { |
| 516 |
return MediaWikiServices::getInstance()->getBlockManager() |
| 517 |
->getBlocksForIPList( $ipChain, $applySoftBlocks, $fromPrimary ); |
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
public function getType(): ?int { |
| 527 |
return $this->auto |
| 528 |
? self::TYPE_AUTO |
| 529 |
: parent::getType(); |
| 530 |
} |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
public function getIdentifier( $wikiId = self::LOCAL ) { |
| 536 |
return $this->getId( $wikiId ); |
| 537 |
} |
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
public function getRestrictions() { |
| 547 |
if ( $this->restrictions === null ) { |
| 548 |
|
| 549 |
|
| 550 |
if ( !$this->id ) { |
| 551 |
return []; |
| 552 |
} |
| 553 |
$this->restrictions = $this->getBlockRestrictionStore()->loadByBlockId( $this->id ); |
| 554 |
} |
| 555 |
|
| 556 |
return $this->restrictions; |
| 557 |
} |
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
public function getRawRestrictions(): ?array { |
| 566 |
return $this->restrictions; |
| 567 |
} |
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
public function setRestrictions( array $restrictions ) { |
| 575 |
$this->restrictions = $restrictions; |
| 576 |
return $this; |
| 577 |
} |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
public function appliesToTitle( Title $title ) { |
| 583 |
if ( $this->isSitewide() ) { |
| 584 |
return true; |
| 585 |
} |
| 586 |
|
| 587 |
$restrictions = $this->getRestrictions(); |
| 588 |
foreach ( $restrictions as $restriction ) { |
| 589 |
if ( $restriction->matches( $title ) ) { |
| 590 |
return true; |
| 591 |
} |
| 592 |
} |
| 593 |
|
| 594 |
return false; |
| 595 |
} |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
public function appliesToNamespace( $ns ) { |
| 601 |
if ( $this->isSitewide() ) { |
| 602 |
return true; |
| 603 |
} |
| 604 |
|
| 605 |
|
| 606 |
if ( $ns < 0 ) { |
| 607 |
return false; |
| 608 |
} |
| 609 |
|
| 610 |
$restriction = $this->findRestriction( NamespaceRestriction::TYPE, $ns ); |
| 611 |
|
| 612 |
return (bool)$restriction; |
| 613 |
} |
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
public function appliesToPage( $pageId ) { |
| 619 |
if ( $this->isSitewide() ) { |
| 620 |
return true; |
| 621 |
} |
| 622 |
|
| 623 |
|
| 624 |
if ( $pageId <= 0 ) { |
| 625 |
return false; |
| 626 |
} |
| 627 |
|
| 628 |
$restriction = $this->findRestriction( PageRestriction::TYPE, $pageId ); |
| 629 |
|
| 630 |
return (bool)$restriction; |
| 631 |
} |
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
public function appliesToRight( $right ) { |
| 637 |
|
| 638 |
$config = MediaWikiServices::getInstance()->getMainConfig(); |
| 639 |
|
| 640 |
$res = parent::appliesToRight( $right ); |
| 641 |
|
| 642 |
if ( !$res && $config->get( MainConfigNames::EnablePartialActionBlocks ) ) { |
| 643 |
$blockActions = MediaWikiServices::getInstance()->getBlockActionInfo() |
| 644 |
->getAllBlockActions(); |
| 645 |
|
| 646 |
if ( isset( $blockActions[$right] ) ) { |
| 647 |
$restriction = $this->findRestriction( |
| 648 |
ActionRestriction::TYPE, |
| 649 |
$blockActions[$right] |
| 650 |
); |
| 651 |
|
| 652 |
|
| 653 |
if ( $restriction ) { |
| 654 |
$res = true; |
| 655 |
} |
| 656 |
} |
| 657 |
} |
| 658 |
|
| 659 |
return $res; |
| 660 |
} |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
private function findRestriction( $type, $value ) { |
| 670 |
$restrictions = $this->getRestrictions(); |
| 671 |
foreach ( $restrictions as $restriction ) { |
| 672 |
if ( $restriction->getType() !== $type ) { |
| 673 |
continue; |
| 674 |
} |
| 675 |
|
| 676 |
if ( $restriction->getValue() === $value ) { |
| 677 |
return $restriction; |
| 678 |
} |
| 679 |
} |
| 680 |
|
| 681 |
return null; |
| 682 |
} |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
private function getBlockRestrictionStore(): BlockRestrictionStore { |
| 690 |
|
| 691 |
return MediaWikiServices::getInstance() |
| 692 |
->getBlockRestrictionStoreFactory() |
| 693 |
->getBlockRestrictionStore( $this->getWikiId() ); |
| 694 |
} |
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
public function getBy( $wikiId = self::LOCAL ): int { |
| 700 |
$this->assertWiki( $wikiId ); |
| 701 |
return ( $this->blocker ) ? $this->blocker->getId( $wikiId ) : 0; |
| 702 |
} |
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
public function getByName() { |
| 708 |
return ( $this->blocker ) ? $this->blocker->getName() : ''; |
| 709 |
} |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
public function getBlocker(): ?UserIdentity { |
| 717 |
return $this->blocker; |
| 718 |
} |
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
public function setBlocker( $user ) { |
| 726 |
if ( !$user->isRegistered() && |
| 727 |
MediaWikiServices::getInstance()->getUserNameUtils()->isUsable( $user->getName() ) |
| 728 |
) { |
| 729 |
throw new InvalidArgumentException( |
| 730 |
'Blocker must be a local user or a name that cannot be a local user' |
| 731 |
); |
| 732 |
} |
| 733 |
$this->assertWiki( $user->getWikiId() ); |
| 734 |
$this->blocker = $user; |
| 735 |
} |
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
private function getDBConnection( int $i ) { |
| 742 |
return MediaWikiServices::getInstance() |
| 743 |
->getDBLoadBalancerFactory() |
| 744 |
->getMainLB( $this->getWikiId() ) |
| 745 |
->getConnection( $i, [], $this->getWikiId() ); |
| 746 |
} |
| 747 |
} |