mediawiki-extensions-OATHAuth/maintenance/updateTOTPScratchTokensToArray.php
Reedy 57505f1976 Drop DB updates from pre MW 1.35
updateDatabaseValueFormat and updateTOTPToMultipleKeys are from 1.34:
Iaf9facb54cd9693f20ed2f48d22b076c4b626705
I71286534d21d95083436d64d79811943c1a1d032

updateTOTPScratchTokensToArray is from 1.36:
Ie8de059888363bf1cea4f0b268a46faaa5671904

Change-Id: I6de64d95b2e4b132d321b6f8f0129c476ef00f7f
2023-12-22 00:42:50 +00:00

55 lines
1.7 KiB
PHP

<?php
/**
* Updates TOTP Scratch Tokens to an array
*
* Usage: php updateTOTPScratchTokensToArray.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Maintenance
*/
use MediaWiki\Extension\OATHAuth\Hook\UpdateTables;
if ( getenv( 'MW_INSTALL_PATH' ) ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {
$IP = __DIR__ . '/../../..';
}
require_once "$IP/maintenance/Maintenance.php";
/**
* Merged December 2020; part of REL1_36
*/
class UpdateTOTPScratchTokensToArray extends Maintenance {
public function __construct() {
parent::__construct();
$this->addDescription( 'Script to update TOTP Scratch Tokens to an array' );
$this->requireExtension( 'OATHAuth' );
}
public function execute() {
if ( !UpdateTables::switchTOTPScratchTokensToArray() ) {
$this->fatalError( "Failed to update TOTP Scratch Tokens.\n" );
}
$this->output( "Done.\n" );
}
}
$maintClass = UpdateTOTPScratchTokensToArray::class;
require_once RUN_MAINTENANCE_IF_MAIN;