r77985 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77984‎ | r77985 | r77986 >
Date:15:47, 7 December 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Per Nikerabbit, follow-up to r77972: use a string instead of boolean for readability
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2860,9 +2860,10 @@
28612861 /**
28622862 * Do any deferred updates and clear the list
28632863 *
2864 - * @param $commit Boolean: commit after every update to prevent lock contention
 2864+ * @param $commit String: set to 'commit' to commit after every update to
 2865+ * prevent lock contention
28652866 */
2866 -function wfDoUpdates( $commit = false ) {
 2867+function wfDoUpdates( $commit = '' ) {
28672868 global $wgDeferredUpdateList;
28682869
28692870 wfProfileIn( __METHOD__ );
@@ -2873,14 +2874,15 @@
28742875 return;
28752876 }
28762877
2877 - if ( $commit ) {
 2878+ $doCommit = $commit == 'commit';
 2879+ if ( $doCommit ) {
28782880 $dbw = wfGetDB( DB_MASTER );
28792881 }
28802882
28812883 foreach ( $wgDeferredUpdateList as $update ) {
28822884 $update->doUpdate();
28832885
2884 - if ( $commit && $dbw->trxLevel() ) {
 2886+ if ( $doCommit && $dbw->trxLevel() ) {
28852887 $dbw->commit();
28862888 }
28872889 }
Index: trunk/phase3/includes/Wiki.php
@@ -371,7 +371,7 @@
372372 // Output everything!
373373 $output->output();
374374 // Do any deferred jobs
375 - wfDoUpdates( true );
 375+ wfDoUpdates( 'commit' );
376376 // Close the session so that jobs don't access the current session
377377 session_write_close();
378378 $this->doJobs();

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r77972Merged wfDoUpdates() and MediaWiki::doUpdates() in wfDoUpdates(); avoids code...ialex11:49, 7 December 2010

Comments

#Comment by Nikerabbit (talk | contribs)   16:14, 7 December 2010

Well, not exactly what I proposed, but better than nothing. It's still not possible to guess from the function call what exactly is going to happen.

#Comment by Platonides (talk | contribs)   16:22, 7 December 2010

What about third parties calling wfDoUpdates( true ); ?

#Comment by Platonides (talk | contribs)   16:23, 7 December 2010

Strike that, I did not notice the parameter was added in r77972

Status & tagging log