Merge "output: Narrow Title type hint to LinkTarget"
[lhc/web/wiklou.git] / includes / logging / ProtectLogFormatter.php
index 931829a..6e3b26b 100644 (file)
@@ -22,6 +22,8 @@
  * @since 1.26
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * This class formats protect log entries.
  *
@@ -99,7 +101,10 @@ class ProtectLogFormatter extends LogFormatter {
                ];
 
                // Show change protection link
-               if ( $this->context->getUser()->isAllowed( 'protect' ) ) {
+               if ( !MediaWikiServices::getInstance()
+                               ->getPermissionManager()
+                               ->userHasRight( $this->context->getUser(), 'protect' )
+               ) {
                        $links[] = $linkRenderer->makeKnownLink(
                                $title,
                                $this->msg( 'protect_change' )->text(),
@@ -146,13 +151,13 @@ class ProtectLogFormatter extends LogFormatter {
        }
 
        public function formatParametersForApi() {
-               global $wgContLang;
-
                $ret = parent::formatParametersForApi();
                if ( isset( $ret['details'] ) && is_array( $ret['details'] ) ) {
+                       $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                        foreach ( $ret['details'] as &$detail ) {
                                if ( isset( $detail['expiry'] ) ) {
-                                       $detail['expiry'] = $wgContLang->formatExpiry( $detail['expiry'], TS_ISO_8601, 'infinite' );
+                                       $detail['expiry'] = $contLang->
+                                               formatExpiry( $detail['expiry'], TS_ISO_8601, 'infinite' );
                                }
                        }
                }