r104435 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104434‎ | r104435 | r104436 >
Date:15:18, 28 November 2011
Author:petrb
Status:deferred
Tags:
Comment:
Performace - check if previous user had extension enabled before updating db, need review, maybe it's possible to get old user handle better
Modified paths:
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBarHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/OnlineStatusBarHooks.php
@@ -22,14 +22,22 @@
2323 }
2424
2525 /**
 26+ * Called everytime when user logout
2627 * @param $user User
2728 * @param $inject_html string
2829 * @param $old_name string
2930 * @return bool
3031 */
3132 public static function logout( &$user, &$inject_html, $old_name ) {
32 - OnlineStatusBar::purge( $old_name );
33 - OnlineStatusBar_StatusCheck::deleteStatus( $old_name );
 33+ global $wgOnlineStatusBarDefaultEnabled;
 34+ // check if user had enabled this feature before we write to db
 35+ $olduser = User::newFromName( $old_name );
 36+ if ( $olduser instanceof User ) {
 37+ if ( $olduser->getOption( 'OnlineStatusBar_active', $wgOnlineStatusBarDefaultEnabled ) ) {
 38+ OnlineStatusBar::purge( $old_name );
 39+ OnlineStatusBar_StatusCheck::deleteStatus( $old_name );
 40+ }
 41+ }
3442 return true;
3543 }
3644

Follow-up revisions

RevisionCommit summaryAuthorDate
r104440r104435 changed hook to correct one should be fasterpetrb15:25, 28 November 2011

Status & tagging log