function logToFile($msg, $file)
 {
     $header = '[' . date('d\\TH:i:s') . '] ' . wfHostname() . ' ' . posix_getpid();
     if ($this->slaveId !== false) {
         $header .= "({$this->slaveId})";
     }
     $header .= ' ' . wfWikiID();
     LegacyLogger::emit(sprintf("%-50s %s\n", $header, $msg), $file);
 }
Пример #2
0
}
// Process data & print results
if ($processor) {
    $processor->execute();
}
// Log what the user did, for book-keeping purposes.
$endtime = microtime(true);
// Log the request
if ($wgAPIRequestLog) {
    $items = array(wfTimestamp(TS_MW), $endtime - $starttime, $wgRequest->getIP(), $wgRequest->getHeader('User-agent'));
    $items[] = $wgRequest->wasPosted() ? 'POST' : 'GET';
    if ($processor) {
        try {
            $manager = $processor->getModuleManager();
            $module = $manager->getModule($wgRequest->getVal('action'), 'action');
        } catch (Exception $ex) {
            $module = null;
        }
        if (!$module || $module->mustBePosted()) {
            $items[] = "action=" . $wgRequest->getVal('action');
        } else {
            $items[] = wfArrayToCgi($wgRequest->getValues());
        }
    } else {
        $items[] = "failed in ApiBeforeMain";
    }
    LegacyLogger::emit(implode(',', $items) . "\n", $wgAPIRequestLog);
    wfDebug("Logged API request to {$wgAPIRequestLog}\n");
}
$mediawiki = new MediaWiki();
$mediawiki->doPostOutputShutdown('fast');