28use Wikimedia\Timestamp\TimestampException;
56 parent::__construct(
'Log' );
66 $out->addModules(
'mediawiki.userSuggest' );
67 $out->addModuleStyles(
'mediawiki.interface.helpers.styles' );
71 $opts->
add(
'type',
'' );
72 $opts->add(
'user',
'' );
73 $opts->add(
'page',
'' );
74 $opts->add(
'pattern',
false );
75 $opts->add(
'year',
null, FormOptions::INTNULL );
76 $opts->add(
'month',
null, FormOptions::INTNULL );
77 $opts->add(
'day',
null, FormOptions::INTNULL );
78 $opts->add(
'tagfilter',
'' );
79 $opts->add(
'offset',
'' );
80 $opts->add(
'dir',
'' );
81 $opts->add(
'offender',
'' );
82 $opts->add(
'subtype',
'' );
83 $opts->add(
'logid',
'' );
86 $opts->fetchValuesFromRequest( $this->
getRequest() );
87 if ( $par !==
null ) {
92 $dateString = $this->
getRequest()->getVal(
'wpdate' );
93 if ( !empty( $dateString ) ) {
95 $dateStamp = MWTimestamp::getInstance( $dateString .
' 00:00:00' );
96 }
catch ( TimestampException $e ) {
102 $opts->setValue(
'year', (
int)$dateStamp->format(
'Y' ) );
103 $opts->setValue(
'month', (
int)$dateStamp->format(
'm' ) );
104 $opts->setValue(
'day', (
int)$dateStamp->format(
'd' ) );
108 # Don't let the user get stuck with a certain date
109 if ( $opts->getValue(
'offset' ) || $opts->getValue(
'dir' ) ==
'prev' ) {
110 $opts->setValue(
'year',
'' );
111 $opts->setValue(
'month',
'' );
117 $logRestrictions = $this->
getConfig()->get(
'LogRestrictions' );
118 $type = $opts->getValue(
'type' );
120 $opts->setValue(
'type',
'' );
121 } elseif ( isset( $logRestrictions[
$type] )
127 # Handle type-specific inputs
129 if ( $opts->getValue(
'type' ) ==
'suppress' ) {
131 $offenderName = $opts->getValue(
'offender' );
132 $offenderId = $this->actorNormalization->findActorIdByName( $offenderName,
$dbr );
134 $qc = [
'ls_field' =>
'target_author_actor',
'ls_value' => $offenderId ];
139 $opts->getValue(
'type' ), $this->getRequest(), $qc );
142 # Some log types are only for a 'User:' title but we might have been given
143 # only the username instead of the full title 'User:username'. This part try
144 # to lookup for a user by that name and eventually fix user input. See T3697.
145 if ( in_array( $opts->getValue(
'type' ), self::getLogTypesOnUser( $this->getHookRunner() ) ) ) {
146 # ok we have a type of log which expect a user title.
147 $target = Title::newFromText( $opts->getValue(
'page' ) );
148 if ( $target && $target->getNamespace() ===
NS_MAIN ) {
149 # User forgot to add 'User:', we are adding it for him
150 $opts->setValue(
'page',
151 Title::makeTitleSafe(
NS_USER, $opts->getValue(
'page' ) )
156 $this->
show( $opts, $qc );
171 static $types =
null;
172 if ( $types !==
null ) {
181 ( $runner ?? Hooks::runner() )->onGetLogTypesOnUser( $types );
209 $parms = explode(
'/', $par );
210 $symsForAll = [
'*',
'all' ];
211 if ( $parms[0] !=
'' &&
215 } elseif ( count( $parms ) == 2 ) {
216 $opts->
setValue(
'type', $parms[0] );
217 $opts->
setValue(
'user', $parms[1] );
218 } elseif ( $par !=
'' ) {
224 # Create a LogPager item to get the results and a LogEventsList item to format them...
228 LogEventsList::USE_CHECKBOXES
244 $this->linkBatchFactory,
246 $this->actorNormalization
252 if ( $pager->getPerformer() ) {
254 if ( $performerUser ) {
255 $this->
getSkin()->setRelevantUser( $performerUser );
260 $loglist->showOptions(
262 $pager->getPerformer(),
264 $pager->getPattern(),
268 $pager->getFilterParams(),
269 $pager->getTagFilter(),
274 $logBody = $pager->getBody();
277 $pager->getNavigationBar() .
278 $this->getActionButtons(
279 $loglist->beginLogEventsList() .
281 $loglist->endLogEventsList()
283 $pager->getNavigationBar()
286 $this->
getOutput()->addWikiMsg(
'logempty' );
292 ->isAllowedAll(
'deletedhistory',
'deletelogentry' );
294 # If the user doesn't have the ability to delete log entries nor edit tags,
295 # don't bother showing them the button(s).
296 if ( !$canRevDelete && !$showTagEditUI ) {
297 return $formcontents;
300 # Show button to hide log entries and/or edit change tags
301 $s = Html::openElement(
303 [
'action' =>
wfScript(),
'id' =>
'mw-log-deleterevision-submit' ]
305 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
306 $s .= Html::hidden(
'type',
'logging' ) .
"\n";
318 $s .= Html::hidden(
'title',
'Unused' ) .
"\n";
321 if ( $canRevDelete ) {
322 $buttons .= Html::element(
326 'name' =>
'revisiondelete',
328 'class' =>
"deleterevision-log-submit mw-log-deleterevision-button mw-ui-button"
330 $this->
msg(
'showhideselectedlogentries' )->text()
333 if ( $showTagEditUI ) {
334 $buttons .= Html::element(
338 'name' =>
'editchangetags',
340 'class' =>
"editchangetags-log-submit mw-log-editchangetags-button mw-ui-button"
342 $this->
msg(
'log-edit-tags' )->text()
348 $s .= $buttons . $formcontents . $buttons;
349 $s .= Html::closeElement(
'form' );
361 $this->
getOutput()->setPageTitle( $page->getName() );
362 $this->
getOutput()->addHTML( $page->getDescription()
363 ->setContext( $this->getContext() )->parseAsBlock() );
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.
static validTypes()
Get the list of valid log types.
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.
static getLogTypesOnUser(HookRunner $runner=null)
List log type for which the target is a user Thus if the given target is in NS_MAIN we can alter it t...
execute( $par)
Default execute method Checks user permissions.
show(FormOptions $opts, array $extraConds)
ActorNormalization $actorNormalization
parseParams(FormOptions $opts, $par)
Set options based on the subpage title parts:
ILoadBalancer $loadBalancer
__construct(LinkBatchFactory $linkBatchFactory, ILoadBalancer $loadBalancer, ActorNormalization $actorNormalization)
LinkBatchFactory $linkBatchFactory
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.
getSkin()
Shortcut to get the skin being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getAuthority()
Shortcut to get the Authority executing this instance.
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')
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s