Search code examples
mediawikiwikipedia-apimediawiki-api

What is the 'mywikiLoggedOut=12345678' cookie good for?


While logging in via the API, I get back some cookies from the Wikimedia framework:

mywikiUserName=myusername;
mywiki_session=a27c625a1babc58ad7cc11e317c9eed2;
mywikiLoggedOut=20120723255540";

I wonder what the mywikiLoggedOut=20120723211540 is about?

I havn't found documentation regarding this, so any help is appreciated.


Solution

  • Doing a simple git grep on the MediaWiki repository will point you to the doLogout() function in includes/User.php:

    /**
     * Clear the user's cookies and session, and reset the instance cache.
     * @see logout()
     */
    public function doLogout() {
        $this->clearInstanceCache( 'defaults' );
    
        $this->getRequest()->setSessionData( 'wsUserID', 0 );
    
        $this->clearCookie( 'UserID' );
        $this->clearCookie( 'Token' );
    
        # Remember when user logged out, to prevent seeing cached pages
        $this->setCookie( 'LoggedOut', wfTimestampNow(), time() + 86400 );
    }
    

    The code of the function and the comment make it clear that this cookie indicates when you last logged out and is used to control caching of pages (presumably so that the pages don't look like you were still logged in after you log out).