Replace several uses of wfWikiId() with WikiMap methods
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 29 Mar 2019 21:56:18 +0000 (14:56 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 29 Mar 2019 21:56:18 +0000 (14:56 -0700)
Also, reword some related comments.

Change-Id: I8aefa42f96b90e9ea871cf7ec1afcc7ed82a19b2

includes/api/ApiMain.php
includes/db/MWLBFactory.php

index 295d5d0..6faac96 100644 (file)
@@ -218,7 +218,7 @@ class ApiMain extends ApiBase {
                                                'cookies' => $sessionCookies,
                                                'ip' => $request->getIP(),
                                                'userAgent' => $this->getUserAgent(),
-                                               'wiki' => wfWikiID(),
+                                               'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
                                        ]
                                );
                        }
@@ -1633,7 +1633,7 @@ class ApiMain extends ApiBase {
                        'ts' => time(),
                        'ip' => $request->getIP(),
                        'userAgent' => $this->getUserAgent(),
-                       'wiki' => wfWikiID(),
+                       'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
                        'timeSpentBackend' => (int)round( $time * 1000 ),
                        'hadError' => $e !== null,
                        'errorCodes' => [],
@@ -1653,7 +1653,7 @@ class ApiMain extends ApiBase {
                                'method' => $request->getMethod(),
                                'client_ip' => $request->getIP()
                        ],
-                       'database' => wfWikiID(),
+                       'database' => WikiMap::getCurrentWikiDbDomain()->getId(),
                        'backend_time_ms' => (int)round( $time * 1000 ),
                ];
 
index fc5b18a..416993c 100644 (file)
@@ -243,8 +243,8 @@ abstract class MWLBFactory {
                        "\$wgDBservers has dbname='$srvDB' but \$wgDBname='$ldDB'. " .
                        "Set \$wgDBname to the database used by this wiki project. " .
                        "There is rarely a need to set 'dbname' in \$wgDBservers. " .
-                       "Functions like wfWikiId(), remote wiki database access, the use " .
-                       "of Database::getDomainId(), and other features are not reliable when " .
+                       "Cross-wiki database access, use of WikiMap::getCurrentWikiDbDomain(), " .
+                       "use of Database::getDomainId(), and other features are not reliable when " .
                        "\$wgDBservers does not match the local wiki database/prefix."
                );
                MWExceptionRenderer::output( $e, MWExceptionRenderer::AS_PRETTY );
@@ -260,8 +260,8 @@ abstract class MWLBFactory {
                        "\$wgDBservers has tablePrefix='$srvTP' but \$wgDBprefix='$ldTP'. " .
                        "Set \$wgDBprefix to the table prefix used by this wiki project. " .
                        "There is rarely a need to set 'tablePrefix' in \$wgDBservers. " .
-                       "Functions like wfWikiId(), remote wiki database access, the use " .
-                       "of Database::getDomainId(), and other features are not reliable when " .
+                       "Cross-wiki database access, use of WikiMap::getCurrentWikiDbDomain(), " .
+                       "use of Database::getDomainId(), and other features are not reliable when " .
                        "\$wgDBservers does not match the local wiki database/prefix."
                );
                MWExceptionRenderer::output( $e, MWExceptionRenderer::AS_PRETTY );