Merge "Avoid DBPerformance warnings on PURGE/TRACE requests"
[lhc/web/wiklou.git] / includes / Block.php
index 696a520..93df004 100644 (file)
@@ -137,7 +137,7 @@ class Block {
 
                if ( $options['by'] ) {
                        # Local user
-                       $this->setBlocker( User::newFromID( $options['by'] ) );
+                       $this->setBlocker( User::newFromId( $options['by'] ) );
                } else {
                        # Foreign user
                        $this->setBlocker( $options['byText'] );
@@ -568,7 +568,7 @@ class Block {
                if ( $this->forcedTargetID ) {
                        $uid = $this->forcedTargetID;
                } else {
-                       $uid = $this->target instanceof User ? $this->target->getID() : 0;
+                       $uid = $this->target instanceof User ? $this->target->getId() : 0;
                }
 
                $a = [
@@ -844,7 +844,7 @@ class Block {
                                        'ipb_expiry' => $dbw->timestamp( $this->mExpiry ),
                                ],
                                [ /* WHERE */
-                                       'ipb_address' => (string)$this->getTarget()
+                                       'ipb_id' => $this->getId(),
                                ],
                                __METHOD__
                        );
@@ -1307,8 +1307,7 @@ class Block {
                # but actually an old subpage (bug #29797)
                if ( strpos( $target, '/' ) !== false ) {
                        # An old subpage, drill down to the user behind it
-                       $parts = explode( '/', $target );
-                       $target = $parts[0];
+                       $target = explode( '/', $target )[0];
                }
 
                $userObj = User::newFromName( $target );