28 parent::__construct( $mainModule, $moduleName );
34 $emailUser = $this->emailUserFactory->newEmailUser( $this->
getAuthority() );
35 $targetUser = $this->userFactory->newFromName( $params[
'target'] );
37 if ( $targetUser ===
null ) {
44 $status = $emailUser->validateTarget( $targetUser );
46 if ( !$status->isOK() ) {
51 $error = $emailUser->canSend();
53 if ( !$error->isGood() ) {
57 $retval = $emailUser->sendEmailUnsafe(
65 if ( !$retval instanceof
Status ) {
67 $retval = Status::newFatal(
'hookaborted' );
70 $result = array_filter( [
71 'result' => $retval->isGood() ?
'Success' : ( $retval->isOK() ?
'Warnings' :
'Failure' ),
93 ParamValidator::PARAM_TYPE =>
'string',
94 ParamValidator::PARAM_REQUIRED => true
97 ParamValidator::PARAM_TYPE =>
'string',
98 ParamValidator::PARAM_REQUIRED => true
101 ParamValidator::PARAM_TYPE =>
'text',
102 ParamValidator::PARAM_REQUIRED => true
116 'action=emailuser&target=WikiSysop&text=Content&token=123ABC'
117 =>
'apihelp-emailuser-example-email',
123 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Email';
128class_alias( ApiEmailUser::class,
'ApiEmailUser' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This is the main API class, used for both external and internal processing.