summaryrefslogtreecommitdiff
path: root/includes/DeferredUpdates.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/DeferredUpdates.php')
-rw-r--r--includes/DeferredUpdates.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/includes/DeferredUpdates.php b/includes/DeferredUpdates.php
index b4989a69..c385f138 100644
--- a/includes/DeferredUpdates.php
+++ b/includes/DeferredUpdates.php
@@ -34,7 +34,7 @@ interface DeferrableUpdate {
}
/**
- * Class for mananging the deferred updates.
+ * Class for managing the deferred updates.
*
* @since 1.19
*/
@@ -64,9 +64,19 @@ class DeferredUpdates {
}
/**
+ * Add a callable update. In a lot of cases, we just need a callback/closure,
+ * defining a new DeferrableUpdate object is not necessary
+ * @see MWCallableUpdate::__construct()
+ * @param callable $callable
+ */
+ public static function addCallableUpdate( $callable ) {
+ self::addUpdate( new MWCallableUpdate( $callable ) );
+ }
+
+ /**
* Do any deferred updates and clear the list
*
- * @param $commit String: set to 'commit' to commit after every update to
+ * @param string $commit set to 'commit' to commit after every update to
* prevent lock contention
*/
public static function doUpdates( $commit = '' ) {
@@ -92,14 +102,14 @@ class DeferredUpdates {
$update->doUpdate();
if ( $doCommit && $dbw->trxLevel() ) {
- $dbw->commit( __METHOD__ );
+ $dbw->commit( __METHOD__, 'flush' );
}
} catch ( MWException $e ) {
// We don't want exceptions thrown during deferred updates to
// be reported to the user since the output is already sent.
// Instead we just log them.
if ( !$e instanceof ErrorPageError ) {
- wfDebugLog( 'exception', $e->getLogMessage() );
+ MWExceptionHandler::logException( $e );
}
}
}