85 $this->updateRecentChanges = $rc;
86 $this->sendToUDP = ( $udp ==
'UDP' );
96 $log_id = $dbw->nextSequenceValue(
'logging_log_id_seq' );
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() .
228 $params = [], $filterWikilinks =
false
232 if ( is_null(
$skin ) ) {
234 $langObjOrNull = null;
240 $key =
"$type/$action";
242 if ( isset( $wgLogActions[$key] ) ) {
243 if ( is_null(
$title ) ) {
244 $rv =
wfMessage( $wgLogActions[$key] )->inLanguage( $langObj )->escaped();
249 $rv =
wfMessage( $wgLogActions[$key] )->rawParams( $titleLink )
250 ->inLanguage( $langObj )->escaped();
252 array_unshift(
$params, $titleLink );
255 ->inLanguage( $langObj )->escaped();
261 if ( isset( $wgLogActionsHandlers[$key] ) ) {
262 $args = func_get_args();
263 $rv = call_user_func_array( $wgLogActionsHandlers[$key],
$args );
265 wfDebug(
"LogPage::actionText - unknown action $key\n" );
280 if ( $filterWikilinks ) {
281 $rv = str_replace(
'[[',
'', $rv );
282 $rv = str_replace(
']]',
'', $rv );
298 return $title->getPrefixedText();
301 if (
$title->isSpecialPage() ) {
304 # Use the language name for log titles, rather than Log/X
305 if (
$name ==
'Log' ) {
306 $logPage =
new LogPage( $par );
309 ->inLanguage(
$lang )
310 ->rawParams( $titleLink )
345 # Trim spaces on user supplied text
348 # Truncate for whole multibyte characters.
356 if (
$doer === null ) {
359 } elseif ( !is_object(
$doer ) ) {
366 $logEntry->setTarget(
$target );
367 $logEntry->setPerformer(
$doer );
368 $logEntry->setParameters(
$params );
372 $logEntry->setLegacy(
true );
374 $formatter = LogFormatter::newFromEntry( $logEntry );
378 $this->
actionText = $formatter->getPlainActionText();
379 $this->ircActionText = $formatter->getIRCActionText();
393 if ( !strlen( $field ) || empty( $values ) ) {
401 'ls_field' => $field,
403 'ls_log_id' => $logid
408 $dbw->insert(
'log_search', $data, __METHOD__,
'IGNORE' );
420 return implode(
"\n",
$params );
430 if (
$blob ===
'' ) {
433 return explode(
"\n",
$blob );
446 if ( isset( $wgLogNames[$this->
type] ) ) {
463 if ( isset( $wgLogHeaders[$this->
type] ) ) {
479 if ( isset( $wgLogRestrictions[$this->
type] ) ) {
497 return $restriction !==
'' && $restriction !==
'*';
static makeParamBlob($params)
Create a blob from a parameter array.
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
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
getRestriction()
Returns the right needed to read this log type.
static actionText($type, $action, $title=null, $skin=null, $params=[], $filterWikilinks=false)
Generate text for a log entry.
bool $updateRecentChanges
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
addRelations($field, $values, $logid)
Add relations to log_search table.
string $ircActionText
Plaintext version of the message for IRC.
if(!isset($args[0])) $lang
static newFromId($id)
Static factory method for creation from a given user ID.
string $type
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'.
$wgLogActions
Lists the message key string for formatting individual events of each type and action when listed in ...
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
when a variable name is used in a it is silently declared as a new local masking the global
$wgLogNames
Lists the message key string for each log type.
static extractParams($blob)
Extract a parameter array from a blob.
User $doer
The user doing the action.
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
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
Class to simplify the use of log pages.
isRestricted()
Tells if this log is not viewable by all.
addEntry($action, $target, $comment, $params=[], $doer=null)
Add a log entry.
static notifyLog($timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC= '')
getRcCommentIRC()
Get the RC comment from the last addEntry() call for IRC.
getDescription()
Description of this log type.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
static getTitleLink($type, $lang, $title, &$params)
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
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 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 after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation 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 unsetoffset-wrap String Wrap the message in html(usually something like"<
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
string $actionText
Plaintext version of the message.
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 isLogType($type)
Is $type a valid log type.
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
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
__construct($type, $rc=true, $udp= 'skipUDP')
Constructor.
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
Class for creating log entries manually, to inject them into the database.
static resolveAlias($alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
getRcComment()
Get the RC comment from the last addEntry() call.
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type...
string $params
Blob made of a parameters array.
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 local content language as $wgContLang
getName()
Name of the log.
string $action
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'.
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
static newLogEntry($timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC= '', $revId=0, $isPatrollable=false)
static validTypes()
Get the list of valid log types.
string $comment
Comment associated with action.
getComment()
Get the comment from the last addEntry() call.
Allows to change the fields on the form that will be generated $name