Merge "Use STRAIGHT_JOIN on updateCollation.php per jcrespo"
[lhc/web/wiklou.git] / includes / user / User.php
index ee617a2..3d7d71c 100644 (file)
@@ -2489,9 +2489,9 @@ class User implements IDBAccessObject {
                        throw new PasswordError( wfMessage( 'externaldberror' )->text() );
                }
 
-               $this->setToken();
                $this->setOption( 'watchlisttoken', false );
                $this->setPasswordInternal( $str );
+               SessionManager::singleton()->invalidateSessionsForUser( $this );
 
                return true;
        }
@@ -2508,9 +2508,9 @@ class User implements IDBAccessObject {
                global $wgAuth;
 
                if ( $wgAuth->allowSetLocalPassword() ) {
-                       $this->setToken();
                        $this->setOption( 'watchlisttoken', false );
                        $this->setPasswordInternal( $str );
+                       SessionManager::singleton()->invalidateSessionsForUser( $this );
                }
        }
 
@@ -3398,6 +3398,19 @@ class User implements IDBAccessObject {
                return !$this->isLoggedIn();
        }
 
+       /**
+        * @return bool Whether this user is flagged as being a bot role account
+        * @since 1.28
+        */
+       public function isBot() {
+               $isBot = false;
+               if ( !Hooks::run( "UserIsBot", [ $this, &$isBot ] ) ) {
+                       return $isBot;
+               }
+
+               return ( $isBot || in_array( 'bot', $this->getGroups() ) );
+       }
+
        /**
         * Check if user is allowed to access a feature / make an action
         *