|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00030 function xmldb_auth_manual_upgrade($oldversion) { 00031 global $CFG, $DB, $OUTPUT; 00032 00033 if ($oldversion < 2011022700) { 00034 // force creation of missing passwords 00035 $createpassword = hash_internal_user_password(''); 00036 $rs = $DB->get_recordset('user', array('password'=>$createpassword, 'auth'=>'manual')); 00037 foreach ($rs as $user) { 00038 if (validate_email($user->email)) { 00039 $DB->set_field('user', 'password', 'to be created', array('id'=>$user->id)); 00040 unset_user_preference('auth_forcepasswordchange', $user); 00041 set_user_preference('create_password', 1, $user); 00042 } 00043 } 00044 $rs->close(); 00045 upgrade_plugin_savepoint(true, 2011022700, 'auth', 'manual'); 00046 } 00047 00048 // Moodle v2.1.0 release upgrade line 00049 // Put any upgrade step following this 00050 00051 // Moodle v2.2.0 release upgrade line 00052 // Put any upgrade step following this 00053 00054 return true; 00055 }