Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59794
Change subject: Moved Block and Title purgeExpired() functions to
onTransactionIdle().
......................................................................
Moved Block and Title purgeExpired() functions to onTransactionIdle().
Change-Id: I82b2f4689a42481cd2a476351354f55ded581ff5
---
M includes/Block.php
M includes/Title.php
2 files changed, 22 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/94/59794/1
diff --git a/includes/Block.php b/includes/Block.php
index 1d98a29..3f00a51 100644
--- a/includes/Block.php
+++ b/includes/Block.php
@@ -999,11 +999,16 @@
* Purge expired blocks from the ipblocks table
*/
public static function purgeExpired() {
- if ( !wfReadOnly() ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->delete( 'ipblocks',
- array( 'ipb_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ), __METHOD__ );
+ if ( wfReadOnly() ) {
+ return;
}
+
+ $method = __METHOD__;
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->onTransactionIdle( function() use ( $dbw, $method ) {
+ $dbw->delete( 'ipblocks',
+ array( 'ipb_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ), $method );
+ } );
}
/**
diff --git a/includes/Title.php b/includes/Title.php
index d0ac97b..4852ce3 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -2807,18 +2807,20 @@
return;
}
+ $method = __METHOD__;
$dbw = wfGetDB( DB_MASTER );
- $dbw->delete(
- 'page_restrictions',
- array( 'pr_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ),
- __METHOD__
- );
-
- $dbw->delete(
- 'protected_titles',
- array( 'pt_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ),
- __METHOD__
- );
+ $dbw->onTransactionIdle( function() use ( $dbw, $method ) {
+ $dbw->delete(
+ 'page_restrictions',
+ array( 'pr_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ),
+ $method
+ );
+ $dbw->delete(
+ 'protected_titles',
+ array( 'pt_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ),
+ $method
+ );
+ } );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/59794
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82b2f4689a42481cd2a476351354f55ded581ff5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits