97 parent::__construct( $context, $linkRenderer );
98 $this->localisationCache = $localisationCache;
100 $this->mIndexField =
'am_title';
106 $this->foreign = !$this->lang->equals( $contentLanguage );
108 $filter = $opts->
getValue(
'filter' );
109 if ( $filter ===
'all' ) {
110 $this->custom =
null;
112 $this->custom = ( $filter ===
'unmodified' );
121 $displayPrefix =
$prefix->getDBkey();
122 $this->prefix =
'/^' . preg_quote( $displayPrefix,
'/' ) .
'/i';
124 $this->prefix =
false;
129 if ( $this->foreign ) {
130 $this->suffix =
'/' . $this->lang->getCode();
136 private function getAllMessages( $descending ) {
137 $messageNames = $this->localisationCache->getSubitemList(
'en',
'messages' );
140 $messageNames = array_map( [ $this->lang,
'ucfirst' ], $messageNames );
143 rsort( $messageNames );
145 asort( $messageNames );
148 return $messageNames;
174 $res = $dbr->newSelectQueryBuilder()
175 ->select( [
'page_namespace',
'page_title' ] )
178 ->useIndex(
'page_name_title' )
179 ->caller( __METHOD__ )->fetchResultSet();
180 $xNames = array_fill_keys( $messageNames,
true );
182 $pageFlags = $talkFlags = [];
184 foreach ( $res as $s ) {
188 $titleParts = explode(
'/', $s->page_title );
189 if ( count( $titleParts ) === 2 &&
190 $langcode === $titleParts[1] &&
191 isset( $xNames[$titleParts[0]] )
193 $exists = $titleParts[0];
195 } elseif ( isset( $xNames[$s->page_title] ) ) {
196 $exists = $s->page_title;
199 $title = Title::newFromRow( $s );
201 $pageFlags[$exists] =
true;
203 $talkFlags[$exists] =
true;
207 return [
'pages' => $pageFlags,
'talks' => $talkFlags ];
221 $messageNames = $this->getAllMessages( $order );
224 $this->lang->getCode(),
231 foreach ( $messageNames as $key ) {
232 $customised = isset( $statuses[
'pages'][$key] );
233 if ( $customised !== $this->custom &&
234 ( ( $asc && ( $key < $offset || !$offset ) ) || ( !$asc && $key > $offset ) ) &&
235 ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix ===
false )
237 $actual = $this->
msg( $key )->inLanguage( $this->lang )->plain();
238 $default = $this->
msg( $key )->inLanguage( $this->lang )->useDatabase(
false )->plain();
241 'am_actual' => $actual,
242 'am_default' => $default,
243 'am_customised' => $customised,
244 'am_talk_exists' => isset( $statuses[
'talks'][$key] )
249 if ( $count === $limit ) {
260 'id' =>
'mw-allmessagestable'
264 <th rowspan=\"2\">" .
265 $this->
msg(
'allmessagesname' )->escaped() .
"
268 $this->
msg(
'allmessagesdefault' )->escaped() .
273 $this->
msg(
'allmessagescurrent' )->escaped() .
279 return Html::closeElement(
'table' );
291 $title = Title::makeTitle(
NS_MEDIAWIKI, $value . $this->suffix );
293 $message = $this->
msg( $value )->inLanguage( $this->lang )->useDatabase(
false )->plain();
294 $translation = $linkRenderer->makeExternalLink(
296 'title' =>
'Special:SearchTranslations',
297 'group' =>
'mediawiki',
298 'grouppath' =>
'mediawiki',
299 'language' => $this->lang->getCode(),
300 'query' => $value .
' ' . $message
302 $this->msg(
'allmessages-filter-translate' ),
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....
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,...
Interface for objects which can provide a MediaWiki context on request.