use DateTimeZone;
use Exception;
+use WikiMap;
use MWDebug;
use MWExceptionHandler;
use Psr\Log\AbstractLogger;
$date = $d->format( 'D M j G:i:s T Y' );
$host = wfHostname();
- $wiki = wfWikiID();
+ $wiki = WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() );
$text = "{$date}\t{$host}\t{$wiki}\t{$message}\n";
return $text;
*/
protected static function formatAsWfDebugLog( $channel, $message, $context ) {
$time = wfTimestamp( TS_DB );
- $wiki = wfWikiID();
+ $wiki = WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() );
$host = wfHostname();
$text = "{$time} {$host} {$wiki}: {$message}\n";
return $text;
namespace MediaWiki\Logger\Monolog;
+use WikiMap;
+
/**
* Annotate log records with request-global metadata, such as the hostname,
* wiki / request ID, and MediaWiki version.
public function __invoke( array $record ) {
global $wgVersion;
$record['extra']['host'] = wfHostname();
- $record['extra']['wiki'] = wfWikiID();
+ $record['extra']['wiki'] = WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() );
$record['extra']['mwversion'] = $wgVersion;
$record['extra']['reqId'] = \WebRequest::getRequestId();
if ( wfIsCLI() && isset( $_SERVER['argv'] ) ) {
$packet['server_name'] = $wgServerName;
$packet['server_script_path'] = $wgScriptPath ?: '/';
- $packet['wiki'] = wfWikiID();
+ $packet['wiki'] = WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() );
return $this->formatArray( $packet );
}
$this->isAnon() ? [ 'user_ip' => $this->getName() ] : [ 'user_id' => $this->getId() ],
__METHOD__ );
$rev = $timestamp ? Revision::loadFromTimestamp( $dbr, $utp, $timestamp ) : null;
- return [ [ 'wiki' => wfWikiID(), 'link' => $utp->getLocalURL(), 'rev' => $rev ] ];
+ return [
+ [
+ 'wiki' => WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() ),
+ 'link' => $utp->getLocalURL(),
+ 'rev' => $rev
+ ]
+ ];
}
/**