Merge "Clear previously left-over PQresult before calling pg_get_result()"
[lhc/web/wiklou.git] / includes / User.php
index 029f5cf..75649a7 100644 (file)
@@ -385,10 +385,10 @@ class User implements IDBAccessObject {
                        return false;
                }
 
-               // Try cache (unless this needs to lock the DB).
+               // Try cache (unless this needs data from the master DB).
                // NOTE: if this thread called saveSettings(), the cache was cleared.
-               $locking = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING );
-               if ( $locking || !$this->loadFromCache() ) {
+               $latest = DBAccessObjectUtils::hasFlags( $flags, self::READ_LATEST );
+               if ( $latest || !$this->loadFromCache() ) {
                        wfDebug( "User: cache miss for user {$this->mId}\n" );
                        // Load from DB (make sure this thread sees its own changes)
                        if ( wfGetLB()->hasOrMadeRecentMasterChanges() ) {
@@ -458,7 +458,7 @@ class User implements IDBAccessObject {
                $data['mVersion'] = self::VERSION;
                $key = wfMemcKey( 'user', 'id', $this->mId );
 
-               $opts = array( 'since' => wfGetDB( DB_SLAVE )->trxTimestamp() );
+               $opts = Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
                ObjectCache::getMainWANInstance()->set( $key, $data, 3600, $opts );
        }
 
@@ -935,7 +935,7 @@ class User implements IDBAccessObject {
         * the cached User object, we assume that whatever mechanism is setting
         * the expiration date is also expiring the User cache.
         * @since 1.23
-        * @return string|bool The datestamp of the expiration, or null if not set
+        * @return string|null The datestamp of the expiration, or null if not set
         */
        public function getPasswordExpireDate() {
                $this->load();
@@ -3508,7 +3508,7 @@ class User implements IDBAccessObject {
                        $request = $this->getRequest();
                }
                $params['secure'] = $secure;
-               $request->response()->setcookie( $name, $value, $exp, $params );
+               $request->response()->setCookie( $name, $value, $exp, $params );
        }
 
        /**
@@ -4852,7 +4852,7 @@ class User implements IDBAccessObject {
                $dbw->update(
                        'user',
                        array( 'user_editcount=user_editcount+1' ),
-                       array( 'user_id' => $this->getId() ),
+                       array( 'user_id' => $this->getId(), 'user_editcount IS NOT NULL' ),
                        __METHOD__
                );
                // Lazy initialization check...