Go to the documentation of this file.
35 parent::__construct(
$query, $moduleName,
'le' );
47 $prop = array_flip(
$params[
'prop'] );
49 $this->fld_ids = isset( $prop[
'ids'] );
50 $this->fld_title = isset( $prop[
'title'] );
51 $this->fld_type = isset( $prop[
'type'] );
52 $this->fld_action = isset( $prop[
'action'] );
53 $this->fld_user = isset( $prop[
'user'] );
54 $this->fld_userid = isset( $prop[
'userid'] );
55 $this->fld_timestamp = isset( $prop[
'timestamp'] );
56 $this->fld_comment = isset( $prop[
'comment'] );
57 $this->fld_parsedcomment = isset( $prop[
'parsedcomment'] );
58 $this->fld_details = isset( $prop[
'details'] );
59 $this->fld_tags = isset( $prop[
'tags'] );
62 if ( $hideLogs !==
false ) {
69 'user' =>
array(
'LEFT JOIN',
71 'page' =>
array(
'LEFT JOIN',
72 array(
'log_namespace=page_namespace',
73 'log_title=page_title' ) ) ) );
84 $this->
addFieldsIf(
array(
'log_user',
'log_user_text',
'user_name' ), $this->fld_user );
85 $this->
addFieldsIf(
'log_user', $this->fld_userid );
87 array(
'log_namespace',
'log_title' ),
88 $this->fld_title || $this->fld_parsedcomment
90 $this->
addFieldsIf(
'log_comment', $this->fld_comment || $this->fld_parsedcomment );
91 $this->
addFieldsIf(
'log_params', $this->fld_details );
93 if ( $this->fld_tags ) {
99 if ( !is_null(
$params[
'tag'] ) ) {
102 array(
'log_id=ct_log_id' ) ) ) );
106 if ( !is_null(
$params[
'action'] ) ) {
109 $logAction =
$params[
'action'];
110 if ( strpos( $logAction,
'/' ) ===
false ) {
115 list(
$type, $action ) = explode(
'/', $logAction, 2 );
116 $valid = isset( $logActions[$logAction] ) || isset( $logActions[
$type .
'/*'] );
122 "Unrecognized value for parameter '$valueName': {$logAction}",
129 } elseif ( !is_null(
$params[
'type'] ) ) {
142 if ( !is_null(
$params[
'continue'] ) ) {
143 $cont = explode(
'|',
$params[
'continue'] );
145 $op = (
$params[
'dir'] ===
'newer' ?
'>' :
'<' );
146 $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
147 $continueId = (int)$cont[1];
149 $this->
addWhere(
"log_timestamp $op $continueTimestamp OR " .
150 "(log_timestamp = $continueTimestamp AND " .
151 "log_id $op= $continueId)"
159 if ( !is_null(
$user ) ) {
169 if ( !is_null(
$title ) ) {
171 if ( is_null( $titleObj ) ) {
172 $this->
dieUsage(
"Bad title value '$title'",
'param_title' );
174 $this->
addWhereFld(
'log_namespace', $titleObj->getNamespace() );
175 $this->
addWhereFld(
'log_title', $titleObj->getDBkey() );
180 if ( !is_null( $prefix ) ) {
182 if ( $wgMiserMode ) {
183 $this->
dieUsage(
'Prefix search disabled in Miser Mode',
'prefixsearchdisabled' );
187 if ( is_null(
$title ) ) {
188 $this->
dieUsage(
"Bad title value '$prefix'",
'param_prefix' );
191 $this->
addWhere(
'log_title ' . $db->buildLike(
$title->getDBkey(), $db->anyString() ) );
196 if ( !$this->
getUser()->isAllowed(
'deletedhistory' ) ) {
199 } elseif ( !$this->
getUser()->isAllowed(
'suppressrevision' ) ) {
206 if ( !is_null(
$title ) && $titleBits ) {
207 $this->
addWhere( $db->bitAnd(
'log_deleted', $titleBits ) .
" != $titleBits" );
209 if ( !is_null(
$user ) && $userBits ) {
210 $this->
addWhere( $db->bitAnd(
'log_deleted', $userBits ) .
" != $userBits" );
217 foreach (
$res as $row ) {
249 $action, $ts, $legacy =
false
257 $targetKey =
'4::target';
258 $noredirKey =
'5::noredir';
261 if ( isset(
$params[$targetKey] ) ) {
266 $vals[
$type] = $vals2;
270 $vals[
$type][
'suppressedredirect'] =
'';
286 $vals2[
'prev'] =
$params[$prev];
287 $vals2[
'auto'] =
$params[$auto];
288 $vals[
$type] = $vals2;
296 $vals2[
'new'] = implode(
', ',
$params[
'5::newgroups'] );
297 $vals2[
'old'] = implode(
', ',
$params[
'4::oldgroups'] );
299 $vals[
$type] = $vals2;
303 if ( $action ==
'unblock' ) {
307 list( $vals2[
'duration'], $vals2[
'flags'] ) =
$params;
314 $vals[
$type] = $vals2;
318 if ( isset(
$params[
'img_timestamp'] ) ) {
324 $logParams =
array();
327 if ( strpos( $key,
':' ) ===
false ) {
328 $logParams[$key] =
$value;
331 $logParam = explode(
':', $key, 3 );
332 $logParams[$logParam[2]] =
$value;
334 $result->setIndexedTagName( $logParams,
'param' );
335 $result->setIndexedTagName_recursive( $logParams,
'param' );
336 $vals = array_merge( $vals, $logParams );
348 if ( $this->fld_ids ) {
349 $vals[
'logid'] = intval( $row->log_id );
352 if ( $this->fld_title || $this->fld_parsedcomment ) {
356 if ( $this->fld_title || $this->fld_ids || $this->fld_details && $row->log_params !==
'' ) {
358 $vals[
'actionhidden'] =
'';
362 if ( $this->fld_title ) {
365 if ( $this->fld_ids ) {
366 $vals[
'pageid'] = intval( $row->page_id );
368 if ( $this->fld_details && $row->log_params !==
'' ) {
372 $logEntry->getParameters(),
373 $logEntry->getType(),
374 $logEntry->getSubtype(),
375 $logEntry->getTimestamp(),
376 $logEntry->isLegacy()
382 if ( $this->fld_type || $this->fld_action ) {
383 $vals[
'type'] = $row->log_type;
384 $vals[
'action'] = $row->log_action;
387 if ( $this->fld_user || $this->fld_userid ) {
389 $vals[
'userhidden'] =
'';
393 if ( $this->fld_user ) {
394 $vals[
'user'] = $row->user_name ===
null ? $row->log_user_text : $row->user_name;
396 if ( $this->fld_userid ) {
397 $vals[
'userid'] = $row->log_user;
400 if ( !$row->log_user ) {
405 if ( $this->fld_timestamp ) {
409 if ( ( $this->fld_comment || $this->fld_parsedcomment ) && isset( $row->log_comment ) ) {
411 $vals[
'commenthidden'] =
'';
415 if ( $this->fld_comment ) {
416 $vals[
'comment'] = $row->log_comment;
419 if ( $this->fld_parsedcomment ) {
425 if ( $this->fld_tags ) {
426 if ( $row->ts_tags ) {
427 $tags = explode(
',', $row->ts_tags );
428 $this->
getResult()->setIndexedTagName( $tags,
'tag' );
429 $vals[
'tags'] = $tags;
431 $vals[
'tags'] =
array();
436 $vals[
'suppressed'] =
'';
443 global $wgLogActions, $wgLogActionsHandlers;
445 return array_keys( array_merge( $wgLogActions, $wgLogActionsHandlers ) );
452 if ( !is_null(
$params[
'prop'] ) && in_array(
'parsedcomment',
$params[
'prop'] ) ) {
454 return 'anon-public-user-private';
460 return 'anon-public-user-private';
526 'Which properties to get',
527 ' ids - Adds the ID of the log event',
528 ' title - Adds the title of the page for the log event',
529 ' type - Adds the type of log event',
530 ' user - Adds the user responsible for the log event',
531 ' userid - Adds the user ID who was responsible for the log event',
532 ' timestamp - Adds the timestamp for the event',
533 ' comment - Adds the comment of the event',
534 ' parsedcomment - Adds the parsed comment of the event',
535 ' details - Lists additional details about the event',
536 ' tags - Lists tags for the event',
538 'type' =>
'Filter log entries to only this type',
540 "Filter log actions to only this action. Overrides {$p}type",
541 "Wildcard actions like 'action/*' allows to specify any string for the asterisk"
543 'start' =>
'The timestamp to start enumerating from',
544 'end' =>
'The timestamp to end enumerating',
546 'user' =>
'Filter entries to those made by the given user',
547 'title' =>
'Filter entries to those related to a page',
548 'prefix' =>
'Filter entries that start with this prefix. Disabled in Miser Mode',
549 'limit' =>
'How many total event entries to return',
550 'tag' =>
'Only list event entries tagged with this tag',
551 'continue' =>
'When more results are available, use this to continue',
560 'logid' =>
'integer',
561 'pageid' =>
'integer'
574 'actionhidden' =>
'boolean'
577 'userhidden' =>
'boolean',
585 'userhidden' =>
'boolean',
592 'timestamp' =>
array(
593 'timestamp' =>
'timestamp'
596 'commenthidden' =>
'boolean',
602 'parsedcomment' =>
array(
603 'commenthidden' =>
'boolean',
604 'parsedcomment' =>
array(
613 return 'Get events from logs.';
617 return array_merge( parent::getPossibleErrors(),
array(
618 array(
'code' =>
'param_user',
'info' =>
'User name $user not found' ),
619 array(
'code' =>
'param_title',
'info' =>
'Bad title value \'title\'' ),
620 array(
'code' =>
'param_prefix',
'info' =>
'Bad title value \'prefix\'' ),
621 array(
'code' =>
'prefixsearchdisabled',
'info' =>
'Prefix search disabled in Miser Mode' ),
627 'api.php?action=query&list=logevents'
632 return 'https://www.mediawiki.org/wiki/API:Logevents';
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
addFields( $value)
Add a set of fields to select to the internal array.
getDescription()
Returns the description string for this module.
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 addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy=false)
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getResult()
Get the result object.
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
getDirectionDescription( $p='', $extraDirText='')
Gets the personalised direction parameter description.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
static formatComment( $comment, $title=null, $local=false)
This function is called by all recent changes variants, by the page history, and by the user contribu...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
getUser()
Get the User object.
Query action to List the log events, with optional filtering by various parameters.
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
static newFromRow( $row)
Constructs new LogEntry from database result row.
getAllowedParams( $flags=0)
This is a base class for all Query modules.
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
getDB()
Get the Query database connection (read-only)
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
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
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
addWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, and an ORDER BY clause to sort in the right direction.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
presenting them properly to the user as errors is done by the caller $title
dieContinueUsageIf( $condition)
Die with the $prefix.
getExamples()
Returns usage examples for this module.
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
__construct( $query, $moduleName)
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
static sanitizeIP( $ip)
Convert an IP into a verbose, uppercase, normalized form.
getParamDescription()
Returns an array of parameter descriptions.
static idFromName( $name)
Get database id given a user name.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
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
static userCan( $row, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static isDeleted( $row, $field)
static parseExpiryInput( $expiry)
Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute ("24 May 2034",...
getModuleName()
Get the name of the module being executed by this instance.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
userCanSeeRevDel()
Check whether the current user has permission to view revision-deleted fields.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.