jenkins-bot has submitted this change and it was merged. Change subject: Fix old log params of log type rights for new api logparam style ......................................................................
Fix old log params of log type rights for new api logparam style The log param of right changes can also just be a string. The new api logparam style does not recognize this and shows an error: Argument 1 passed to ApiResult::setIndexedTagName() must be an instance of array, string given Centralize the code in a new helper function and use it also for the gui part. Follow-Up: I6846ce09322eb404c506b5a51780a44ce9279fe2 Change-Id: I4762743b3f43e6ebd806d3ae516507ae66478e96 --- M includes/logging/RightsLogFormatter.php 1 file changed, 15 insertions(+), 14 deletions(-) Approvals: Anomie: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/logging/RightsLogFormatter.php b/includes/logging/RightsLogFormatter.php index 597bec5..f69530c 100644 --- a/includes/logging/RightsLogFormatter.php +++ b/includes/logging/RightsLogFormatter.php @@ -67,20 +67,8 @@ return $params; } - $oldGroups = $params[3]; - $newGroups = $params[4]; - - // Less old entries - if ( $oldGroups === '' ) { - $oldGroups = array(); - } elseif ( is_string( $oldGroups ) ) { - $oldGroups = array_map( 'trim', explode( ',', $oldGroups ) ); - } - if ( $newGroups === '' ) { - $newGroups = array(); - } elseif ( is_string( $newGroups ) ) { - $newGroups = array_map( 'trim', explode( ',', $newGroups ) ); - } + $oldGroups = $this->makeGroupArray( $params[3] ); + $newGroups = $this->makeGroupArray( $params[4] ); $userName = $this->entry->getTarget()->getText(); if ( !$this->plaintext && count( $oldGroups ) ) { @@ -128,6 +116,9 @@ } } + $params['4:array:oldgroups'] = $this->makeGroupArray( $params['4:array:oldgroups'] ); + $params['5:array:newgroups'] = $this->makeGroupArray( $params['5:array:newgroups'] ); + return $params; } @@ -141,4 +132,14 @@ } return $ret; } + + private function makeGroupArray( $group ) { + // Migrate old group params from string to array + if ( $group === '' ) { + $group = array(); + } elseif ( is_string( $group ) ) { + $group = array_map( 'trim', explode( ',', $group ) ); + } + return $group; + } } -- To view, visit https://gerrit.wikimedia.org/r/204793 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4762743b3f43e6ebd806d3ae516507ae66478e96 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits