From: Tim Starling Date: Mon, 8 Jun 2009 10:26:11 +0000 (+0000) Subject: (bug 18846) Remove update_password_format(), unnecessary, destroys all passwords... X-Git-Tag: 1.31.0-rc.0~41448 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=06810eead1add10a1636d9195d62f5f6ca05071f;p=lhc%2Fweb%2Fwiklou.git (bug 18846) Remove update_password_format(), unnecessary, destroys all passwords if a wiki with $wgPasswordSalt=false is upgraded with the web installer. --- diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 6f8d0ef6ae..e9cdbae236 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -144,7 +144,6 @@ $wgUpdates = array( array( 'check_bin', 'protected_titles', 'pt_title', 'patch-pt_title-encoding.sql', ), array( 'maybe_do_profiling_memory_update' ), array( 'do_filearchive_indices_update' ), - array( 'update_password_format' ), // 1.14 array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ), @@ -266,41 +265,6 @@ function add_index( $table, $index, $patch, $fullpath=false ) { } } -function do_revision_updates() { - global $wgSoftwareRevision; - if ( $wgSoftwareRevision < 1001 ) { - update_passwords(); - } -} - -function update_passwords() { - wfDebugDieBacktrace( "This function needs to be updated or removed.\n" ); - - global $wgDatabase; - $fname = "Update script: update_passwords()"; - wfOut( "\nIt appears that you need to update the user passwords in your\n" . - "database. If you have already done this (if you've run this update\n" . - "script once before, for example), doing so again will make all your\n" . - "user accounts inaccessible, so be sure you only do this once.\n" . - "Update user passwords? (yes/no)" ); - - $resp = readconsole(); - if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; } - - $sql = "SELECT user_id,user_password FROM user"; - $source = $wgDatabase->query( $sql, $fname ); - - while ( $row = $wgDatabase->fetchObject( $source ) ) { - $id = $row->user_id; - $oldpass = $row->user_password; - $newpass = md5( "{$id}-{$oldpass}" ); - - $sql = "UPDATE user SET user_password='{$newpass}' " . - "WHERE user_id={$id}"; - $wgDatabase->query( $sql, $fname ); - } -} - function do_interwiki_update() { # Check that interwiki table exists; if it doesn't source it global $wgDatabase, $IP; @@ -1263,29 +1227,6 @@ function do_populate_parent_id() { populate_rev_parent_id( $wgDatabase ); } -function update_password_format() { - if ( update_row_exists( 'password format' ) ) { - wfOut( "...password hash format already changed\n" ); - return; - } - - wfOut( "Updating password hash format..." ); - - global $wgDatabase, $wgPasswordSalt; - $user = $wgDatabase->tableName( 'user' ); - if ( $wgPasswordSalt ) { - $sql = "UPDATE $user SET user_password=CONCAT(':B:', user_id, ':', user_password) " . - "WHERE user_password NOT LIKE ':%'"; - } else { - $sql = "UPDATE $user SET user_password=CONCAT(':A:', user_password) " . - "WHERE user_password NOT LIKE ':%'"; - } - $wgDatabase->query( $sql, __METHOD__ ); - $wgDatabase->insert( 'updatelog', array( 'ul_key' => 'password format' ), __METHOD__ ); - - wfOut( "done\n" ); -} - function sqlite_initial_indexes() { global $wgDatabase; if ( update_row_exists( 'initial_indexes' ) ) {