Add services and utilities for automatic creation of temporary user accounts on page save, in order to avoid exposing the user's IP address. * Add $wgAutoCreateTempUser, for configuring the system * Add TempUserConfig service, which interprets the config. * Add TempUserCreator service, which creates users during page save as requested by EditPage. With proxy methods to TempUserConfig for convenience. * Add table user_autocreate_serial. Table creation is necessary before the feature is enabled but is not necessary before deployment of this commit. Bug: T300263 Change-Id: Ib14a352490fc42039106523118e8d021844e3dfb
29 lines
694 B
PHP
29 lines
694 B
PHP
<?php
|
|
|
|
namespace MediaWiki\User\TempUser;
|
|
|
|
use Language;
|
|
use MediaWiki\Languages\LanguageFactory;
|
|
|
|
/**
|
|
* Serial mapping which uses a Language object to format serial numbers.
|
|
*
|
|
* @since 1.39
|
|
*/
|
|
class LocalizedNumericSerialMapping implements SerialMapping {
|
|
/** @var Language */
|
|
private $language;
|
|
|
|
/**
|
|
* @param array $config
|
|
* - language: The language code
|
|
* @param LanguageFactory $languageFactory
|
|
*/
|
|
public function __construct( $config, LanguageFactory $languageFactory ) {
|
|
$this->language = $languageFactory->getLanguage( $config['language'] ?? 'en' );
|
|
}
|
|
|
|
public function getSerialIdForIndex( int $index ): string {
|
|
return $this->language->formatNum( $index );
|
|
}
|
|
}
|