[FileBackend] Made Swift clear the auth cache on certain HTTP errors.
authorAaron <aschulz@wikimedia.org>
Mon, 27 Aug 2012 19:36:47 +0000 (12:36 -0700)
committerAaron <aschulz@wikimedia.org>
Mon, 27 Aug 2012 19:36:47 +0000 (12:36 -0700)
* This can handle when the auth token is expired sooner than expected.

Change-Id: I2e5ecc0adbde032b987af37dfe05a4aadb12b319

includes/filebackend/SwiftFileBackend.php

index f54f666..38cd427 100644 (file)
@@ -1297,6 +1297,9 @@ class SwiftFileBackend extends FileBackendStore {
                if ( $e->getMessage() ) {
                        trigger_error( "$func: " . $e->getMessage(), E_USER_WARNING );
                }
+               if ( $e instanceof InvalidResponseException ) { // possibly a stale token
+                       $this->srvCache->delete( $this->getCredsCacheKey( $this->auth->username ) );
+               }
                wfDebugLog( 'SwiftBackend',
                        get_class( $e ) . " in '{$func}' (given '" . FormatJson::encode( $params ) . "')" .
                        ( $e->getMessage() ? ": {$e->getMessage()}" : "" )