24use Wikimedia\Timestamp\TimestampException;
33 parent::__construct(
'Log' );
41 $this->
getOutput()->addModules(
'mediawiki.userSuggest' );
45 $opts->
add(
'type',
'' );
46 $opts->add(
'user',
'' );
47 $opts->add(
'page',
'' );
48 $opts->add(
'pattern',
false );
52 $opts->add(
'tagfilter',
'' );
53 $opts->add(
'offset',
'' );
54 $opts->add(
'dir',
'' );
55 $opts->add(
'offender',
'' );
56 $opts->add(
'subtype',
'' );
57 $opts->add(
'logid',
'' );
60 $opts->fetchValuesFromRequest( $this->
getRequest() );
61 if ( $par !==
null ) {
66 $dateString = $this->
getRequest()->getVal(
'wpdate' );
67 if ( !empty( $dateString ) ) {
69 $dateStamp = MWTimestamp::getInstance( $dateString .
' 00:00:00' );
70 }
catch ( TimestampException
$e ) {
76 $opts->setValue(
'year', (
int)$dateStamp->format(
'Y' ) );
77 $opts->setValue(
'month', (
int)$dateStamp->format(
'm' ) );
78 $opts->setValue(
'day', (
int)$dateStamp->format(
'd' ) );
82 # Don't let the user get stuck with a certain date
83 if ( $opts->getValue(
'offset' ) || $opts->getValue(
'dir' ) ==
'prev' ) {
84 $opts->setValue(
'year',
'' );
85 $opts->setValue(
'month',
'' );
91 $logRestrictions = $this->
getConfig()->get(
'LogRestrictions' );
92 $type = $opts->getValue(
'type' );
94 $opts->setValue(
'type',
'' );
95 } elseif ( isset( $logRestrictions[
$type] )
96 && !$this->
getUser()->isAllowed( $logRestrictions[
$type] )
101 # Handle type-specific inputs
103 if ( $opts->getValue(
'type' ) ==
'suppress' ) {
104 $offenderName = $opts->getValue(
'offender' );
105 $offender = empty( $offenderName ) ? null :
User::newFromName( $offenderName,
false );
108 $qc = [
'ls_field' =>
'target_author_actor',
'ls_value' => $offender->getActorId() ];
109 } elseif ( $offender->getId() > 0 ) {
110 $qc = [
'ls_field' =>
'target_author_id',
'ls_value' => $offender->getId() ];
112 $qc = [
'ls_field' =>
'target_author_ip',
'ls_value' => $offender->getName() ];
118 'SpecialLogAddLogSearchRelations',
119 [ $opts->getValue(
'type' ), $this->getRequest(), &$qc ]
123 # Some log types are only for a 'User:' title but we might have been given
124 # only the username instead of the full title 'User:username'. This part try
125 # to lookup for a user by that name and eventually fix user input. See T3697.
126 if ( in_array( $opts->getValue(
'type' ), self::getLogTypesOnUser() ) ) {
127 # ok we have a type of log which expect a user title.
128 $target = Title::newFromText( $opts->getValue(
'page' ) );
129 if ( $target && $target->getNamespace() ===
NS_MAIN ) {
130 # User forgot to add 'User:', we are adding it for him
131 $opts->setValue(
'page',
132 Title::makeTitleSafe( NS_USER, $opts->getValue(
'page' ) )
137 $this->
show( $opts, $qc );
149 static $types =
null;
150 if ( $types !==
null ) {
159 Hooks::run(
'GetLogTypesOnUser', [ &$types ] );
187 $par = $par !==
null ? $par :
'';
188 $parms = explode(
'/', $par );
189 $symsForAll = [
'*',
'all' ];
190 if ( $parms[0] !=
'' &&
194 } elseif ( count( $parms ) == 2 ) {
195 $opts->
setValue(
'type', $parms[0] );
196 $opts->
setValue(
'user', $parms[1] );
197 } elseif ( $par !=
'' ) {
203 # 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(),
242 $pager->getFilterParams(),
243 $pager->getTagFilter(),
248 $logBody = $pager->getBody();
251 $pager->getNavigationBar() .
252 $this->getActionButtons(
253 $loglist->beginLogEventsList() .
255 $loglist->endLogEventsList()
257 $pager->getNavigationBar()
260 $this->
getOutput()->addWikiMsg(
'logempty' );
266 $canRevDelete = $user->isAllowedAll(
'deletedhistory',
'deletelogentry' );
267 $showTagEditUI = ChangeTags::showTagEditingUI( $user );
268 # If the user doesn't have the ability to delete log entries nor edit tags,
269 # don't bother showing them the button(s).
270 if ( !$canRevDelete && !$showTagEditUI ) {
271 return $formcontents;
274 # Show button to hide log entries and/or edit change tags
275 $s = Html::openElement(
277 [
'action' =>
wfScript(),
'id' =>
'mw-log-deleterevision-submit' ]
279 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
280 $s .= Html::hidden(
'type',
'logging' ) .
"\n";
283 if ( $canRevDelete ) {
284 $buttons .= Html::element(
288 'name' =>
'revisiondelete',
290 'class' =>
"deleterevision-log-submit mw-log-deleterevision-button"
292 $this->
msg(
'showhideselectedlogentries' )->
text()
295 if ( $showTagEditUI ) {
296 $buttons .= Html::element(
300 'name' =>
'editchangetags',
302 'class' =>
"editchangetags-log-submit mw-log-editchangetags-button"
304 $this->
msg(
'log-edit-tags' )->
text()
310 $s .= $buttons . $formcontents . $buttons;
311 $s .= Html::closeElement(
'form' );
323 $this->
getOutput()->setPageTitle( $page->getName() );
324 $this->
getOutput()->addHTML( $page->getDescription()
325 ->setContext( $this->getContext() )->parseAsBlock() );
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
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
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.
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.
returning false will NOT prevent logging $e
const SCHEMA_COMPAT_READ_NEW
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))