/** * Constructs a new formatter suitable for given entry. * @param LogEntry $entry * @return LogFormatter */ public static function newFromEntry(LogEntry $entry) { global $wgLogActionsHandlers; $fulltype = $entry->getFullType(); $wildcard = $entry->getType() . '/*'; $handler = ''; if (isset($wgLogActionsHandlers[$fulltype])) { $handler = $wgLogActionsHandlers[$fulltype]; } elseif (isset($wgLogActionsHandlers[$wildcard])) { $handler = $wgLogActionsHandlers[$wildcard]; } if ($handler !== '' && is_string($handler) && class_exists($handler)) { return new $handler($entry); } return new LegacyLogFormatter($entry); }
public function logIt(LogEntry $entry) { $type = $entry->getType(); $message = $entry->getMessage(); $userID = $entry->getUserID(); $db = Database::getInstance(); if (!$db->isConnected()) { return false; } $message = $db->escapeString($message); $results = $db->insertData('systemLog', 'message, type, userID', '\'' . $message . '\', \'' . $type . '\', \'' . $userID . '\''); if (!$results) { return false; } return true; }