31 parent::__construct(
'Log' );
39 $this->
getOutput()->addModules(
'mediawiki.userSuggest' );
43 $opts->
add(
'type',
'' );
44 $opts->add(
'user',
'' );
45 $opts->add(
'page',
'' );
46 $opts->add(
'pattern',
false );
49 $opts->add(
'tagfilter',
'' );
50 $opts->add(
'offset',
'' );
51 $opts->add(
'dir',
'' );
52 $opts->add(
'offender',
'' );
53 $opts->add(
'subtype',
'' );
54 $opts->add(
'logid',
'' );
57 $opts->fetchValuesFromRequest( $this->
getRequest() );
58 if ( $par !==
null ) {
62 # Don't let the user get stuck with a certain date
63 if ( $opts->getValue(
'offset' ) || $opts->getValue(
'dir' ) ==
'prev' ) {
64 $opts->setValue(
'year',
'' );
65 $opts->setValue(
'month',
'' );
71 $logRestrictions = $this->
getConfig()->get(
'LogRestrictions' );
72 $type = $opts->getValue(
'type' );
74 $opts->setValue(
'type',
'' );
75 } elseif ( isset( $logRestrictions[
$type] )
76 && !$this->
getUser()->isAllowed( $logRestrictions[
$type] )
81 # Handle type-specific inputs
83 if ( $opts->getValue(
'type' ) ==
'suppress' ) {
84 $offenderName = $opts->getValue(
'offender' );
85 $offender = empty( $offenderName ) ? null :
User::newFromName( $offenderName,
false );
88 $qc = [
'ls_field' =>
'target_author_actor',
'ls_value' => $offender->getActorId() ];
90 if ( $offender->getId() > 0 ) {
91 $field =
'target_author_id';
92 $value = $offender->getId();
94 $field =
'target_author_ip';
95 $value = $offender->getName();
97 if ( !$offender->getActorId() ) {
98 $qc = [
'ls_field' => $field,
'ls_value' =>
$value ];
102 'ls_field' => [
'target_author_actor', $field ],
106 'ls_field' =>
'target_author_actor',
107 'ls_value' => $offender->getActorId()
110 $db->makeList( [
'ls_field' => $field,
'ls_value' =>
$value ],
LIST_AND ),
119 'SpecialLogAddLogSearchRelations',
120 [ $opts->getValue(
'type' ), $this->getRequest(), &$qc ]
124 # Some log types are only for a 'User:' title but we might have been given
125 # only the username instead of the full title 'User:username'. This part try
126 # to lookup for a user by that name and eventually fix user input. See T3697.
127 if ( in_array( $opts->getValue(
'type' ), self::getLogTypesOnUser() ) ) {
128 # ok we have a type of log which expect a user title.
129 $target = Title::newFromText( $opts->getValue(
'page' ) );
130 if ( $target && $target->getNamespace() ===
NS_MAIN ) {
131 # User forgot to add 'User:', we are adding it for him
132 $opts->setValue(
'page',
133 Title::makeTitleSafe( NS_USER, $opts->getValue(
'page' ) )
138 $this->
show( $opts, $qc );
150 static $types =
null;
151 if ( $types !==
null ) {
160 Hooks::run(
'GetLogTypesOnUser', [ &$types ] );
170 $subpages = $this->
getConfig()->get(
'LogTypes' );
188 $par = $par !==
null ? $par :
'';
189 $parms = explode(
'/', $par );
190 $symsForAll = [
'*',
'all' ];
191 if ( $parms[0] !=
'' &&
192 ( in_array( $par, $this->
getConfig()->
get(
'LogTypes' ) ) || in_array( $par, $symsForAll ) )
195 } elseif ( count( $parms ) == 2 ) {
196 $opts->
setValue(
'type', $parms[0] );
197 $opts->
setValue(
'user', $parms[1] );
198 } elseif ( $par !=
'' ) {
204 # Create a LogPager item to get the results and a LogEventsList item to format them...
228 if ( $pager->getPerformer() ) {
230 $this->
getSkin()->setRelevantUser( $performerUser );
234 $loglist->showOptions(
236 $pager->getPerformer(),
238 $pager->getPattern(),
241 $pager->getFilterParams(),
242 $pager->getTagFilter(),
247 $logBody = $pager->getBody();
250 $pager->getNavigationBar() .
251 $this->getActionButtons(
252 $loglist->beginLogEventsList() .
254 $loglist->endLogEventsList()
256 $pager->getNavigationBar()
259 $this->
getOutput()->addWikiMsg(
'logempty' );
265 $canRevDelete = $user->isAllowedAll(
'deletedhistory',
'deletelogentry' );
267 # If the user doesn't have the ability to delete log entries nor edit tags,
268 # don't bother showing them the button(s).
269 if ( !$canRevDelete && !$showTagEditUI ) {
270 return $formcontents;
273 # Show button to hide log entries and/or edit change tags
274 $s = Html::openElement(
276 [
'action' =>
wfScript(),
'id' =>
'mw-log-deleterevision-submit' ]
278 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
279 $s .= Html::hidden(
'type',
'logging' ) .
"\n";
291 $s .= Html::hidden(
'title',
'Unused' ) .
"\n";
294 if ( $canRevDelete ) {
295 $buttons .= Html::element(
299 'name' =>
'revisiondelete',
301 'class' =>
"deleterevision-log-submit mw-log-deleterevision-button"
303 $this->
msg(
'showhideselectedlogentries' )->
text()
306 if ( $showTagEditUI ) {
307 $buttons .= Html::element(
311 'name' =>
'editchangetags',
313 'class' =>
"editchangetags-log-submit mw-log-editchangetags-button"
315 $this->
msg(
'log-edit-tags' )->
text()
321 $s .= $buttons . $formcontents . $buttons;
322 $s .= Html::closeElement(
'form' );
334 $this->
getOutput()->setPageTitle( $page->getName() );
335 $this->
getOutput()->addHTML( $page->getDescription()
336 ->setContext( $this->getContext() )->parseAsBlock() );
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Class for generating clickable toggle links for a list of checkboxes.
Class to simplify the use of log pages.
static isLogType( $type)
Is $type a valid log type.
Show an error when a user tries to do something they do not have the necessary permissions for.
A special page that lists log entries.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
execute( $par)
Default execute method Checks user permissions.
static getLogTypesOnUser()
List log type for which the target is a user Thus if the given target is in NS_MAIN we can alter it t...
show(FormOptions $opts, array $extraConds)
parseParams(FormOptions $opts, $par)
Set options based on the subpage title parts:
getActionButtons( $formcontents)
addHeader( $type)
Set page title and show header for this log type.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
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