36 parent::__construct(
'Protectedpages' );
42 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
46 $level =
$request->getVal( $this->IdLevel );
47 $sizetype =
$request->getVal(
'sizetype' );
48 $size =
$request->getIntOrNull(
'size' );
49 $ns =
$request->getIntOrNull(
'namespace' );
50 $indefOnly =
$request->getBool(
'indefonly' ) ? 1 : 0;
51 $cascadeOnly =
$request->getBool(
'cascadeonly' ) ? 1 : 0;
52 $noRedirect =
$request->getBool(
'noredirect' ) ? 1 : 0;
79 if ( $pager->getNumRows() ) {
80 $this->
getOutput()->addParserOutputContent( $pager->getFullOutput() );
82 $this->
getOutput()->addWikiMsg(
'protectedpagesempty' );
98 $size, $indefOnly, $cascadeOnly, $noRedirect
131 'selected' => $namespace,
133 'label' => $this->
msg(
'namespace' )->
text()
135 'name' =>
'namespace',
137 'class' =>
'namespaceselector',
149 $this->
msg(
'protectedpages-indef' )->
text(),
162 $this->
msg(
'protectedpages-cascade' )->
text(),
175 $this->
msg(
'protectedpages-noredirect' )->
text(),
188 $max = $sizetype ===
'max';
191 $this->
msg(
'minimum-size' )->
text(),
199 $this->
msg(
'maximum-size' )->
text(),
206 Xml::input(
'size', 9, $size, [
'id' =>
'wpsize' ] ) .
223 $text = $this->
msg(
"restriction-$type" )->text();
228 foreach ( $m
as $text => $type ) {
229 $selected = ( $type == $pr_type );
233 return '<span class="mw-input-with-label">' .
236 [
'id' => $this->IdType,
'name' => $this->IdType ],
237 implode(
"\n",
$options ) ) .
"</span>";
247 $m = [ $this->
msg(
'restriction-level-all' )->text() => 0 ];
253 if ( $type !=
'' && $type !=
'*' ) {
254 $text = $this->
msg(
"restriction-level-$type" )->text();
260 foreach ( $m
as $text => $type ) {
261 $selected = ( $type == $pr_level );
265 return '<span class="mw-input-with-label">' .
268 [
'id' => $this->IdLevel,
'name' => $this->IdLevel ],
269 implode(
"\n",
$options ) ) .
"</span>";
273 return 'maintenance';
304 $sizetype =
'', $size = 0, $indefonly =
false, $cascadeonly =
false, $noredirect =
false,
307 $this->mForm = $form;
308 $this->mConds = $conds;
311 $this->
namespace = $namespace;
313 $this->size = intval( $size );
314 $this->indefonly = (bool)$indefonly;
315 $this->cascadeonly = (bool)$cascadeonly;
316 $this->noredirect = (bool)$noredirect;
318 parent::__construct( $form->getContext() );
322 # Do a link batch query
327 $lb->
add( $row->page_namespace, $row->page_title );
329 if ( $row->log_user !== null ) {
330 $userids[] = $row->log_user;
335 if ( count( $userids ) ) {
337 $userCache->doQuery( $userids, [], __METHOD__ );
338 foreach ( $userids
as $userid ) {
339 $name = $userCache->getProp( $userid,
'name' );
340 if (
$name !==
false ) {
351 static $headers = null;
353 if ( $headers == [] ) {
355 'log_timestamp' =>
'protectedpages-timestamp',
356 'pr_page' =>
'protectedpages-page',
357 'pr_expiry' =>
'protectedpages-expiry',
358 'log_user' =>
'protectedpages-performer',
359 'pr_params' =>
'protectedpages-params',
360 'log_comment' =>
'protectedpages-reason',
362 foreach ( $headers
as $key => $val ) {
363 $headers[$key] = $this->
msg( $val )->text();
381 case 'log_timestamp':
386 [
'class' =>
'mw-protectedpages-unknown' ],
387 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
390 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
400 [
'class' =>
'mw-invalidtitle' ],
403 $row->page_namespace,
408 $formatted = $this->linkRenderer->makeLink(
$title );
410 if ( !is_null( $row->page_len ) ) {
414 [
'class' =>
'mw-protectedpages-length' ],
421 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
425 $changeProtection = $this->linkRenderer->makeKnownLink(
427 $this->
msg(
'protect_change' )->
text(),
429 [
'action' =>
'unprotect' ]
433 [
'class' =>
'mw-protectedpages-actions' ],
434 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
441 if ( $row->log_timestamp === null ) {
444 [
'class' =>
'mw-protectedpages-unknown' ],
445 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
455 $formatted = htmlspecialchars(
$value );
461 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
464 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
472 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
473 if ( $row->pr_cascade ) {
474 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
481 if ( $row->log_timestamp === null ) {
484 [
'class' =>
'mw-protectedpages-unknown' ],
485 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
495 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
498 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
512 $conds[] =
'pr_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
513 ' OR pr_expiry IS NULL';
514 $conds[] =
'page_id=pr_page';
515 $conds[] =
'pr_type=' . $this->mDb->addQuotes( $this->
type );
517 if ( $this->sizetype ==
'min' ) {
519 } elseif ( $this->sizetype ==
'max' ) {
523 if ( $this->indefonly ) {
524 $infinity = $this->mDb->addQuotes( $this->mDb->getInfinity() );
525 $conds[] =
"pr_expiry = $infinity OR pr_expiry IS NULL";
527 if ( $this->cascadeonly ) {
528 $conds[] =
'pr_cascade = 1';
530 if ( $this->noredirect ) {
531 $conds[] =
'page_is_redirect = 0';
534 if ( $this->level ) {
535 $conds[] =
'pr_level=' . $this->mDb->addQuotes( $this->level );
537 if ( !is_null( $this->
namespace ) ) {
538 $conds[] =
'page_namespace=' . $this->mDb->addQuotes( $this->
namespace );
542 'tables' => [
'page',
'page_restrictions',
'log_search',
'logging' ],
561 'ls_field' =>
'pr_id',
'ls_value = ' . $this->mDb->buildStringCast(
'pr_id' )
574 return parent::getTableClass() .
' mw-protectedpages';
getLanguage()
Get the Language object.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static isDeleted($row, $field)
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getLevelMenu($pr_level)
Creates the input label of the restriction level.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static radioLabel($label, $name, $value, $id, $checked=false, $attribs=[])
Convenience function to build an HTML radio button with a label.
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
static formatRevisionSize($size)
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
static input($name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
msg()
Wrapper around wfMessage that sets the current context.
getRedirectCheck($noRedirect)
getOutput()
Get the OutputPage being used for this instance.
static getFilteredRestrictionTypes($exists=true)
Get a filtered list of all restriction types supported by this wiki.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
static label($label, $id, $attribs=[])
Convenience function to build an HTML form label.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED!Use HtmlPageLinkRendererBegin instead.Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static closeElement($element)
Shortcut to close an XML element.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Parent class for all special pages.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
static option($text, $value=null, $selected=false, $attribs=[])
Convenience function to build an HTML drop-down list item.
static openElement($element, $attribs=null)
This opens an XML element.
getContext()
Get the base IContextSource object.
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.
namespace and then decline to actually register it file or subcat img or subcat $title
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
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static formatComment($comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
getSizeLimit($sizetype, $size)
static userLink($userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
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
this hook is for auditing only or null if authentication failed before getting that far $username
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
error also a ContextSource you ll probably need to make sure the header is varied on $request
static userCanBitfield($bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row, if it's marked as deleted.
getTypeMenu($pr_type)
Creates the input label of the restriction type.
getCascadeCheck($cascadeOnly)
getConfig()
Shortcut to get main config object.
static userToolLinks($userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
showOptions($namespace, $type= 'edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly, $noRedirect)
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
getRequest()
Get the WebRequest being used for this instance.
A special page that lists protected pages.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
getUser()
Get the User object.
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
getNamespaceMenu($namespace=null)
Prepare the namespace filter drop-down; standard namespace selector, sans the MediaWiki namespace...
getPageTitle($subpage=false)
Get a self-referential title object.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
getExpiryCheck($indefOnly)
Allows to change the fields on the form that will be generated $name