当前位置: 首页>>代码示例>>PHP>>正文


PHP Block::getAutoblockExpiry方法代码示例

本文整理汇总了PHP中Block::getAutoblockExpiry方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getAutoblockExpiry方法的具体用法?PHP Block::getAutoblockExpiry怎么用?PHP Block::getAutoblockExpiry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


在下文中一共展示了Block::getAutoblockExpiry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: spreadBlock

 function spreadBlock()
 {
     # If the (non-anonymous) user is blocked, this function will block any IP address
     # that they successfully log on from.
     $fname = 'User::spreadBlock';
     wfDebug("User:spreadBlock()\n");
     if ($this->mId == 0) {
         return;
     }
     $userblock = Block::newFromDB('', $this->mId);
     if (!$userblock->isValid()) {
         return;
     }
     # Check if this IP address is already blocked
     $ipblock = Block::newFromDB(wfGetIP());
     if ($ipblock->isValid()) {
         # If the user is already blocked. Then check if the autoblock would
         # excede the user block. If it would excede, then do nothing, else
         # prolong block time
         if ($userblock->mExpiry && $userblock->mExpiry < Block::getAutoblockExpiry($ipblock->mTimestamp)) {
             return;
         }
         # Just update the timestamp
         $ipblock->updateTimestamp();
         return;
     }
     # Make a new block object with the desired properties
     wfDebug("Autoblocking {$this->mName}@" . wfGetIP() . "\n");
     $ipblock->mAddress = wfGetIP();
     $ipblock->mUser = 0;
     $ipblock->mBy = $userblock->mBy;
     $ipblock->mReason = wfMsg('autoblocker', $this->getName(), $userblock->mReason);
     $ipblock->mTimestamp = wfTimestampNow();
     $ipblock->mAuto = 1;
     # If the user is already blocked with an expiry date, we don't
     # want to pile on top of that!
     if ($userblock->mExpiry) {
         $ipblock->mExpiry = min($userblock->mExpiry, Block::getAutoblockExpiry($ipblock->mTimestamp));
     } else {
         $ipblock->mExpiry = Block::getAutoblockExpiry($ipblock->mTimestamp);
     }
     # Insert it
     $ipblock->insert();
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:44,代码来源:User.php

示例2: updateTimestamp

 /**
  * Update the timestamp on autoblocks.
  */
 public function updateTimestamp()
 {
     if ($this->mAuto) {
         $this->mTimestamp = wfTimestamp();
         $this->mExpiry = Block::getAutoblockExpiry($this->mTimestamp);
         $dbw = wfGetDB(DB_MASTER);
         $dbw->update('ipblocks', ['ipb_timestamp' => $dbw->timestamp($this->mTimestamp), 'ipb_expiry' => $dbw->timestamp($this->mExpiry)], ['ipb_id' => $this->getId()], __METHOD__);
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:Block.php

示例3: updateTimestamp

 /**
  * Update the timestamp on autoblocks.
  */
 public function updateTimestamp()
 {
     if ($this->mAuto) {
         $this->mTimestamp = wfTimestamp();
         $this->mExpiry = Block::getAutoblockExpiry($this->mTimestamp);
         $dbw = wfGetDB(DB_MASTER);
         $dbw->update('ipblocks', array('ipb_timestamp' => $dbw->timestamp($this->mTimestamp), 'ipb_expiry' => $dbw->timestamp($this->mExpiry)), array('ipb_address' => (string) $this->getTarget()), __METHOD__);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:12,代码来源:Block.php

示例4: updateTimestamp

 function updateTimestamp()
 {
     if ($this->mAuto) {
         $this->mTimestamp = wfTimestamp();
         $this->mExpiry = Block::getAutoblockExpiry($this->mTimestamp);
         $dbw = wfGetDB(DB_MASTER);
         $dbw->update('ipblocks', array('ipb_timestamp' => $dbw->timestamp($this->mTimestamp), 'ipb_expiry' => $dbw->timestamp($this->mExpiry)), array('ipb_address' => $this->mAddress), 'Block::updateTimestamp');
     }
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:9,代码来源:Block.php


注:本文中的Block::getAutoblockExpiry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。