From 50c52563528ba3d765c3762211f98d6f3c0e39fd Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 22 Jan 2016 11:09:32 -0500 Subject: [PATCH] SessionManager: Add SessionBackend::setProviderMetadata() Providers might need to update their metadata at times other than when they're creating the SessionInfo. Bug: T124409 Change-Id: Ia9d113c93726205de85df65bf85faef74c73c949 --- includes/session/SessionBackend.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/includes/session/SessionBackend.php b/includes/session/SessionBackend.php index 5743b12422..3c0f692661 100644 --- a/includes/session/SessionBackend.php +++ b/includes/session/SessionBackend.php @@ -408,12 +408,31 @@ final class SessionBackend { /** * Fetch provider metadata * @protected For use by SessionProvider subclasses only - * @return mixed + * @return array|null */ public function getProviderMetadata() { return $this->providerMetadata; } + /** + * Set provider metadata + * @protected For use by SessionProvider subclasses only + * @param array|null $metadata + */ + public function setProviderMetadata( $metadata ) { + if ( $metadata !== null && !is_array( $metadata ) ) { + throw new \InvalidArgumentException( '$metadata must be an array or null' ); + } + if ( $this->providerMetadata !== $metadata ) { + $this->providerMetadata = $metadata; + $this->metaDirty = true; + $this->logger->debug( + "SessionBackend $this->id metadata dirty due to provider metadata change" + ); + $this->autosave(); + } + } + /** * Fetch the session data array * -- 2.20.1