35 global $wgOATHAuthDatabase;
37 static $service =
null;
39 if ( $service ==
null ) {
40 $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
42 $factory->getMainLB( $wgOATHAuthDatabase ),
66 if ( isset( $fieldInfo[
'OATHToken'] ) ) {
68 'cssClass' =>
'loginText',
69 'id' =>
'wpOATHToken',
72 'persistent' =>
false,
73 'autocomplete' =>
false,
74 'spellcheck' =>
false,
94 if ( $user && $user->getKey() !==
null ) {
96 # This two-factor extension is enabled by the user,
97 # we don't need to check others.
101 # This two-factor extension isn't enabled by the user,
119 if ( $oathUser->getKey() ===
null && !$user->isAllowed(
'oathauth-enable' ) ) {
123 $msg = $oathUser->getKey() !==
null ?
'oathauth-disable' :
'oathauth-enable';
125 $control = new \OOUI\ButtonWidget( [
126 'href' => SpecialPage::getTitleFor(
'OATH' )->getLinkURL( [
127 'returnto' => SpecialPage::getTitleFor(
'Preferences' )->getPrefixedText()
132 $preferences[$msg] = [
135 'default' => (
string)$control,
136 'label-message' =>
'oathauth-prefs-label',
137 'section' =>
'personal/info', ];
147 $base = dirname( __DIR__ );
148 switch (
$updater->getDB()->getType() ) {
151 $updater->addExtensionTable(
'oathauth_users',
"$base/sql/mysql/tables.sql" );
152 $updater->addExtensionUpdate( [ [ __CLASS__,
'schemaUpdateOldUsersFromInstaller' ] ] );
156 "$base/sql/mysql/patch-remove_reset.sql"
161 $updater->addExtensionTable(
'oathauth_users',
"$base/sql/oracle/tables.sql" );
165 $updater->addExtensionTable(
'oathauth_users',
"$base/sql/postgres/tables.sql" );
192 if ( !$db->
fieldExists(
'oathauth_users',
'secret_reset' ) ) {
198 [
'id',
'scratch_tokens' ],
199 [
'is_validated != 0' ],
203 foreach (
$res as $row ) {
204 Wikimedia\suppressWarnings();
205 $scratchTokens =
unserialize( base64_decode( $row->scratch_tokens ) );
206 Wikimedia\restoreWarnings();
207 if ( $scratchTokens ) {
210 [
'scratch_tokens' => implode(
',', $scratchTokens ) ],
211 [
'id' => $row->id ],
218 $db->
delete(
'oathauth_users', [
'is_validated' => 0 ], __METHOD__ );
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
unserialize( $serialized)
Class for handling database updates.
Simple store for keeping values in an associative array for the current process.
Hooks for Extension:OATHAuth.
static onTwoFactorIsEnabled(&$isEnabled)
Determine if two-factor authentication is enabled for $wgUser.
static onLoadExtensionSchemaUpdates( $updater)
static getOATHUserRepository()
Get the singleton OATH user repository.
static schemaUpdateOldUsers(IDatabase $db)
Helper function for converting old users to the new schema.
static onAuthChangeFormFields(array $requests, array $fieldInfo, array &$formDescriptor, $action)
static onGetPreferences(User $user, array &$preferences)
Add the necessary user preferences for OATHAuth.
static schemaUpdateOldUsersFromInstaller(DatabaseUpdater $updater)
Helper function for converting old users to the new schema.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
$page->newPageUpdater($user) $updater