Page MenuHomePhabricator
Authored By
abi_
May 17 2021, 3:09 PM
Size
1 KB
Referenced Files
None
Subscribers
None

T282905.patch

diff --git a/api/ApiAggregateGroups.php b/api/ApiAggregateGroups.php
index 7e403d841..42704c6fc 100644
--- a/api/ApiAggregateGroups.php
+++ b/api/ApiAggregateGroups.php
@@ -8,6 +8,8 @@
* @license GPL-2.0-or-later
*/
+use MediaWiki\Logger\LoggerFactory;
+
/**
* API module for managing aggregate message groups
* Only supports aggregate message groups defined inside the wiki.
@@ -89,9 +91,21 @@ class ApiAggregateGroups extends ApiBase {
if ( !isset( $params['aggregategroup'] ) ) {
$this->dieWithError( [ 'apierror-missingparam', 'aggregategroup' ] );
}
- TranslateMetadata::deleteGroup( $params['aggregategroup'] );
- // @todo Logging
+ $aggregateGroupId = $params['aggregategroup'];
+ $group = MessageGroups::getGroup( $aggregateGroupId );
+ if ( !$group || !( $group instanceof AggregateMessageGroup ) ) {
+ $this->dieWithError(
+ 'apierror-translate-invalidaggregategroupname', 'invalidaggregategroupname'
+ );
+ }
+
+ TranslateMetadata::deleteGroup( $params['aggregategroup'] );
+ $logger = LoggerFactory::getInstance( 'Translate' );
+ $logger->info(
+ 'Aggregate group {groupId} has been deleted.',
+ [ 'groupId' => $aggregateGroupId ]
+ );
} elseif ( $action === 'add' ) {
if ( !isset( $params['groupname'] ) ) {
$this->dieWithError( [ 'apierror-missingparam', 'groupname' ] );

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9075433
Default Alt Text
T282905.patch (1 KB)

Event Timeline