r51587 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51586‎ | r51587 | r51588 >
Date:10:26, 8 June 2009
Author:tstarling
Status:deferred
Tags:
Comment:
(bug 18846) Remove update_password_format(), unnecessary, destroys all passwords if a wiki with $wgPasswordSalt=false is upgraded with the web installer.
Modified paths:
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updaters.inc
@@ -144,7 +144,6 @@
145145 array( 'check_bin', 'protected_titles', 'pt_title', 'patch-pt_title-encoding.sql', ),
146146 array( 'maybe_do_profiling_memory_update' ),
147147 array( 'do_filearchive_indices_update' ),
148 - array( 'update_password_format' ),
149148
150149 // 1.14
151150 array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
@@ -266,41 +265,6 @@
267266 }
268267 }
269268
270 -function do_revision_updates() {
271 - global $wgSoftwareRevision;
272 - if ( $wgSoftwareRevision < 1001 ) {
273 - update_passwords();
274 - }
275 -}
276 -
277 -function update_passwords() {
278 - wfDebugDieBacktrace( "This function needs to be updated or removed.\n" );
279 -
280 - global $wgDatabase;
281 - $fname = "Update script: update_passwords()";
282 - wfOut( "\nIt appears that you need to update the user passwords in your\n" .
283 - "database. If you have already done this (if you've run this update\n" .
284 - "script once before, for example), doing so again will make all your\n" .
285 - "user accounts inaccessible, so be sure you only do this once.\n" .
286 - "Update user passwords? (yes/no)" );
287 -
288 - $resp = readconsole();
289 - if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; }
290 -
291 - $sql = "SELECT user_id,user_password FROM user";
292 - $source = $wgDatabase->query( $sql, $fname );
293 -
294 - while ( $row = $wgDatabase->fetchObject( $source ) ) {
295 - $id = $row->user_id;
296 - $oldpass = $row->user_password;
297 - $newpass = md5( "{$id}-{$oldpass}" );
298 -
299 - $sql = "UPDATE user SET user_password='{$newpass}' " .
300 - "WHERE user_id={$id}";
301 - $wgDatabase->query( $sql, $fname );
302 - }
303 -}
304 -
305269 function do_interwiki_update() {
306270 # Check that interwiki table exists; if it doesn't source it
307271 global $wgDatabase, $IP;
@@ -1263,29 +1227,6 @@
12641228 populate_rev_parent_id( $wgDatabase );
12651229 }
12661230
1267 -function update_password_format() {
1268 - if ( update_row_exists( 'password format' ) ) {
1269 - wfOut( "...password hash format already changed\n" );
1270 - return;
1271 - }
1272 -
1273 - wfOut( "Updating password hash format..." );
1274 -
1275 - global $wgDatabase, $wgPasswordSalt;
1276 - $user = $wgDatabase->tableName( 'user' );
1277 - if ( $wgPasswordSalt ) {
1278 - $sql = "UPDATE $user SET user_password=CONCAT(':B:', user_id, ':', user_password) " .
1279 - "WHERE user_password NOT LIKE ':%'";
1280 - } else {
1281 - $sql = "UPDATE $user SET user_password=CONCAT(':A:', user_password) " .
1282 - "WHERE user_password NOT LIKE ':%'";
1283 - }
1284 - $wgDatabase->query( $sql, __METHOD__ );
1285 - $wgDatabase->insert( 'updatelog', array( 'ul_key' => 'password format' ), __METHOD__ );
1286 -
1287 - wfOut( "done\n" );
1288 -}
1289 -
12901231 function sqlite_initial_indexes() {
12911232 global $wgDatabase;
12921233 if ( update_row_exists( 'initial_indexes' ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r51640Backported r51587 (avoids password failure after upgrade), tweaked release no...tstarling12:58, 9 June 2009

Status & tagging log