logging: Replace deprecated use of CommentStore::getStore()
[lhc/web/wiklou.git] / includes / logging / LogPage.php
index af99940..1fc56bb 100644 (file)
@@ -104,7 +104,11 @@ class LogPage {
                        'log_page' => $this->target->getArticleID(),
                        'log_params' => $this->params
                ];
-               $data += CommentStore::getStore()->insert( $dbw, 'log_comment', $this->comment );
+               $data += MediaWikiServices::getInstance()->getCommentStore()->insert(
+                       $dbw,
+                       'log_comment',
+                       $this->comment
+               );
                $data += ActorMigration::newMigration()->getInsertValues( $dbw, 'log_user', $this->doer );
                $dbw->insert( 'logging', $data, __METHOD__ );
                $newId = $dbw->insertId();
@@ -385,7 +389,7 @@ class LogPage {
         */
        public function addRelations( $field, $values, $logid ) {
                if ( !strlen( $field ) || empty( $values ) ) {
-                       return false; // nothing
+                       return false;
                }
 
                $data = [];
@@ -437,11 +441,7 @@ class LogPage {
                global $wgLogNames;
 
                // BC
-               if ( isset( $wgLogNames[$this->type] ) ) {
-                       $key = $wgLogNames[$this->type];
-               } else {
-                       $key = 'log-name-' . $this->type;
-               }
+               $key = $wgLogNames[$this->type] ?? 'log-name-' . $this->type;
 
                return wfMessage( $key );
        }
@@ -454,11 +454,7 @@ class LogPage {
        public function getDescription() {
                global $wgLogHeaders;
                // BC
-               if ( isset( $wgLogHeaders[$this->type] ) ) {
-                       $key = $wgLogHeaders[$this->type];
-               } else {
-                       $key = 'log-description-' . $this->type;
-               }
+               $key = $wgLogHeaders[$this->type] ?? 'log-description-' . $this->type;
 
                return wfMessage( $key );
        }
@@ -470,14 +466,8 @@ class LogPage {
         */
        public function getRestriction() {
                global $wgLogRestrictions;
-               if ( isset( $wgLogRestrictions[$this->type] ) ) {
-                       $restriction = $wgLogRestrictions[$this->type];
-               } else {
-                       // '' always returns true with $user->isAllowed()
-                       $restriction = '';
-               }
-
-               return $restriction;
+               // '' always returns true with $user->isAllowed()
+               return $wgLogRestrictions[$this->type] ?? '';
        }
 
        /**