當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。