Go to the documentation of this file.
85 $this->updateRecentChanges = $rc;
86 $this->sendToUDP = ( $udp ==
'UDP' );
96 $log_id = $dbw->nextSequenceValue(
'logging_log_id_seq' );
102 'log_type' => $this->
type,
103 'log_action' => $this->
action,
104 'log_timestamp' => $dbw->timestamp( $now ),
105 'log_user' => $this->doer->getId(),
106 'log_user_text' => $this->doer->getName(),
107 'log_namespace' => $this->target->getNamespace(),
108 'log_title' => $this->target->getDBkey(),
109 'log_page' => $this->target->getArticleID(),
113 $dbw->insert(
'logging', $data, __METHOD__ );
114 $newId = !is_null( $log_id ) ? $log_id : $dbw->insertId();
116 # And update recentchanges
117 if ( $this->updateRecentChanges ) {
121 $now, $titleObj, $this->doer, $this->
getRcComment(),
'',
122 $this->
type, $this->
action, $this->target, $this->comment,
125 } elseif ( $this->sendToUDP ) {
126 # Don't send private logs to UDP
127 if ( isset( $wgLogRestrictions[$this->
type] ) && $wgLogRestrictions[$this->type] !=
'*' ) {
131 # Notify external application via UDP.
132 # We send this to IRC but do not want to add it the RC table.
135 $now, $titleObj, $this->doer, $this->
getRcComment(),
'',
136 $this->type, $this->
action, $this->target, $this->comment,
139 $rc->notifyRCFeeds();
153 if ( $this->comment !=
'' ) {
154 if ( $rcComment ==
'' ) {
157 $rcComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
173 if ( $this->comment !=
'' ) {
174 if ( $rcComment ==
'' ) {
177 $rcComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
225 if ( isset( $wgLogNames[
$type] ) ) {
267 if ( is_null(
$skin ) ) {
269 $langObjOrNull =
null;
275 $key =
"$type/$action";
277 if ( isset( $wgLogActions[$key] ) ) {
278 if ( is_null(
$title ) ) {
279 $rv =
wfMessage( $wgLogActions[$key] )->inLanguage( $langObj )->escaped();
284 $rv =
wfMessage( $wgLogActions[$key] )->rawParams( $titleLink )
285 ->inLanguage( $langObj )->escaped();
288 array_unshift(
$params, $titleLink );
291 if ( preg_match(
'/^(block|suppress)\/(block|reblock)$/', $key ) ) {
297 $durationTooltip =
'‎' . htmlspecialchars(
$params[1] );
298 $params[1] =
"<span class='blockExpiry' title='$durationTooltip'>" .
307 } elseif (
$type ==
'protect' && count(
$params ) == 3 ) {
310 $details .=
$wgLang->getDirMark() . htmlspecialchars(
" {$params[1]}" );
312 $details .=
" {$params[1]}";
317 $text =
wfMessage(
'protect-summary-cascade' )
318 ->inLanguage( $langObj )->text();
320 $details .=
wfMessage(
'brackets', $text )->inLanguage( $langObj )->text();
326 ->inLanguage( $langObj )->escaped() . $details;
330 global $wgLogActionsHandlers;
332 if ( isset( $wgLogActionsHandlers[$key] ) ) {
333 $args = func_get_args();
334 $rv = call_user_func_array( $wgLogActionsHandlers[$key],
$args );
336 wfDebug(
"LogPage::actionText - unknown action $key\n" );
351 if ( $filterWikilinks ) {
352 $rv = str_replace(
'[[',
'', $rv );
353 $rv = str_replace(
']]',
'', $rv );
369 return $title->getPrefixedText();
376 htmlspecialchars(
$title->getPrefixedText() ),
378 array(
'redirect' =>
'no' )
383 if ( !$targetTitle ) {
384 # Workaround for broken database
394 if ( substr(
$title->getText(), 0, 1 ) ==
'#' ) {
395 $titleLink =
$title->getText();
407 $title->getPrefixedText(),
409 array(
'redirect' =>
'no' )
418 if (
$title->isSpecialPage() ) {
421 # Use the language name for log titles, rather than Log/X
422 if (
$name ==
'Log' ) {
423 $logPage =
new LogPage( $par );
426 ->inLanguage( $lang )
427 ->rawParams( $titleLink )
463 # Trim spaces on user supplied text
466 # Truncate for whole multibyte characters.
474 if (
$doer ===
null ) {
477 } elseif ( !is_object(
$doer ) ) {
484 $logEntry->setTarget(
$target );
485 $logEntry->setPerformer(
$doer );
486 $logEntry->setParameters(
$params );
490 $formatter->setContext( $context );
492 $this->
actionText = $formatter->getPlainActionText();
493 $this->ircActionText = $formatter->getIRCActionText();
506 public function addRelations( $field, $values, $logid ) {
507 if ( !strlen( $field ) || empty( $values ) ) {
515 'ls_field' => $field,
517 'ls_log_id' => $logid
522 $dbw->insert(
'log_search', $data, __METHOD__,
'IGNORE' );
534 return implode(
"\n",
$params );
544 if (
$blob ===
'' ) {
547 return explode(
"\n",
$blob );
565 $flagsCount = count(
$flags );
567 for ( $i = 0; $i < $flagsCount; $i++ ) {
571 return wfMessage(
'parentheses' )->inLanguage( $lang )
572 ->rawParams( $lang->commaList(
$flags ) )->escaped();
586 $messages[$flag] = htmlspecialchars( $flag );
596 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage( $lang );
598 if ( $msg->exists() ) {
615 if ( isset( $wgLogNames[$this->type] ) ) {
632 if ( isset( $wgLogHeaders[$this->type] ) ) {
647 global $wgLogRestrictions;
648 if ( isset( $wgLogRestrictions[$this->type] ) ) {
666 return $restriction !==
'' && $restriction !==
'*';
static newFromId( $id)
Static factory method for creation from a given user ID.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static validTypes()
Get the list of valid log types.
const TOOL_LINKS_NOBLOCK
Flags for userToolLinks()
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static getTitleLink( $type, $lang, $title, &$params)
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static formatBlockFlags( $flags, $lang)
Convert a comma-delimited list of block log flags into a more readable (and translated) form.
static extractParams( $blob)
Extract a parameter array from a blob.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
static newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
isRestricted()
Tells if this log is not viewable by all.
string $params
Blob made of a parameters array *.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
it s the revision text itself In either if gzip is the revision text is gzipped $flags
__construct( $type, $rc=true, $udp='skipUDP')
Constructor.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
getRestriction()
Returns the right needed to read this log type.
getComment()
Get the comment from the last addEntry() call.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static formatBlockFlag( $flag, $lang)
Translate a block log flag if possible.
static isLogType( $type)
Is $type a valid log type.
getDescription()
Description of this log type.
Class to simplify the use of log pages.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
getName()
Name of the log.
static newExtraneousContext(Title $title, $request=array())
Create a new extraneous context.
static notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getRcCommentIRC()
Get the RC comment from the last addEntry() call for IRC.
when a variable name is used in a it is silently declared as a new masking the global
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
static actionText( $type, $action, $title=null, $skin=null, $params=array(), $filterWikilinks=false)
Generate text for a log entry.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
addEntry( $action, $target, $comment, $params=array(), $doer=null)
Add a log entry.
string $action
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir' *.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
string $comment
Comment associated with action *.
static makeParamBlob( $params)
Create a blob from a parameter array.
User $doer
The user doing the action *.
getRcComment()
Get the RC comment from the last addEntry() call.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
string $type
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'.
addRelations( $field, $values, $logid)
Add relations to log_search table.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
static logHeader( $type)
Get the log header for the given log type.
string $ircActionText
Plaintext version of the message for IRC *.
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
static idFromName( $name)
Get database id given a user name.
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
string $actionText
Plaintext version of the message *.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Class for creating log entries manually, for example to inject them into the database.
static logName( $type)
Get the name for the given log type.
bool $updateRecentChanges
The User object encapsulates all of the user-specific settings (user_id, name, rights,...