ExternalStore: Pass external domain to getReadOnlyReason
authorJesús Martínez Novo <martineznovo@gmail.com>
Mon, 22 Apr 2019 09:21:52 +0000 (11:21 +0200)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 22 May 2019 19:09:00 +0000 (19:09 +0000)
Be consistent with other paths of code that supply the external domain
id to LoadBalancer instead of defaulting to the wiki's domain.

This was causing the getReadOnlyReason to fail because it tries to
connect to the local wiki database using external storage credentials.

Bug: T200471
Change-Id: Ie73ea931d5c93f967624ee67717f87c2d9a31559

includes/externalstore/ExternalStoreDB.php

index 4164505..cac16b6 100644 (file)
@@ -106,7 +106,9 @@ class ExternalStoreDB extends ExternalStoreMedium {
        }
 
        public function isReadOnly( $location ) {
-               return ( $this->getLoadBalancer( $location )->getReadOnlyReason() !== false );
+               $lb = $this->getLoadBalancer( $location );
+               $domainId = $this->getDomainId( $lb->getServerInfo( $lb->getWriterIndex() ) );
+               return ( $lb->getReadOnlyReason( $domainId ) !== false );
        }
 
        /**