33 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',
'' );
56 $opts->fetchValuesFromRequest( $this->
getRequest() );
57 if ( $par !== null ) {
61 # Don't let the user get stuck with a certain date
62 if ( $opts->getValue(
'offset' ) || $opts->getValue(
'dir' ) ==
'prev' ) {
63 $opts->setValue(
'year',
'' );
64 $opts->setValue(
'month',
'' );
70 $logRestrictions = $this->
getConfig()->get(
'LogRestrictions' );
71 $type = $opts->getValue(
'type' );
73 $opts->setValue(
'type',
'' );
74 } elseif ( isset( $logRestrictions[
$type] )
75 && !$this->
getUser()->isAllowed( $logRestrictions[$type] )
80 # Handle type-specific inputs
82 if ( $opts->getValue(
'type' ) ==
'suppress' ) {
84 if ( $offender && $offender->getId() > 0 ) {
85 $qc = [
'ls_field' =>
'target_author_id',
'ls_value' => $offender->getId() ];
87 $qc = [
'ls_field' =>
'target_author_ip',
'ls_value' => $offender->getName() ];
92 'SpecialLogAddLogSearchRelations',
93 [ $opts->getValue(
'type' ), $this->
getRequest(), &$qc ]
97 # Some log types are only for a 'User:' title but we might have been given
98 # only the username instead of the full title 'User:username'. This part try
99 # to lookup for a user by that name and eventually fix user input. See bug 1697.
100 if ( in_array( $opts->getValue(
'type' ), self::getLogTypesOnUser() ) ) {
101 # ok we have a type of log which expect a user title.
103 if ( $target && $target->getNamespace() ===
NS_MAIN ) {
104 # User forgot to add 'User:', we are adding it for him
105 $opts->setValue(
'page',
111 $this->
show( $opts, $qc );
123 static $types = null;
124 if ( $types !== null ) {
133 Hooks::run(
'GetLogTypesOnUser', [ &$types ] );
143 $subpages = $this->
getConfig()->get(
'LogTypes' );
151 $par = $par !== null ? $par :
'';
152 $parms = explode(
'/', $par );
153 $symsForAll = [
'*',
'all' ];
154 if ( $parms[0] !=
'' &&
155 ( in_array( $par, $this->
getConfig()->
get(
'LogTypes' ) ) || in_array( $par, $symsForAll ) )
158 } elseif ( count( $parms ) == 2 ) {
159 $opts->
setValue(
'type', $parms[0] );
160 $opts->
setValue(
'user', $parms[1] );
161 } elseif ( $par !=
'' ) {
167 # Create a LogPager item to get the results and a LogEventsList item to format them...
190 if ( $pager->getPerformer() ) {
192 $this->
getSkin()->setRelevantUser( $performerUser );
196 $loglist->showOptions(
198 $pager->getPerformer(),
200 $pager->getPattern(),
203 $pager->getFilterParams(),
204 $pager->getTagFilter(),
209 $logBody = $pager->getBody();
212 $pager->getNavigationBar() .
214 $loglist->beginLogEventsList() .
216 $loglist->endLogEventsList()
218 $pager->getNavigationBar()
221 $this->
getOutput()->addWikiMsg(
'logempty' );
227 $canRevDelete =
$user->isAllowedAll(
'deletedhistory',
'deletelogentry' );
229 # If the user doesn't have the ability to delete log entries nor edit tags,
230 # don't bother showing them the button(s).
231 if ( !$canRevDelete && !$showTagEditUI ) {
232 return $formcontents;
235 # Show button to hide log entries and/or edit change tags
238 [
'action' =>
wfScript(),
'id' =>
'mw-log-deleterevision-submit' ]
244 if ( $canRevDelete ) {
249 'name' =>
'revisiondelete',
251 'class' =>
"deleterevision-log-submit mw-log-deleterevision-button"
253 $this->
msg(
'showhideselectedlogentries' )->
text()
256 if ( $showTagEditUI ) {
261 'name' =>
'editchangetags',
263 'class' =>
"editchangetags-log-submit mw-log-editchangetags-button"
265 $this->
msg(
'log-edit-tags' )->
text()
271 $s .= $buttons . $formcontents . $buttons;
286 ->setContext( $this->
getContext() )->parseAsBlock() );
Class for generating clickable toggle links for a list of checkboxes.
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
static closeElement($element)
Returns "$element>".
the array() calling protocol came about after MediaWiki 1.4rc1.
getContext()
Gets the context this SpecialPage is executed in.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
getActionButtons($formcontents)
parseParams(FormOptions $opts, $par)
processing should stop and the error should be shown to the user * false
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
addHeader($type)
Set page title and show header for this log type.
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static isIPAddress($ip)
Determine if a string is as valid IP address or network (CIDR prefix).
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Class to simplify the use of log pages.
Parent class for all special pages.
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
getSkin()
Shortcut to get the skin being used for this instance.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
A special page that lists log entries.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
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
static isLogType($type)
Is $type a valid log type.
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
show(FormOptions $opts, array $extraConds)
getUser()
Shortcut to get the User executing this instance.
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...
getConfig()
Shortcut to get main config object.
Show an error when a user tries to do something they do not have the necessary permissions for...
getRequest()
Get the WebRequest being used for this instance.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page