Skip to content

Commit

Permalink
Fix support for 1.42 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Jul 18, 2024
1 parent 78a9a21 commit 1811492
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license-name": "GPL-3.0-or-later",
"type": "specialpage",
"requires": {
"MediaWiki": ">= 1.41.0"
"MediaWiki": ">= 1.42.0"
},
"MessagesDirs": {
"RemovePII": [
Expand Down
11 changes: 6 additions & 5 deletions includes/SpecialRemovePII.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use MediaWiki\Html\Html;
use MediaWiki\Http\HttpRequestFactory;
use MediaWiki\JobQueue\JobQueueGroupFactory;
use MediaWiki\Message\Message;
use MediaWiki\SpecialPage\FormSpecialPage;
use MediaWiki\SpecialPage\SpecialPage;
use MediaWiki\Status\Status;
Expand Down Expand Up @@ -145,11 +146,11 @@ protected function getFormFields() {
/**
* @param ?string $value
* @param array $alldata
* @return bool|string
* @return string|bool|Message
*/
public function isMatchingAssociatedDPARequest( ?string $value, array $alldata ) {
if ( !$value ) {
return Status::newFatal( 'htmlform-required' )->getMessage();
return $this->msg( 'htmlform-required' );
}

if ( !$this->config->get( 'RemovePIIDPAValidationEndpoint' ) ) {
Expand All @@ -165,12 +166,12 @@ public function isMatchingAssociatedDPARequest( ?string $value, array $alldata )
$report = $this->httpRequestFactory->create( $url );
$status = $report->execute();
if ( !$status->isOK() ) {
return Status::newFatal( 'removepii-invalid-dpa' )->getMessage();
return $this->msg( 'removepii-invalid-dpa' );
}

$content = FormatJson::decode( $report->getContent(), true );
if ( !( $content['match'] ?? false ) ) {
return Status::newFatal( 'removepii-invalid-dpa' )->getMessage();
return $this->msg( 'removepii-invalid-dpa' );
}

return true;
Expand Down Expand Up @@ -242,7 +243,7 @@ public function onSubmit( array $formData ) {
CentralAuthUser::getInstance( $oldUser ),
$newUser,
CentralAuthUser::getInstance( $newUser ),
new GlobalRenameUserStatus( $newUser->getName() ),
new GlobalRenameUserStatus( $this->centralAuthDatabaseManager, $newUser->getName() ),
$this->jobQueueGroupFactory,
new GlobalRenameUserDatabaseUpdates( $this->centralAuthDatabaseManager ),
new RemovePIIGlobalRenameUserLogger( $this->getUser() ),
Expand Down

0 comments on commit 1811492

Please sign in to comment.