34 $subtype = $this->entry->getSubtype();
35 if ( $subtype ===
'move_prot' ) {
43 $key = parent::getMessageKey();
45 if ( isset( $params[4] ) && $params[4] ) {
54 $params = parent::getMessageParameters();
56 $subtype = $this->entry->getSubtype();
57 if ( $subtype ===
'protect' || $subtype ===
'modify' ) {
58 $rawParams = $this->entry->getParameters();
59 if ( isset( $rawParams[
'details'] ) ) {
61 } elseif ( isset( $params[3] ) ) {
63 $params[3] = $this->context->getLanguage()->getDirMark() . $params[3];
69 if ( isset( $params[4] ) ) {
73 } elseif ( $subtype ===
'move_prot' ) {
75 $params[3] = Message::rawParam( $oldname );
83 $subtype = $this->entry->getSubtype();
85 || $subtype ===
'move_prot'
91 $title = $this->entry->getTarget();
94 $this->
msg(
'hist' )->text(),
97 'action' =>
'history',
98 'offset' => $this->entry->getTimestamp(),
104 if ( MediaWikiServices::getInstance()
105 ->getPermissionManager()
106 ->userHasRight( $this->context->getUser(),
'protect' )
110 $this->
msg(
'protect_change' )->text(),
112 [
'action' =>
'protect' ]
116 return $this->
msg(
'parentheses' )->rawParams(
117 $this->context->getLanguage()->pipeList( $links ) )->escaped();
126 if ( $subtype ===
'protect' || $subtype ===
'modify' ) {
130 'details' =>
':array:details',
132 } elseif ( $subtype ===
'move_prot' ) {
135 '4::oldtitle' =>
'4:title:oldtitle',
138 foreach ( $map as $index => $key ) {
139 if ( isset( $params[$index] ) ) {
140 $params[$key] = $params[$index];
141 unset( $params[$index] );
146 if ( isset( $params[
'5:bool:cascade'] ) && is_string( $params[
'5:bool:cascade'] ) ) {
147 $params[
'5:bool:cascade'] = $params[
'5:bool:cascade'] ===
'cascade';
154 $ret = parent::formatParametersForApi();
155 if ( isset( $ret[
'details'] ) && is_array( $ret[
'details'] ) ) {
156 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
157 foreach ( $ret[
'details'] as &$detail ) {
158 if ( isset( $detail[
'expiry'] ) ) {
159 $detail[
'expiry'] = $contLang->
160 formatExpiry( $detail[
'expiry'], TS_ISO_8601,
'infinite' );
175 $protectDescription =
'';
177 foreach ( $details as $param ) {
182 $action = $this->context->msg(
'restriction-' . $param[
'type'] )->escaped();
184 $protectionLevel = $param[
'level'];
186 $message = $this->context->msg(
'protect-level-' . $protectionLevel );
187 if ( $message->isDisabled() ) {
189 $restrictions = $this->context->msg(
"protect-fallback", $protectionLevel )->parse();
191 $restrictions = $message->escaped();
194 if ( $protectDescription !==
'' ) {
195 $protectDescription .= $this->context->msg(
'word-separator' )->escaped();
198 $protectDescription .= $this->context->msg(
'protect-summary-desc' )
199 ->params( $action, $restrictions, $expiryText )->escaped();
202 return $protectDescription;
207 return $this->context->msg(
'protect-expiry-indefinite' )->text();
209 $lang = $this->context->getLanguage();
210 $user = $this->context->getUser();
211 return $this->context->msg(
212 'protect-expiring-local',
213 $lang->userTimeAndDate( $expiry, $user ),
214 $lang->userDate( $expiry, $user ),
215 $lang->userTime( $expiry, $user )