18use Wikimedia\Timestamp\TimestampFormat as TS;
25 private ?
string $level;
26 private ?
int $namespace;
40 $this->level = $level;
41 $this->
namespace = $namespace;
42 parent::__construct( $context, $linkRenderer );
43 $this->linkBatchFactory = $linkBatchFactory;
48 $this->mResult->seek( 0 );
50 $lb = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
51 foreach ( $this->mResult as $row ) {
52 $lb->add( $row->pt_namespace, $row->pt_title );
59 $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
61 return Html::rawElement(
66 [
'class' =>
'mw-invalidtitle' ],
67 Linker::getInvalidTitleDescription(
78 $description = $this->
msg(
'restriction-level-' . $row->pt_create_perm )->escaped();
80 $expiry = strlen( $row->pt_expiry ) ?
81 $lang->formatExpiry( $row->pt_expiry, TS::MW ) :
84 if ( $expiry !==
'infinity' ) {
86 $description .= $this->
msg(
'comma-separator' )->escaped() . $this->
msg(
87 'protect-expiring-local',
88 $lang->userTimeAndDate( $expiry, $user ),
89 $lang->userDate( $expiry, $user ),
90 $lang->userTime( $expiry, $user )
94 return '<li>' . $lang->specialList( $link, $description ) .
"</li>\n";
103 $dbr->expr(
'pt_expiry',
'>', $this->mDb->timestamp() )
104 ->or(
'pt_expiry',
'=',
null ),
106 if ( $this->level ) {
107 $conds[
'pt_create_perm'] = $this->level;
110 if ( $this->
namespace !==
null ) {
111 $conds[] = $dbr->expr(
'pt_namespace',
'=', $this->
namespace );
115 'tables' =>
'protected_titles',
116 'fields' => [
'pt_namespace',
'pt_title',
'pt_create_perm',
117 'pt_expiry',
'pt_timestamp' ],
124 return [ [
'pt_timestamp',
'pt_namespace',
'pt_title' ] ];
132class_alias( ProtectedTitlesPager::class,
'ProtectedTitlesPager' );
135class_alias( ProtectedTitlesPager::class,
'MediaWiki\\Pager\\ProtectedTitlesPager' );
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
getContext()
Get the base IContextSource object.
Factory for LinkBatch objects to batch query page metadata.
Interface for objects which can provide a MediaWiki context on request.