87 if ( $this->linkRenderer !==
null ) {
90 return MediaWikiServices::getInstance()->getLinkRenderer();
108 public function showOptions( $types = [], $user =
'', $page =
'', $pattern =
'', $year = 0,
109 $month = 0, $filter =
null, $tagFilter =
'', $action =
null
113 $title = SpecialPage::getTitleFor(
'Log' );
116 $types = ( $types ===
'' ) ? [] : (
array)$types;
120 $html = Html::hidden(
'title', $title->getPrefixedDBkey() );
134 $html .= Xml::tags(
'p',
null, Xml::dateMenu( (
int)$year, (
int)$month ) );
137 if ( $tagSelector ) {
138 $html .= Xml::tags(
'p',
null, implode(
' ', $tagSelector ) );
147 if ( $action !==
null ) {
152 $html .= Xml::submitButton( $this->
msg(
'logeventslist-submit' )->
text() );
169 $messages = [ $this->
msg(
'show' )->text(), $this->
msg(
'hide' )->text() ];
174 foreach ( $filter as
$type => $val ) {
178 $queryKey =
"hide_{$type}_log";
180 $hideVal = 1 - intval( $val );
181 $query[$queryKey] = $hideVal;
191 $links[
$type] = $this->
msg(
"log-show-hide-{$type}" )->rawParams(
$link )->escaped();
192 $hiddens .= Html::hidden(
"hide_{$type}_log", $val ) .
"\n";
196 return '<small>' . $this->
getLanguage()->pipeList( $links ) .
'</small>' . $hiddens;
200 if ( !isset( $this->mDefaultQuery ) ) {
201 $this->mDefaultQuery = $this->
getRequest()->getQueryValues();
202 unset( $this->mDefaultQuery[
'title'] );
203 unset( $this->mDefaultQuery[
'dir'] );
204 unset( $this->mDefaultQuery[
'offset'] );
205 unset( $this->mDefaultQuery[
'limit'] );
206 unset( $this->mDefaultQuery[
'order'] );
207 unset( $this->mDefaultQuery[
'month'] );
208 unset( $this->mDefaultQuery[
'year'] );
219 $queryType = count( $queryTypes ) == 1 ? $queryTypes[0] :
'';
236 $restriction = $page->getRestriction();
237 if ( $this->
getUser()->isAllowed( $restriction ) ) {
238 $typesByName[
$type] = $page->getName()->text();
243 asort( $typesByName );
246 $public = $typesByName[
''];
247 unset( $typesByName[
''] );
248 $typesByName = [
'' => $public ] + $typesByName;
251 foreach ( $typesByName as
$type => $name ) {
252 $select->addOption( $name,
$type );
263 $label = Xml::inputLabel(
264 $this->
msg(
'specialloguserlabel' )->
text(),
269 [
'class' =>
'mw-autocomplete-user' ]
272 return '<span class="mw-input-with-label">' . $label .
'</span>';
280 $label = Xml::inputLabel(
281 $this->
msg(
'speciallogtitlelabel' )->
text(),
288 return '<span class="mw-input-with-label">' . $label .
'</span>';
296 return '<span class="mw-input-with-label">' .
297 Xml::checkLabel( $this->
msg(
'log-title-wildcard' )->
text(),
'pattern',
'pattern', $pattern ) .
306 if ( count( $types ) == 1 ) {
307 if ( $types[0] ==
'suppress' ) {
308 $offender = $this->
getRequest()->getVal(
'offender' );
310 if ( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
313 return Xml::inputLabel( $this->
msg(
'revdelete-offender' )->
text(),
'offender',
314 'mw-log-offender', 20, $offender );
318 Hooks::run(
'LogEventsListGetExtraInputs', [ $types[0], $this, &
$input ] );
334 if ( $this->allowedActions ===
null || !count( $this->allowedActions ) ) {
339 'action-filter-' .$types[0] ) .
"\n";
341 $select->addOption(
wfMessage(
'log-action-filter-all' )->
text(),
'' );
342 foreach ( $this->allowedActions as
$value ) {
343 $msgKey =
'log-action-filter-' . $types[0] .
'-' .
$value;
346 $select->setDefault( $action );
347 $html .= $select->getHTML();
358 $this->allowedActions = $actions;
382 $formatter->setContext( $this->
getContext() );
384 $formatter->setShowUserToolLinks( !( $this->
flags & self::NO_EXTRA_USER_LINKS ) );
387 $entry->getTimestamp(), $this->getUser() ) );
389 $action = $formatter->getActionText();
391 if ( $this->
flags & self::NO_ACTION_LINK ) {
394 $revert = $formatter->getActionLinks();
396 $revert =
'<span class="mw-logevent-actionlink">' .
$revert .
'</span>';
400 $comment = $formatter->getComment();
411 $classes = array_merge(
412 [
'mw-logline-' . $entry->getType() ],
416 'data-mw-logid' => $entry->getId(),
417 'data-mw-logaction' => $entry->getFullType(),
419 $ret =
"$del $time $action $comment $revert $tagDisplay";
422 Hooks::run(
'LogEventsListLineEnding', [ $this, &
$ret, $entry, &$classes, &
$attribs ] );
424 $attribs[
'class'] = implode(
' ', $classes );
435 if ( $this->
flags == self::NO_ACTION_LINK ) {
442 if ( $this->
flags & self::USE_CHECKBOXES && $this->showTagEditUI ) {
446 [
'name' =>
'ids[' . $row->log_id .
']' ]
451 if ( $row->log_type ==
'suppress' ) {
457 if ( $user->isAllowed(
'deletedhistory' ) ) {
458 $canHide = $user->isAllowed(
'deletelogentry' );
459 $canViewSuppressedOnly = $user->isAllowed(
'viewsuppressed' ) &&
460 !$user->isAllowed(
'suppressrevision' );
462 $canViewThisSuppressedEntry = $canViewSuppressedOnly && $entryIsSuppressed;
463 if ( $row->log_deleted || $canHide ) {
465 if ( $canHide && $this->
flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry ) {
468 $del = Xml::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
473 [
'name' =>
'ids[' . $row->log_id .
']' ]
482 'target' => SpecialPage::getTitleFor(
'Log', $row->log_type )->getPrefixedDBkey(),
484 'ids' => $row->log_id,
489 $canHide && !$canViewThisSuppressedEntry
507 $match = is_array(
$type ) ?
508 in_array( $row->log_type,
$type ) : $row->log_type ==
$type;
510 $match = is_array( $action ) ?
511 in_array( $row->log_action, $action ) : $row->log_action == $action;
512 if ( $match && $right ) {
514 $match =
$wgUser->isAllowed( $right );
530 public static function userCan( $row, $field,
User $user =
null ) {
545 if ( $bitfield & $field ) {
546 if ( $user ===
null ) {
551 $permissions = [
'suppressrevision',
'viewsuppressed' ];
553 $permissions = [
'deletedhistory' ];
555 $permissionlist = implode(
', ', $permissions );
556 wfDebug(
"Checking for $permissionlist due to $field match on $bitfield\n" );
557 return call_user_func_array( [ $user,
'isAllowedAny' ], $permissions );
571 if ( $user ===
null ) {
575 $logRestrictions = MediaWikiServices::getInstance()->getMainConfig()->get(
'LogRestrictions' );
576 if ( isset( $logRestrictions[
$type] ) && !$user->isAllowed( $logRestrictions[
$type] ) ) {
588 return ( $row->log_deleted & $field ) == $field;
617 &
$out, $types = [], $page =
'', $user =
'', $param = []
619 $defaultParameters = [
622 'showIfEmpty' =>
true,
626 'useRequestParams' =>
false,
627 'useMaster' =>
false,
628 'extraUrlParams' =>
false,
630 # The + operator appends elements of remaining keys from the right
631 # handed array to the left handed, whereas duplicated keys are NOT overwritten.
632 $param += $defaultParameters;
633 # Convert $param array to individual variables
634 $lim = $param[
'lim'];
635 $conds = $param[
'conds'];
636 $showIfEmpty = $param[
'showIfEmpty'];
637 $msgKey = $param[
'msgKey'];
638 $wrap = $param[
'wrap'];
640 $extraUrlParams = $param[
'extraUrlParams'];
642 $useRequestParams = $param[
'useRequestParams'];
643 if ( !is_array( $msgKey ) ) {
644 $msgKey = [ $msgKey ];
654 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
656 # Insert list of top 50 (or top $lim) items
658 $pager =
new LogPager( $loglist, $types, $user, $page,
'', $conds );
659 if ( !$useRequestParams ) {
660 # Reset vars that may have been taken from the request
662 $pager->mDefaultLimit = 50;
663 $pager->mOffset =
"";
664 $pager->mIsBackwards =
false;
667 if ( $param[
'useMaster'] ) {
670 if ( isset( $param[
'offset'] ) ) { # Tell pager to ignore
WebRequest offset
671 $pager->setOffset( $param[
'offset'] );
675 $pager->mLimit = $lim;
678 $logBody = $pager->getBody();
679 $numRows = $pager->getNumRows();
688 $s = Xml::openElement(
'div', [
689 'class' =>
"mw-warning-with-logexcerpt mw-content-$dir",
694 if ( count( $msgKey ) == 1 ) {
698 array_shift(
$args );
702 $s .= $loglist->beginLogEventsList() .
704 $loglist->endLogEventsList();
705 } elseif ( $showIfEmpty ) {
706 $s = Html::rawElement(
'div', [
'class' =>
'mw-warning-logempty' ],
710 if ( $numRows > $pager->mLimit ) { # Show
"Full log" link
712 if ( $page instanceof
Title ) {
713 $urlParam[
'page'] = $page->getPrefixedDBkey();
714 } elseif ( $page !=
'' ) {
715 $urlParam[
'page'] = $page;
719 $urlParam[
'user'] =
$user;
722 if ( !is_array( $types ) ) { # Make it an
array,
if it isn
't
726 # If there is exactly one log type, we can link to Special:Log?type=foo
727 if ( count( $types ) == 1 ) {
728 $urlParam['type'] = $types[0];
731 if ( $extraUrlParams !== false ) {
732 $urlParam = array_merge( $urlParam, $extraUrlParams );
735 $s .= $linkRenderer->makeKnownLink(
736 SpecialPage::getTitleFor( 'Log
' ),
737 $context->msg( 'log-fulllog
' )->text(),
743 if ( $logBody && $msgKey[0] ) {
747 if ( $wrap != '' ) { // Wrap message in html
748 $s = str_replace( '$1', $s, $wrap );
751 /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */
752 if ( Hooks::run(
'LogEventsListShowLogExtract', [ &
$s, $types, $page, $user, $param ] ) ) {
775 if ( $audience !=
'public' && $user ===
null ) {
785 if ( $audience ==
'public' || !$user->isAllowed( $right ) ) {
786 $hiddenLogs[] = $logType;
789 if ( count( $hiddenLogs ) == 1 ) {
790 return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
791 } elseif ( $hiddenLogs ) {
792 return 'log_type NOT IN (' . $db->makeList( $hiddenLogs ) .
')';
$wgScript
The URL path to index.php.
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
$wgMiserMode
Disable database-intensive features.
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.
wfArrayFilterByKey(array $arr, callable $callback)
Like array_filter with ARRAY_FILTER_USE_KEY, but works pre-5.6.
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.
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.
getActionSelector( $types, $action)
Drop down menu for selection of actions that can be used to filter the log.
LinkRenderer null $linkRenderer
static typeAction( $row, $type, $action, $right='')
const NO_EXTRA_USER_LINKS
showOptions( $types=[], $user='', $page='', $pattern='', $year=0, $month=0, $filter=null, $tagFilter='', $action=null)
Show options for the log list.
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
getTypeMenu( $queryTypes)
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
getTitlePattern( $pattern)
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...
getTypeSelector()
Returns log page selector.
static userCanViewLogType( $type, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
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...
static getMain()
Get the RequestContext object associated with the main request.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Class for generating HTML <select> or <datalist> elements.
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
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 in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical it also represents a few features of articles that don t involve their such as access rights See also title txt Article Encapsulates access to the page table of the database The object represents a an and maintains state such as flags
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
the array() calling protocol came about after MediaWiki 1.4rc1.
see documentation in includes Linker php for Linker::makeImageLink & $time
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
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 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 "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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
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 & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
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
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.
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 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