From: Aaron Date: Mon, 27 Aug 2012 19:36:47 +0000 (-0700) Subject: [FileBackend] Made Swift clear the auth cache on certain HTTP errors. X-Git-Tag: 1.31.0-rc.0~22561^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=338e84e122d4f63e338643ce91e0549487fb7f40;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Made Swift clear the auth cache on certain HTTP errors. * This can handle when the auth token is expired sooner than expected. Change-Id: I2e5ecc0adbde032b987af37dfe05a4aadb12b319 --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index f54f6667fe..38cd427dbd 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -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()}" : "" )