Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/83202


Change subject: Add try/catch around statement that can cause errors when 
running update.php
......................................................................

Add try/catch around statement that can cause errors when running update.php

Change-Id: I0f6a6f9bd6f8638c2606340fdece16fada97e367
---
M Hooks.php
1 file changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/02/83202/1

diff --git a/Hooks.php b/Hooks.php
index c9c7127..e61c906 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -816,10 +816,19 @@
         * @return bool true in all cases
         */
        static function onUserSaveSettings( $user ) {
-               // Reset the notification count since it may have changed due 
to user
-               // option changes. This covers both explicit changes in the 
preferences
-               // and changes made through the options API (since both call 
this hook).
-               MWEchoNotifUser::newFromUser( $user )->resetNotificationCount();
+               try {
+                       // Reset the notification count since it may have 
changed due to user
+                       // option changes. This covers both explicit changes in 
the preferences
+                       // and changes made through the options API (since both 
call this hook).
+                       MWEchoNotifUser::newFromUser( $user 
)->resetNotificationCount();
+               } catch( Exception $e ) {
+                       /*
+                        * The try/catch is here because, when running 
update.php (to install
+                        * Echo tables), other extensions (I'm looking at you, 
AbuseFilter)
+                        * may be creating new users. This will result in an 
Exception being
+                        * thrown because at this point, the Echo tables do net 
yet exist.
+                        */
+               }
                return true;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/83202
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f6a6f9bd6f8638c2606340fdece16fada97e367
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to