+ : (string)$domain->getDatabase();
+ }
+
+ /**
+ * @param string $domain
+ * @return string
+ * @deprecated Since 1.33; use getWikiIdFromDbDomain()
+ */
+ public static function getWikiIdFromDomain( $domain ) {
+ return self::getWikiIdFromDbDomain( $domain );
+ }
+
+ /**
+ * @return DatabaseDomain Database domain of the current wiki
+ * @since 1.33
+ */
+ public static function getCurrentWikiDbDomain() {
+ global $wgDBname, $wgDBmwschema, $wgDBprefix;
+ // Avoid invoking LBFactory to avoid any chance of recursion
+ return new DatabaseDomain( $wgDBname, $wgDBmwschema, (string)$wgDBprefix );
+ }
+
+ /**
+ * @param DatabaseDomain|string $domain
+ * @return bool Whether $domain matches the DB domain of the current wiki
+ * @since 1.33
+ */
+ public static function isCurrentWikiDbDomain( $domain ) {
+ return self::getCurrentWikiDbDomain()->equals( DatabaseDomain::newFromId( $domain ) );
+ }
+
+ /**
+ * @param string $wikiId
+ * @return bool Whether $wikiId matches the wiki ID of the current wiki
+ * @since 1.33
+ */
+ public static function isCurrentWikiId( $wikiId ) {
+ return ( self::getWikiIdFromDbDomain( self::getCurrentWikiDbDomain() ) === $wikiId );