本文整理汇总了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');
}
}