22use \MediaWiki\Linker\LinkRenderer;
54 $this->mConds = $conds;
57 $this->
namespace = $namespace;
59 $this->size = intval(
$size );
64 parent::__construct( $form->getContext() );
68 # Do a link batch query
72 foreach ( $result as $row ) {
73 $lb->
add( $row->page_namespace, $row->page_title );
75 if ( $row->log_user !==
null ) {
76 $userids[] = $row->log_user;
81 if ( count( $userids ) ) {
83 $userCache->doQuery( $userids, [], __METHOD__ );
84 foreach ( $userids as $userid ) {
85 $name = $userCache->getProp( $userid,
'name' );
86 if ( $name !==
false ) {
87 $lb->add( NS_USER, $name );
97 static $headers =
null;
99 if ( $headers == [] ) {
101 'log_timestamp' =>
'protectedpages-timestamp',
102 'pr_page' =>
'protectedpages-page',
103 'pr_expiry' =>
'protectedpages-expiry',
104 'log_user' =>
'protectedpages-performer',
105 'pr_params' =>
'protectedpages-params',
106 'log_comment' =>
'protectedpages-reason',
108 foreach ( $headers as $key => $val ) {
109 $headers[$key] = $this->
msg( $val )->text();
127 case 'log_timestamp':
130 $formatted = Html::rawElement(
132 [
'class' =>
'mw-protectedpages-unknown' ],
133 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
136 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
142 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
144 $formatted = Html::element(
146 [
'class' =>
'mw-invalidtitle' ],
149 $row->page_namespace,
154 $formatted = $this->linkRenderer->makeLink( $title );
156 if ( !is_null( $row->page_len ) ) {
158 ' ' . Html::rawElement(
160 [
'class' =>
'mw-protectedpages-length' ],
167 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
169 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
170 if ( $this->
getUser()->isAllowed(
'protect' ) && $title ) {
171 $changeProtection = $this->linkRenderer->makeKnownLink(
173 $this->
msg(
'protect_change' )->
text(),
175 [
'action' =>
'unprotect' ]
177 $formatted .=
' ' . Html::rawElement(
179 [
'class' =>
'mw-protectedpages-actions' ],
180 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
187 if ( $row->log_timestamp ===
null ) {
188 $formatted = Html::rawElement(
190 [
'class' =>
'mw-protectedpages-unknown' ],
191 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
201 $formatted = htmlspecialchars(
$value );
207 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
210 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
218 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
219 if ( $row->pr_cascade ) {
220 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
227 if ( $row->log_timestamp ===
null ) {
228 $formatted = Html::rawElement(
230 [
'class' =>
'mw-protectedpages-unknown' ],
231 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
242 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
245 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
259 $conds[] =
'pr_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
260 ' OR pr_expiry IS NULL';
261 $conds[] =
'page_id=pr_page';
262 $conds[] =
'pr_type=' . $this->mDb->addQuotes( $this->
type );
264 if ( $this->sizetype ==
'min' ) {
266 } elseif ( $this->sizetype ==
'max' ) {
270 if ( $this->indefonly ) {
271 $infinity = $this->mDb->addQuotes( $this->mDb->getInfinity() );
272 $conds[] =
"pr_expiry = $infinity OR pr_expiry IS NULL";
274 if ( $this->cascadeonly ) {
275 $conds[] =
'pr_cascade = 1';
277 if ( $this->noredirect ) {
278 $conds[] =
'page_is_redirect = 0';
281 if ( $this->level ) {
282 $conds[] =
'pr_level=' . $this->mDb->addQuotes( $this->level );
284 if ( !is_null( $this->
namespace ) ) {
285 $conds[] =
'page_namespace=' . $this->mDb->addQuotes( $this->
namespace );
291 'tables' => [
'page',
'page_restrictions',
'log_search',
'logging' ] + $commentQuery[
'tables'],
304 ] + $commentQuery[
'fields'],
309 'ls_field' =>
'pr_id',
'ls_value = ' . $this->mDb->buildStringCast(
'pr_id' )
317 ] + $commentQuery[
'joins']
322 return parent::getTableClass() .
' mw-protectedpages';
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getUser()
Get the User object.
getLanguage()
Get the Language object.
getContext()
Get the base IContextSource object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
static formatRevisionSize( $size)
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...
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static isDeleted( $row, $field)
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 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