Example #1
0
 public function userBlock($type = 'exact')
 {
     wfProfileIn(__METHOD__);
     $this->user->mBlockedby = $this->block->authorId;
     $this->user->mBlockedGlobally = true;
     $this->user->mBlockreason = UserBlock::getBlockReasonMessage($this->block->reason, $type == 'exact', $type == 'ip');
     // set expiry information
     $this->user->mBlock = new Block();
     // protected
     $this->user->mBlock->setId($this->block->id);
     $this->user->mBlock->setBlockEmail(true);
     $this->user->mBlock->setBlocker(User::newFromID($this->block->authorId));
     // public
     $this->user->mBlock->mExpiry = isset($this->block->expires) && !empty($this->block->expires) ? $this->block->expires : 'infinity';
     $this->user->mBlock->mTimestamp = wfTimestampNow();
     $this->user->mBlock->mAddress = $this->block->text;
     if ($type == 'ip') {
         $this->user->mBlock->setCreateAccount(1);
     }
     wfProfileOut(__METHOD__);
     return $this;
 }