76 $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->
getUser() );
87 if ( $this->linkRenderer !==
null ) {
90 return MediaWikiServices::getInstance()->getLinkRenderer();
110 public function showOptions( $types = [], $user =
'', $page =
'', $pattern =
false, $year = 0,
111 $month = 0, $day = 0, $filter =
null, $tagFilter =
'', $action =
null
114 $types = ( $types ===
'' ) ? [] : (
array)$types;
129 is_array( $extraInputsDescriptor ) &&
130 !empty( $extraInputsDescriptor )
134 is_string( $extraInputsDescriptor ) &&
135 $extraInputsDescriptor !==
''
138 $extraInputsString = $extraInputsDescriptor;
139 wfDeprecated(
'$input in LogEventsListGetExtraInputs hook',
'1.32' );
143 if ( !$this->
getConfig()->
get(
'MiserMode' ) ) {
150 'label-message' =>
'date',
151 'default' => sprintf(
"%04d-%02d-%02d", $year, $month, $day ),
156 'type' =>
'tagfilter',
157 'name' =>
'tagfilter',
158 'label-raw' => $this->
msg(
'tag-filter' )->parse(),
169 $this->allowedActions !==
null &&
170 count( $this->allowedActions ) > 0
176 $context->setTitle( SpecialPage::getTitleFor(
'Log' ) );
179 ->setSubmitText( $this->
msg(
'logeventslist-submit' )->
text() )
181 ->setWrapperLegendMsg(
'log' );
184 if ( isset( $extraInputsString ) ) {
185 $htmlForm->addFooterText( Html::rawElement(
192 $htmlForm->prepareForm()->displayForm(
false );
202 foreach ( $filter as
$type => $val ) {
203 $message = $this->
msg(
"logeventslist-{$type}-log" );
205 if ( !$message->exists() ) {
206 $message = $this->
msg(
"log-show-hide-{$type}" )->params( $this->
msg(
'show' )->
text() );
210 if ( $val ===
false ) {
215 'class' =>
'HTMLMultiSelectField',
216 'label-message' =>
'logeventslist-more-filters',
219 'default' => $default,
224 if ( !isset( $this->mDefaultQuery ) ) {
225 $this->mDefaultQuery = $this->
getRequest()->getQueryValues();
226 unset( $this->mDefaultQuery[
'title'] );
227 unset( $this->mDefaultQuery[
'dir'] );
228 unset( $this->mDefaultQuery[
'offset'] );
229 unset( $this->mDefaultQuery[
'limit'] );
230 unset( $this->mDefaultQuery[
'order'] );
231 unset( $this->mDefaultQuery[
'month'] );
232 unset( $this->mDefaultQuery[
'year'] );
243 $queryType = count( $queryTypes ) == 1 ? $queryTypes[0] :
'';
249 $restriction = $page->getRestriction();
250 if ( $this->
getUser()->isAllowed( $restriction ) ) {
251 $typesByName[
$type] = $page->getName()->text();
256 asort( $typesByName );
259 $public = $typesByName[
''];
260 unset( $typesByName[
''] );
261 $typesByName = [
'' => $public ] + $typesByName;
264 'class' =>
'HTMLSelectField',
266 'options' => array_flip( $typesByName ),
267 'default' => $queryType,
277 'class' =>
'HTMLUserTextField',
278 'label-message' =>
'specialloguserlabel',
290 'class' =>
'HTMLTitleTextField',
291 'label-message' =>
'speciallogtitlelabel',
304 'label-message' =>
'log-title-wildcard',
314 if ( count( $types ) == 1 ) {
315 if ( $types[0] ==
'suppress' ) {
318 'label-message' =>
'revdelete-offender',
319 'name' =>
'offender',
343 $actionOptions[
'log-action-filter-all' ] =
'';
345 foreach ( $this->allowedActions as
$value ) {
346 $msgKey =
'log-action-filter-' . $types[0] .
'-' .
$value;
347 $actionOptions[ $msgKey ] =
$value;
351 'class' =>
'HTMLSelectField',
353 'options-messages' => $actionOptions,
354 'default' => $action,
355 'label' => $this->
msg(
'log-action-filter-' . $types[0] )->text(),
366 $this->allowedActions = $actions;
390 $formatter->setContext( $this->
getContext() );
392 $formatter->setShowUserToolLinks( !( $this->flags & self::NO_EXTRA_USER_LINKS ) );
395 $entry->getTimestamp(), $this->getUser() ) );
397 $action = $formatter->getActionText();
399 if ( $this->flags & self::NO_ACTION_LINK ) {
402 $revert = $formatter->getActionLinks();
404 $revert =
'<span class="mw-logevent-actionlink">' .
$revert .
'</span>';
408 $comment = $formatter->getComment();
414 list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow(
419 $classes = array_merge(
420 [
'mw-logline-' . $entry->getType() ],
424 'data-mw-logid' => $entry->getId(),
425 'data-mw-logaction' => $entry->getFullType(),
427 $ret =
"$del $time $action $comment $revert $tagDisplay";
430 Hooks::run(
'LogEventsListLineEnding', [ $this, &
$ret, $entry, &$classes, &
$attribs ] );
432 [ Sanitizer::class,
'isReservedDataAttribute' ],
435 $attribs[
'class'] = implode(
' ', $classes );
446 if ( $this->flags == self::NO_ACTION_LINK ) {
453 if ( $this->flags & self::USE_CHECKBOXES && $this->showTagEditUI ) {
457 [
'name' =>
'ids[' . $row->log_id .
']' ]
462 if ( $row->log_type ==
'suppress' ) {
468 if ( $user->isAllowed(
'deletedhistory' ) ) {
469 $canHide = $user->isAllowed(
'deletelogentry' );
470 $canViewSuppressedOnly = $user->isAllowed(
'viewsuppressed' ) &&
471 !$user->isAllowed(
'suppressrevision' );
473 $canViewThisSuppressedEntry = $canViewSuppressedOnly && $entryIsSuppressed;
474 if ( $row->log_deleted || $canHide ) {
476 if ( $canHide && $this->flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry ) {
479 $del = Xml::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
484 [
'name' =>
'ids[' . $row->log_id .
']' ]
493 'target' => SpecialPage::getTitleFor(
'Log', $row->log_type )->getPrefixedDBkey(),
495 'ids' => $row->log_id,
500 $canHide && !$canViewThisSuppressedEntry
518 $match = is_array(
$type ) ?
519 in_array( $row->log_type,
$type ) : $row->log_type ==
$type;
521 $match = is_array( $action ) ?
522 in_array( $row->log_action, $action ) : $row->log_action == $action;
523 if ( $match && $right ) {
525 $match = $wgUser->isAllowed( $right );
541 public static function userCan( $row, $field,
User $user =
null ) {
556 if ( $bitfield & $field ) {
557 if ( $user ===
null ) {
562 $permissions = [
'suppressrevision',
'viewsuppressed' ];
564 $permissions = [
'deletedhistory' ];
566 $permissionlist = implode(
', ', $permissions );
567 wfDebug(
"Checking for $permissionlist due to $field match on $bitfield\n" );
568 return $user->isAllowedAny( ...$permissions );
582 if ( $user ===
null ) {
586 $logRestrictions = MediaWikiServices::getInstance()->getMainConfig()->get(
'LogRestrictions' );
587 if ( isset( $logRestrictions[
$type] ) && !$user->isAllowed( $logRestrictions[
$type] ) ) {
599 return ( $row->log_deleted & $field ) == $field;
628 &
$out, $types = [], $page =
'', $user =
'', $param = []
630 $defaultParameters = [
633 'showIfEmpty' =>
true,
637 'useRequestParams' =>
false,
638 'useMaster' =>
false,
639 'extraUrlParams' =>
false,
641 # The + operator appends elements of remaining keys from the right
642 # handed array to the left handed, whereas duplicated keys are NOT overwritten.
643 $param += $defaultParameters;
644 # Convert $param array to individual variables
645 $lim = $param[
'lim'];
646 $conds = $param[
'conds'];
647 $showIfEmpty = $param[
'showIfEmpty'];
648 $msgKey = $param[
'msgKey'];
649 $wrap = $param[
'wrap'];
651 $extraUrlParams = $param[
'extraUrlParams'];
653 $useRequestParams = $param[
'useRequestParams'];
654 if ( !is_array( $msgKey ) ) {
655 $msgKey = [ $msgKey ];
661 $context = RequestContext::getMain();
665 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
667 # Insert list of top 50 (or top $lim) items
669 $pager =
new LogPager( $loglist, $types, $user, $page,
'', $conds );
670 if ( !$useRequestParams ) {
671 # Reset vars that may have been taken from the request
673 $pager->mDefaultLimit = 50;
674 $pager->mOffset =
"";
675 $pager->mIsBackwards =
false;
678 if ( $param[
'useMaster'] ) {
681 if ( isset( $param[
'offset'] ) ) { # Tell pager to ignore
WebRequest offset
682 $pager->setOffset( $param[
'offset'] );
686 $pager->mLimit = $lim;
689 $logBody = $pager->getBody();
690 $numRows = $pager->getNumRows();
699 $s = Xml::openElement(
'div', [
700 'class' =>
"mw-warning-with-logexcerpt mw-content-$dir",
705 if ( count( $msgKey ) == 1 ) {
709 array_shift(
$args );
713 $s .= $loglist->beginLogEventsList() .
715 $loglist->endLogEventsList();
716 } elseif ( $showIfEmpty ) {
717 $s = Html::rawElement(
'div', [
'class' =>
'mw-warning-logempty' ],
721 if ( $numRows > $pager->mLimit ) { # Show
"Full log" link
723 if ( $page instanceof
Title ) {
724 $urlParam[
'page'] = $page->getPrefixedDBkey();
725 } elseif ( $page !=
'' ) {
726 $urlParam[
'page'] = $page;
730 $urlParam[
'user'] =
$user;
733 if ( !is_array( $types ) ) { # Make it an
array,
if it isn
't
737 # If there is exactly one log type, we can link to Special:Log?type=foo
738 if ( count( $types ) == 1 ) {
739 $urlParam['type'] = $types[0];
742 if ( $extraUrlParams !== false ) {
743 $urlParam = array_merge( $urlParam, $extraUrlParams );
746 $s .= $linkRenderer->makeKnownLink(
747 SpecialPage::getTitleFor( 'Log
' ),
748 $context->msg( 'log-fulllog
' )->text(),
754 if ( $logBody && $msgKey[0] ) {
758 if ( $wrap != '' ) { // Wrap message in html
759 $s = str_replace( '$1', $s, $wrap );
762 /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */
763 if ( Hooks::run(
'LogEventsListShowLogExtract', [ &
$s, $types, $page, $user, $param ] ) ) {
786 if ( $audience !=
'public' && $user ===
null ) {
796 if ( $audience ==
'public' || !$user->isAllowed( $right ) ) {
797 $hiddenLogs[] = $logType;
800 if ( count( $hiddenLogs ) == 1 ) {
801 return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
802 } elseif ( $hiddenLogs ) {
803 return 'log_type NOT IN (' . $db->makeList( $hiddenLogs ) .
')';
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
static newFromRow( $row)
Constructs new LogEntry from database result row.
An IContextSource implementation which will inherit context from another source but allow individual ...
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
LinkRenderer null $linkRenderer
static typeAction( $row, $type, $action, $right='')
const NO_EXTRA_USER_LINKS
getTitlePatternDesc( $pattern)
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
showOptions( $types=[], $user='', $page='', $pattern=false, $year=0, $month=0, $day=0, $filter=null, $tagFilter='', $action=null)
Show options for the log list.
getExtraInputsDesc( $types)
getTitleInputDesc( $title)
static userCan( $row, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
__construct( $context, $linkRenderer=null, $flags=0)
The first two parameters used to be $skin and $out, but now only a context is needed,...
setAllowedActions( $actions)
Sets the action types allowed for log filtering To one action type may correspond several log_actions...
getTypeMenuDesc( $queryTypes)
static userCanViewLogType( $type, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
getActionSelectorDesc( $types, $action)
Drop down menu for selection of actions that can be used to filter the log.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static isDeleted( $row, $field)
Class to simplify the use of log pages.
static validTypes()
Get the list of valid log types.
This class should be covered by a general architecture document which does not exist as of January 20...
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
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
see documentation in includes Linker php for Linker::makeImageLink & $time
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
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 & $options
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template to be included in the link
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 & $ret
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
returning false will NOT prevent logging a wrapping ErrorException instead of letting the login form give the generic error message that the account does not exist For when the account has been renamed or deleted or an array to pass a message key and parameters create2 Corresponds to logging log_action database field and which is displayed in the UI & $revert
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 & $attribs
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
processing should stop and the error should be shown to the user * false
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 local account $user
Interface for objects which can provide a MediaWiki context on request.
msg( $key)
This is the method for getting translated interface messages.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
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
if(is_array($mode)) switch( $mode) $input
if(!isset( $args[0])) $lang