44 '' => [
'type' =>
'',
'class' =>
'InvalidPassword' ],
54 $config[
'type'] =
$type;
55 $this->types[
$type] = $config;
65 if ( !isset( $this->types[
$type] ) ) {
66 throw new InvalidArgumentException(
"Invalid password type $type." );
68 $this->
default =
$type;
77 return $this->default;
114 if ( $hash ===
null || $hash ===
false || $hash ===
'' ) {
116 } elseif ( $hash[0] !==
':' ) {
120 $type = substr( $hash, 1, strpos( $hash,
':', 1 ) - 1 );
121 if ( !isset( $this->types[
$type] ) ) {
122 throw new PasswordError(
"Unrecognized password hash type $type." );
125 $config = $this->types[
$type];
127 return new $config[
'class']( $this, $config, $hash );
138 if ( !isset( $this->types[
$type] ) ) {
139 throw new PasswordError(
"Unrecognized password hash type $type." );
142 $config = $this->types[
$type];
144 return new $config[
'class']( $this, $config );
158 if ( $password ===
null ) {
162 if ( $existing ===
null ) {
163 $config = $this->types[$this->default];
164 $obj =
new $config[
'class']( $this, $config );
166 $obj = clone $existing;
169 $obj->crypt( $password );
185 if ( $password->
getType() !== $this->default ) {
201 $length = max( 10, $minLength );
206 return substr( Wikimedia\base_convert( $hex, 16, 32, $length ), -$length );
215 static $password =
null;
217 if ( $password ===
null ) {
218 $factory =
new self();
Represents an invalid password hash.
static generateHex( $chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
Show an error when any operation involving passwords fails to run.
Factory class for creating and checking Password objects.
getDefaultType()
Get the default password type.
string $default
The default PasswordHash type.
static generateRandomPasswordString( $minLength=10)
Generate a random string suitable for a password.
newFromType( $type)
Make a new default password of the given type.
needsUpdate(Password $password)
Determine whether a password object needs updating.
setDefaultType( $type)
Set the default password type.
init(Config $config)
Initialize the internal static variables using the global variables.
getTypes()
Get the list of types of passwords.
static newInvalidPassword()
Create an InvalidPassword.
array $types
Mapping of password types to classes.
newFromCiphertext( $hash)
Create a new Hash object from an existing string hash.
newFromPlaintext( $password, Password $existing=null)
Create a new Hash object from a plaintext password.
Represents a password hash for use in authentication.
getType()
Get the type name of the password.
needsUpdate()
Determine if the hash needs to be updated.
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
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
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
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".