MediaWiki REL1_28
Go to the documentation of this file.
22namespace MediaWiki\Auth;
33 protected $name;
36 protected $label;
39 protected $help;
47 public function __construct( $name, Message $label, Message $help, $required = false ) {
48 $this->name = $name;
49 $this->label = $label;
50 $this->help = $help;
51 $this->required = $required ? self::REQUIRED : self::OPTIONAL;
52 }
54 public function getUniqueId() {
55 return parent::getUniqueId() . ':' . $this->name;
56 }
58 public function getFieldInfo() {
59 return [
60 $this->name => [
61 'type' => 'button',
62 'label' => $this->label,
63 'help' => $this->help,
64 ]
65 ];
66 }
75 public static function getRequestByName( array $reqs, $name ) {
76 $requests = array_filter( $reqs, function ( $req ) use ( $name ) {
77 return $req instanceof ButtonAuthenticationRequest && $req->name === $name;
78 } );
79 return count( $requests ) === 1 ? reset( $requests ) : null;
80 }
87 public static function __set_state( $data ) {
88 if ( !isset( $data['label'] ) ) {
89 $data['label'] = new \RawMessage( '$1', $data['name'] );
90 } elseif ( is_string( $data['label'] ) ) {
91 $data['label'] = new \Message( $data['label'] );
92 } elseif ( is_array( $data['label'] ) ) {
93 $data['label'] = call_user_func_array( 'Message::newFromKey', $data['label'] );
94 }
95 if ( !isset( $data['help'] ) ) {
96 $data['help'] = new \RawMessage( '$1', $data['name'] );
97 } elseif ( is_string( $data['help'] ) ) {
98 $data['help'] = new \Message( $data['help'] );
99 } elseif ( is_array( $data['help'] ) ) {
100 $data['help'] = call_user_func_array( 'Message::newFromKey', $data['help'] );
101 }
102 $ret = new static( $data['name'], $data['label'], $data['help'] );
103 foreach ( $data as $k => $v ) {
104 $ret->$k = $v;
105 }
106 return $ret;
107 }
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This is a value object for authentication requests.
Indicates that the request is not required for authentication to proceed.
int $required
For login, continue, and link actions, one of self::OPTIONAL, self::REQUIRED, or self::PRIMARY_REQUIR...
Indicates that the request is required for authentication to proceed.
This is an authentication request that just implements a simple button.
static getRequestByName(array $reqs, $name)
Fetch a ButtonAuthenticationRequest or subclass by name.
Supply a unique key for deduplication.
__construct( $name, Message $label, Message $help, $required=false)
The Message class provides methods which fulfil two basic services:
Definition Message.php:159
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
Definition design.txt:12
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only $req
Definition hooks.txt:1010
the array() calling protocol came about after MediaWiki 1.4rc1.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition hooks.txt:1949
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead. & $feedLinks hooks can tweak the array to change how login etc forms should look $requests
Definition hooks.txt:306
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37