98 parent::__construct( $context, $linkRenderer );
99 $this->localisationCache = $localisationCache;
101 $this->mIndexField =
'am_title';
107 $this->foreign = !$this->lang->equals( $contentLanguage );
109 $filter = $opts->
getValue(
'filter' );
110 if ( $filter ===
'all' ) {
111 $this->custom =
null;
113 $this->custom = ( $filter ===
'unmodified' );
122 $displayPrefix =
$prefix->getDBkey();
123 $this->prefix =
'/^' . preg_quote( $displayPrefix,
'/' ) .
'/i';
125 $this->prefix =
false;
130 if ( $this->foreign ) {
131 $this->suffix =
'/' . $this->lang->getCode();
137 private function getAllMessages( $descending ) {
138 $messageNames = $this->localisationCache->getSubitemList(
'en',
'messages' );
141 $messageNames = array_map( [ $this->lang,
'ucfirst' ], $messageNames );
144 rsort( $messageNames );
146 asort( $messageNames );
149 return $messageNames;
175 $res = $dbr->newSelectQueryBuilder()
176 ->select( [
'page_namespace',
'page_title' ] )
179 ->useIndex(
'page_name_title' )
180 ->caller( __METHOD__ )->fetchResultSet();
181 $xNames = array_fill_keys( $messageNames,
true );
183 $pageFlags = $talkFlags = [];
185 foreach ( $res as $s ) {
189 $titleParts = explode(
'/', $s->page_title );
190 if ( count( $titleParts ) === 2 &&
191 $langcode === $titleParts[1] &&
192 isset( $xNames[$titleParts[0]] )
194 $exists = $titleParts[0];
196 } elseif ( isset( $xNames[$s->page_title] ) ) {
197 $exists = $s->page_title;
200 $title = Title::newFromRow( $s );
202 $pageFlags[$exists] =
true;
204 $talkFlags[$exists] =
true;
208 return [
'pages' => $pageFlags,
'talks' => $talkFlags ];
222 $messageNames = $this->getAllMessages( $order );
225 $this->lang->getCode(),
232 foreach ( $messageNames as $key ) {
233 $customised = isset( $statuses[
'pages'][$key] );
234 if ( $customised !== $this->custom &&
235 ( ( $asc && ( $key < $offset || !$offset ) ) || ( !$asc && $key > $offset ) ) &&
236 ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix ===
false )
238 $actual = $this->
msg( $key )->inLanguage( $this->lang )->plain();
239 $default = $this->
msg( $key )->inLanguage( $this->lang )->useDatabase(
false )->plain();
242 'am_actual' => $actual,
243 'am_default' => $default,
244 'am_customised' => $customised,
245 'am_talk_exists' => isset( $statuses[
'talks'][$key] )
250 if ( $count === $limit ) {
259 return Xml::openElement(
'table', [
261 'id' =>
'mw-allmessagestable'
265 <th rowspan=\"2\">" .
266 $this->
msg(
'allmessagesname' )->escaped() .
"
269 $this->
msg(
'allmessagesdefault' )->escaped() .
274 $this->
msg(
'allmessagescurrent' )->escaped() .
280 return Html::closeElement(
'table' );
292 $title = Title::makeTitle(
NS_MEDIAWIKI, $value . $this->suffix );
294 $message = $this->
msg( $value )->inLanguage( $this->lang )->useDatabase(
false )->plain();
295 $translation = Linker::makeExternalLink(
297 'title' =>
'Special:SearchTranslations',
298 'group' =>
'mediawiki',
299 'grouppath' =>
'mediawiki',
300 'language' => $this->lang->getCode(),
301 'query' => $value .
' ' . $message
303 $this->msg(
'allmessages-filter-translate' )->text()
305 $talkLink = $this->
msg(
'talkpagelinktext' )->text();
307 if ( $this->mCurrentRow->am_customised ) {
308 $title = $linkRenderer->makeKnownLink( $title, $this->
getLanguage()->lcfirst( $value ) );
310 $title = $linkRenderer->makeBrokenLink(
314 if ( $this->mCurrentRow->am_talk_exists ) {
315 $talk = $linkRenderer->makeKnownLink( $talk, $talkLink );
317 $talk = $linkRenderer->makeBrokenLink(
323 return $title .
' ' .
324 $this->
msg(
'parentheses' )->rawParams( $talk )->escaped() .
326 $this->
msg(
'parentheses' )->rawParams( $translation )->escaped();
330 return Sanitizer::escapeHtmlAllowEntities( $value );
342 $s = parent::formatRow( $row );
345 if ( $row->am_customised ) {
346 $s .= Html::openElement(
'tr', $this->
getRowAttrs( $row ) );
347 $formatted = strval( $this->
formatValue(
'am_actual', $row->am_actual ) );
349 if ( $formatted ===
'' ) {
350 $formatted =
"\u{00A0}";
353 $s .= Html::rawElement(
'td', $this->
getCellAttrs(
'am_actual', $row->am_actual ), $formatted )
354 . Html::closeElement(
'tr' );
357 return Html::rawElement(
'tbody', [], $s );
371 if ( $field ===
'am_title' ) {
372 if ( $this->mCurrentRow->am_customised ) {
373 $attr += [
'rowspan' =>
'2' ];
377 'lang' => $this->lang->getHtmlCode(),
378 'dir' => $this->lang->getDir(),
380 if ( $this->mCurrentRow->am_customised ) {
382 $attr += [
'class' => $field ];
391 'am_title' => $this->
msg(
'allmessagesname' )->text(),
392 'am_default' => $this->
msg(
'allmessagesdefault' )->text()
418class_alias( AllMessagesTablePager::class,
'AllMessagesTablePager' );
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
Base class for language-specific code.
Caching for the contents of localisation files.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Parent class for all special pages.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Module of static functions for generating XML.
Interface for objects which can provide a MediaWiki context on request.