Clear $this->mOptionsLoaded in User::clearInstanceCache()
authorTim Starling <tstarling@wikimedia.org>
Fri, 19 Oct 2012 03:02:39 +0000 (14:02 +1100)
committerTim Starling <tstarling@wikimedia.org>
Fri, 19 Oct 2012 03:12:33 +0000 (14:12 +1100)
(bug 41198) If clearInstanceCache() is to clear cached user data apart
from the data from the user table, as addToDatabase() expects, then
$this->mOptionsLoaded needs to be set to false. Clearing $this->mOptions
may reduce memory usage a bit, but is not sufficient.

Change-Id: I6912415dc154d06f62839a1ee777c2c3747253d6

includes/User.php

index 809c183..0a02dd2 100644 (file)
@@ -1168,7 +1168,9 @@ class User {
        }
 
        /**
-        * Clear various cached data stored in this object.
+        * Clear various cached data stored in this object. The cache of the user table
+        * data (i.e. self::$mCacheVars) is not cleared unless $reloadFrom is given.
+        *
         * @param $reloadFrom bool|String Reload user and user_groups table data from a
         *   given source. May be "name", "id", "defaults", "session", or false for
         *   no reload.
@@ -1182,6 +1184,7 @@ class User {
                $this->mEffectiveGroups = null;
                $this->mImplicitGroups = null;
                $this->mOptions = null;
+               $this->mOptionsLoaded = false;
                $this->mEditCount = null;
 
                if ( $reloadFrom ) {