镜像自地址
https://github.com/wikimedia/mediawiki-extensions-CentralAuth
已同步 2024-06-02 18:30:55 +08:00
比较提交
2 次代码提交
78ac523bd5
...
6b8bf7ebbd
作者 | SHA1 | 提交日期 | |
---|---|---|---|
|
6b8bf7ebbd | ||
|
7252447be2 |
|
@ -41,7 +41,7 @@ class WrapOldPasswordHashes extends Maintenance {
|
|||
'Password type to wrap passwords in (must inherit LayeredParameterizedPassword)', true, true );
|
||||
$this->addOption( 'verbose', 'Enables verbose output', false, false, 'v' );
|
||||
$this->addOption( 'update', 'Actually wrap passwords', false, false, 'u' );
|
||||
$this->setBatchSize( 100 );
|
||||
$this->setBatchSize( 3 );
|
||||
$this->requireExtension( 'CentralAuth' );
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class WrapOldPasswordHashes extends Maintenance {
|
|||
|
||||
$count = 0;
|
||||
$minUserId = 0;
|
||||
do {
|
||||
while ( true ) {
|
||||
if ( $update ) {
|
||||
$this->beginTransaction( $dbw, __METHOD__ );
|
||||
}
|
||||
|
@ -97,6 +97,13 @@ class WrapOldPasswordHashes extends Maintenance {
|
|||
]
|
||||
);
|
||||
|
||||
if ( $res->numRows() === 0 ) {
|
||||
if ( $update ) {
|
||||
$this->commitTransaction( $dbw, __METHOD__ );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/** @var CentralAuthUser[] $updateUsers */
|
||||
$updateUsers = [];
|
||||
foreach ( $res as $row ) {
|
||||
|
@ -132,7 +139,6 @@ class WrapOldPasswordHashes extends Maintenance {
|
|||
|
||||
if ( $update ) {
|
||||
$this->commitTransaction( $dbw, __METHOD__ );
|
||||
$databaseManager->waitForReplication();
|
||||
|
||||
// Clear memcached so old passwords are wiped out
|
||||
foreach ( $updateUsers as $user ) {
|
||||
|
@ -144,11 +150,11 @@ class WrapOldPasswordHashes extends Maintenance {
|
|||
$delta = microtime( true ) - $start;
|
||||
$this->output( sprintf(
|
||||
"%4d passwords wrapped in %6.2fms (%6.2fms each)\n",
|
||||
$batchSize,
|
||||
$res->numRows(),
|
||||
$delta * 1000.0,
|
||||
( $delta / $batchSize ) * 1000.0
|
||||
( $delta / $res->numRows() ) * 1000.0
|
||||
) );
|
||||
} while ( $res->numRows() );
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
$this->output( "$count users rows updated.\n" );
|
||||
|
|
正在加载...
在新工单中引用
屏蔽一个用户