本文整理匯總了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();
}
示例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__);
}
}
示例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__);
}
}
示例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');
}
}