Go to the documentation of this file.
25 use Wikimedia\Timestamp\TimestampException;
34 parent::__construct(
'Log' );
41 $out->addModules(
'mediawiki.userSuggest' );
42 $out->addModuleStyles(
'mediawiki.interface.helpers.styles' );
46 $opts->
add(
'type',
'' );
47 $opts->add(
'user',
'' );
48 $opts->add(
'page',
'' );
49 $opts->add(
'pattern',
false );
53 $opts->add(
'tagfilter',
'' );
54 $opts->add(
'offset',
'' );
55 $opts->add(
'dir',
'' );
56 $opts->add(
'offender',
'' );
57 $opts->add(
'subtype',
'' );
58 $opts->add(
'logid',
'' );
61 $opts->fetchValuesFromRequest( $this->
getRequest() );
62 if ( $par !==
null ) {
67 $dateString = $this->
getRequest()->getVal(
'wpdate' );
68 if ( !empty( $dateString ) ) {
71 }
catch ( TimestampException $e ) {
77 $opts->setValue(
'year', (
int)$dateStamp->format(
'Y' ) );
78 $opts->setValue(
'month', (
int)$dateStamp->format(
'm' ) );
79 $opts->setValue(
'day', (
int)$dateStamp->format(
'd' ) );
83 # Don't let the user get stuck with a certain date
84 if ( $opts->getValue(
'offset' ) || $opts->getValue(
'dir' ) ==
'prev' ) {
85 $opts->setValue(
'year',
'' );
86 $opts->setValue(
'month',
'' );
92 $logRestrictions = $this->
getConfig()->get(
'LogRestrictions' );
93 $type = $opts->getValue(
'type' );
95 $opts->setValue(
'type',
'' );
96 } elseif ( isset( $logRestrictions[
$type] )
97 && !MediaWikiServices::getInstance()
99 ->userHasRight( $this->
getUser(), $logRestrictions[
$type] )
104 # Handle type-specific inputs
106 if ( $opts->getValue(
'type' ) ==
'suppress' ) {
107 $offenderName = $opts->getValue(
'offender' );
108 $offender = empty( $offenderName ) ? null :
User::newFromName( $offenderName,
false );
110 $qc = [
'ls_field' =>
'target_author_actor',
'ls_value' => $offender->getActorId() ];
115 'SpecialLogAddLogSearchRelations',
116 [ $opts->getValue(
'type' ), $this->
getRequest(), &$qc ]
120 # Some log types are only for a 'User:' title but we might have been given
121 # only the username instead of the full title 'User:username'. This part try
122 # to lookup for a user by that name and eventually fix user input. See T3697.
124 # ok we have a type of log which expect a user title.
126 if ( $target && $target->getNamespace() ===
NS_MAIN ) {
127 # User forgot to add 'User:', we are adding it for him
128 $opts->setValue(
'page',
134 $this->
show( $opts, $qc );
146 static $types =
null;
147 if ( $types !==
null ) {
156 Hooks::run(
'GetLogTypesOnUser', [ &$types ] );
184 $parms = explode(
'/', $par );
185 $symsForAll = [
'*',
'all' ];
186 if ( $parms[0] !=
'' &&
190 } elseif ( count( $parms ) == 2 ) {
191 $opts->
setValue(
'type', $parms[0] );
192 $opts->
setValue(
'user', $parms[1] );
193 } elseif ( $par !=
'' ) {
199 # Create a LogPager item to get the results and a LogEventsList item to format them...
224 if ( $pager->getPerformer() ) {
226 $this->
getSkin()->setRelevantUser( $performerUser );
230 $loglist->showOptions(
232 $pager->getPerformer(),
234 $pager->getPattern(),
238 $pager->getFilterParams(),
239 $pager->getTagFilter(),
244 $logBody = $pager->getBody();
247 $pager->getNavigationBar() .
249 $loglist->beginLogEventsList() .
251 $loglist->endLogEventsList()
253 $pager->getNavigationBar()
256 $this->
getOutput()->addWikiMsg(
'logempty' );
262 $canRevDelete = MediaWikiServices::getInstance()
263 ->getPermissionManager()
264 ->userHasAllRights( $user,
'deletedhistory',
'deletelogentry' );
266 # If the user doesn't have the ability to delete log entries nor edit tags,
267 # don't bother showing them the button(s).
268 if ( !$canRevDelete && !$showTagEditUI ) {
269 return $formcontents;
272 # Show button to hide log entries and/or edit change tags
273 $s = Html::openElement(
275 [
'action' =>
wfScript(),
'id' =>
'mw-log-deleterevision-submit' ]
277 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
278 $s .= Html::hidden(
'type',
'logging' ) .
"\n";
281 if ( $canRevDelete ) {
282 $buttons .= Html::element(
286 'name' =>
'revisiondelete',
288 'class' =>
"deleterevision-log-submit mw-log-deleterevision-button"
290 $this->
msg(
'showhideselectedlogentries' )->text()
293 if ( $showTagEditUI ) {
294 $buttons .= Html::element(
298 'name' =>
'editchangetags',
300 'class' =>
"editchangetags-log-submit mw-log-editchangetags-button"
302 $this->
msg(
'log-edit-tags' )->text()
308 $s .= $buttons . $formcontents . $buttons;
309 $s .= Html::closeElement(
'form' );
321 $this->
getOutput()->setPageTitle( $page->getName() );
322 $this->
getOutput()->addHTML( $page->getDescription()
323 ->setContext( $this->
getContext() )->parseAsBlock() );
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static validTypes()
Get the list of valid log types.
parseParams(FormOptions $opts, $par)
Set options based on the subpage title parts:
getOutput()
Get the OutputPage being used for this instance.
getActionButtons( $formcontents)
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
getSkin()
Shortcut to get the skin being used for this instance.
Show an error when a user tries to do something they do not have the necessary permissions for.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getConfig()
Shortcut to get main config 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.
static isLogType( $type)
Is $type a valid log type.
Class to simplify the use of log pages.
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...
static getInstance( $ts=false)
Get a timestamp instance in GMT.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
getContext()
Gets the context this SpecialPage is executed in.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Parent class for all special pages.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getRequest()
Get the WebRequest being used for this instance.
show(FormOptions $opts, array $extraConds)
A special page that lists log entries.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
execute( $par)
Default execute method Checks user permissions.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
addHeader( $type)
Set page title and show header for this log type.