PageRenderTime 54ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/lib/db/mysql.php

https://bitbucket.org/ceu/moodle_demo
PHP | 2337 lines | 2076 code | 200 blank | 61 comment | 192 complexity | ca7c60181389ebaee069c7f2d189397d MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?PHP //$Id: mysql.php,v 1.256.2.3 2011/08/30 23:43:19 moodlerobot Exp $
  2. // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
  3. //
  4. // IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
  5. // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
  6. //
  7. //
  8. // This file is tailored to MySQL
  9. function main_upgrade($oldversion=0) {
  10. global $CFG, $THEME, $db;
  11. $result = true;
  12. if ($oldversion == 0) {
  13. execute_sql("
  14. CREATE TABLE `config` (
  15. `id` int(10) unsigned NOT NULL auto_increment,
  16. `name` varchar(255) NOT NULL default '',
  17. `value` varchar(255) NOT NULL default '',
  18. PRIMARY KEY (`id`),
  19. UNIQUE KEY `name` (`name`)
  20. ) COMMENT='Moodle configuration variables';");
  21. notify("Created a new table 'config' to hold configuration data");
  22. }
  23. if ($oldversion < 2002073100) {
  24. execute_sql(" DELETE FROM `modules` WHERE `name` = 'chat' ");
  25. }
  26. if ($oldversion < 2002080200) {
  27. execute_sql(" ALTER TABLE `modules` DROP `fullname` ");
  28. execute_sql(" ALTER TABLE `modules` DROP `search` ");
  29. }
  30. if ($oldversion < 2002080300) {
  31. execute_sql(" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL ");
  32. execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL ");
  33. }
  34. if ($oldversion < 2002082100) {
  35. execute_sql(" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL ");
  36. }
  37. if ($oldversion < 2002082101) {
  38. execute_sql(" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` ");
  39. }
  40. if ($oldversion < 2002090100) {
  41. execute_sql(" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL ");
  42. }
  43. if ($oldversion < 2002090701) {
  44. execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 10 ) DEFAULT '3' NOT NULL ");
  45. execute_sql(" ALTER TABLE `user_teachers` ADD `role` VARCHAR(40) NOT NULL AFTER `authority` ");
  46. }
  47. if ($oldversion < 2002090800) {
  48. execute_sql(" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` ");
  49. execute_sql(" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` ");
  50. }
  51. if ($oldversion < 2002091000) {
  52. execute_sql(" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) NOT NULL DEFAULT '' ");
  53. }
  54. if ($oldversion < 2002091400) {
  55. execute_sql(" ALTER TABLE `user` ADD `lang` VARCHAR( 3 ) DEFAULT 'en' NOT NULL AFTER `country` ");
  56. }
  57. if ($oldversion < 2002091900) {
  58. notify("Most Moodle configuration variables have been moved to the database and can now be edited via the admin page.");
  59. notify("Although it is not vital that you do so, you might want to edit <U>config.php</U> and remove all the unused settings (except the database, URL and directory definitions). See <U>config-dist.php</U> for an example of how your new slim config.php should look.");
  60. }
  61. if ($oldversion < 2002092000) {
  62. execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL ");
  63. }
  64. if ($oldversion < 2002092100) {
  65. execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` ");
  66. }
  67. if ($oldversion < 2002101001) {
  68. execute_sql(" ALTER TABLE `user` ADD `htmleditor` TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL AFTER `maildisplay` ");
  69. }
  70. if ($oldversion < 2002101701) {
  71. execute_sql(" ALTER TABLE `reading` RENAME `resource` "); // Small line with big consequences!
  72. execute_sql(" DELETE FROM `log_display` WHERE module = 'reading'");
  73. execute_sql(" INSERT INTO log_display (module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name') ");
  74. execute_sql(" UPDATE log SET module = 'resource' WHERE module = 'reading' ");
  75. execute_sql(" UPDATE modules SET name = 'resource' WHERE name = 'reading' ");
  76. }
  77. if ($oldversion < 2002102503) {
  78. execute_sql(" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` ");
  79. require_once("$CFG->dirroot/mod/forum/lib.php");
  80. require_once("$CFG->dirroot/course/lib.php");
  81. if (! $module = get_record("modules", "name", "forum")) {
  82. notify("Could not find forum module!!");
  83. return false;
  84. }
  85. // First upgrade the site forums
  86. if ($site = get_site()) {
  87. print_heading("Making News forums editable for main site (moving to section 1)...");
  88. if ($news = forum_get_course_forum($site->id, "news")) {
  89. $mod->course = $site->id;
  90. $mod->module = $module->id;
  91. $mod->instance = $news->id;
  92. $mod->section = 1;
  93. if (! $mod->coursemodule = add_course_module($mod) ) {
  94. notify("Could not add a new course module to the site");
  95. return false;
  96. }
  97. if (! $sectionid = add_mod_to_section($mod) ) {
  98. notify("Could not add the new course module to that section");
  99. return false;
  100. }
  101. if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
  102. notify("Could not update the course module with the correct section");
  103. return false;
  104. }
  105. }
  106. }
  107. // Now upgrade the courses.
  108. if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0")) {
  109. print_heading("Making News and Social forums editable for each course (moving to section 0)...");
  110. foreach ($courses as $course) {
  111. if ($course->format == "social") { // we won't touch them
  112. continue;
  113. }
  114. if ($news = forum_get_course_forum($course->id, "news")) {
  115. $mod->course = $course->id;
  116. $mod->module = $module->id;
  117. $mod->instance = $news->id;
  118. $mod->section = 0;
  119. if (! $mod->coursemodule = add_course_module($mod) ) {
  120. notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'");
  121. return false;
  122. }
  123. if (! $sectionid = add_mod_to_section($mod) ) {
  124. notify("Could not add the new course module to that section");
  125. return false;
  126. }
  127. if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
  128. notify("Could not update the course module with the correct section");
  129. return false;
  130. }
  131. }
  132. if ($social = forum_get_course_forum($course->id, "social")) {
  133. $mod->course = $course->id;
  134. $mod->module = $module->id;
  135. $mod->instance = $social->id;
  136. $mod->section = 0;
  137. if (! $mod->coursemodule = add_course_module($mod) ) {
  138. notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'");
  139. return false;
  140. }
  141. if (! $sectionid = add_mod_to_section($mod) ) {
  142. notify("Could not add the new course module to that section");
  143. return false;
  144. }
  145. if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
  146. notify("Could not update the course module with the correct section");
  147. return false;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. if ($oldversion < 2002111003) {
  154. execute_sql(" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` ");
  155. if ($courses = get_records_sql("SELECT * FROM course")) {
  156. require_once("$CFG->dirroot/course/lib.php");
  157. foreach ($courses as $course) {
  158. $modinfo = serialize(get_array_of_activities($course->id));
  159. if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
  160. notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
  161. }
  162. }
  163. }
  164. }
  165. if ($oldversion < 2002111100) {
  166. print_simple_box_start("CENTER", "", "#FFCCCC");
  167. echo "<FONT SIZE=+1>";
  168. echo "<P>Changes have been made to all built-in themes, to add the new popup navigation menu.";
  169. echo "<P>If you have customised themes, you will need to edit theme/xxxx/header.html as follows:";
  170. echo "<UL><LI>Change anywhere it says <B>$"."button</B> to say <B>$"."menu</B>";
  171. echo "<LI>Add <B>$"."button</B> elsewhere (eg at the end of the navigation bar)</UL>";
  172. echo "<P>See the standard themes for examples, eg: theme/standard/header.html";
  173. print_simple_box_end();
  174. }
  175. if ($oldversion < 2002111200) {
  176. execute_sql(" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` ");
  177. }
  178. if ($oldversion < 2002111400) {
  179. // Rebuild all course caches, because some may not be done in new installs (eg site page)
  180. if ($courses = get_records_sql("SELECT * FROM course")) {
  181. require_once("$CFG->dirroot/course/lib.php");
  182. foreach ($courses as $course) {
  183. $modinfo = serialize(get_array_of_activities($course->id));
  184. if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
  185. notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
  186. }
  187. }
  188. }
  189. }
  190. if ($oldversion < 2002112000) {
  191. set_config("guestloginbutton", 1);
  192. }
  193. if ($oldversion < 2002122300) {
  194. execute_sql("ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
  195. execute_sql("ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
  196. execute_sql("ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
  197. execute_sql("ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
  198. execute_sql("ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
  199. execute_sql("ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
  200. }
  201. if ($oldversion < 2002122700) {
  202. if (! record_exists("log_display", "module", "user", "action", "view")) {
  203. execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') ");
  204. }
  205. }
  206. if ($oldversion < 2003010101) {
  207. delete_records("log_display", "module", "user");
  208. $new->module = "user";
  209. $new->action = "view";
  210. $new->mtable = "user";
  211. $new->field = "CONCAT(firstname,\" \",lastname)";
  212. insert_record("log_display", $new);
  213. delete_records("log_display", "module", "course");
  214. $new->module = "course";
  215. $new->action = "view";
  216. $new->mtable = "course";
  217. $new->field = "fullname";
  218. insert_record("log_display", $new);
  219. $new->action = "update";
  220. insert_record("log_display", $new);
  221. $new->action = "enrol";
  222. insert_record("log_display", $new);
  223. }
  224. if ($oldversion < 2003012200) {
  225. // execute_sql(" ALTER TABLE `log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL ");
  226. // Commented out - see below where it's done properly
  227. }
  228. if ($oldversion < 2003032500) {
  229. modify_database("", "CREATE TABLE `prefix_user_coursecreators` (
  230. `id` int(10) unsigned NOT NULL auto_increment,
  231. `userid` int(10) unsigned NOT NULL default '0',
  232. PRIMARY KEY (`id`),
  233. UNIQUE KEY `id` (`id`)
  234. ) ENGINE=MyISAM COMMENT='One record per course creator';");
  235. }
  236. if ($oldversion < 2003032602) {
  237. // Redoing it because of no prefix last time
  238. execute_sql(" ALTER TABLE `{$CFG->prefix}log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL ");
  239. // Add some indexes for speed
  240. execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(course) ");
  241. execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(userid) ");
  242. }
  243. if ($oldversion < 2003041400) {
  244. table_column("course_modules", "", "visible", "integer", "1", "unsigned", "1", "not null", "score");
  245. }
  246. if ($oldversion < 2003042104) { // Try to update permissions of all files
  247. if ($files = get_directory_list($CFG->dataroot)) {
  248. echo "Attempting to update permissions for all files... ignore any errors.";
  249. foreach ($files as $file) {
  250. echo "$CFG->dataroot/$file<br />";
  251. @chmod("$CFG->dataroot/$file", $CFG->directorypermissions);
  252. }
  253. }
  254. }
  255. if ($oldversion < 2003042400) {
  256. // Rebuild all course caches, because of changes to do with visible variable
  257. if ($courses = get_records_sql("SELECT * FROM {$CFG->prefix}course")) {
  258. require_once("$CFG->dirroot/course/lib.php");
  259. foreach ($courses as $course) {
  260. $modinfo = serialize(get_array_of_activities($course->id));
  261. if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
  262. notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
  263. }
  264. }
  265. }
  266. }
  267. if ($oldversion < 2003042500) {
  268. // Convert all usernames to lowercase.
  269. $users = get_records_sql("SELECT id, username FROM {$CFG->prefix}user");
  270. $cerrors = "";
  271. $rarray = array();
  272. foreach ($users as $user) { // Check for possible conflicts
  273. $lcname = trim(moodle_strtolower($user->username));
  274. if (in_array($lcname, $rarray)) {
  275. $cerrors .= $user->id."->".$lcname.'<br/>' ;
  276. } else {
  277. array_push($rarray,$lcname);
  278. }
  279. }
  280. if ($cerrors != '') {
  281. notify("Error: Cannot convert usernames to lowercase.
  282. Following usernames would overlap (id->username):<br/> $cerrors .
  283. Please resolve overlapping errors.");
  284. $result = false;
  285. }
  286. $cerrors = "";
  287. echo "Checking userdatabase:<br />";
  288. foreach ($users as $user) {
  289. $lcname = trim(moodle_strtolower($user->username));
  290. if ($lcname != $user->username) {
  291. $convert = set_field("user" , "username" , $lcname, "id", $user->id);
  292. if (!$convert) {
  293. if ($cerrors){
  294. $cerrors .= ", ";
  295. }
  296. $cerrors .= $item;
  297. } else {
  298. echo ".";
  299. }
  300. }
  301. }
  302. if ($cerrors != '') {
  303. notify("There were errors when converting following usernames to lowercase.
  304. '$cerrors' . Sorry, but you will need to fix your database by hand.");
  305. $result = false;
  306. }
  307. }
  308. if ($oldversion < 2003042600) {
  309. /// Some more indexes - we need all the help we can get on the logs
  310. //execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(module) ");
  311. //execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(action) ");
  312. }
  313. if ($oldversion < 2003042700) {
  314. /// Changing to multiple indexes
  315. execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX module ", false);
  316. execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX action ", false);
  317. execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX course ", false);
  318. execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX userid ", false);
  319. execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX coursemoduleaction (course,module,action) ");
  320. execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX courseuserid (course,userid) ");
  321. }
  322. if ($oldversion < 2003042801) {
  323. execute_sql("CREATE TABLE `{$CFG->prefix}course_display` (
  324. `id` int(10) unsigned NOT NULL auto_increment,
  325. `course` int(10) unsigned NOT NULL default '0',
  326. `userid` int(10) unsigned NOT NULL default '0',
  327. `display` int(10) NOT NULL default '0',
  328. PRIMARY KEY (`id`),
  329. UNIQUE KEY `id` (`id`),
  330. KEY `courseuserid` (course,userid)
  331. ) ENGINE=MyISAM COMMENT='Stores info about how to display the course'");
  332. }
  333. if ($oldversion < 2003050400) {
  334. table_column("course_sections", "", "visible", "integer", "1", "unsigned", "1", "", "");
  335. }
  336. if ($oldversion < 2003050900) {
  337. table_column("modules", "", "visible", "integer", "1", "unsigned", "1", "", "");
  338. }
  339. if ($oldversion < 2003050902) {
  340. if (get_records("modules", "name", "pgassignment")) {
  341. print_simple_box("Note: the pgassignment module has been removed (it will be replaced later by the workshop module). Go to the new 'Manage Modules' page and DELETE IT from your system", "center", "50%", "$THEME->cellheading", "20", "noticebox");
  342. }
  343. }
  344. if ($oldversion < 2003051600) {
  345. print_simple_box("Thanks for upgrading!<p>There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.", "center", "50%", "$THEME->cellheading", "20", "noticebox");
  346. }
  347. if ($oldversion < 2003052300) {
  348. table_column("user", "", "autosubscribe", "integer", "1", "unsigned", "1", "", "htmleditor");
  349. }
  350. if ($oldversion < 2003072100) {
  351. table_column("course", "", "visible", "integer", "1", "unsigned", "1", "", "marker");
  352. }
  353. if ($oldversion < 2003072101) {
  354. table_column("course_sections", "sequence", "sequence", "text", "", "", "", "", "");
  355. }
  356. if ($oldversion < 2003072800) {
  357. print_simple_box("The following database index improves performance, but can be quite large - if you are upgrading and you have problems with a limited quota you may want to delete this index later from the '{$CFG->prefix}log' table in your database", "center", "50%", "$THEME->cellheading", "20", "noticebox");
  358. flush();
  359. execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX timecoursemoduleaction (time,course,module,action) ");
  360. execute_sql(" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX courseuserid (course,userid) ");
  361. execute_sql(" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX courseuserid (course,userid) ");
  362. }
  363. if ($oldversion < 2003072803) {
  364. table_column("course_categories", "", "description", "text", "", "", "");
  365. table_column("course_categories", "", "parent", "integer", "10", "unsigned");
  366. table_column("course_categories", "", "sortorder", "integer", "10", "unsigned");
  367. table_column("course_categories", "", "courseorder", "text", "", "", "");
  368. table_column("course_categories", "", "visible", "integer", "1", "unsigned", "1");
  369. table_column("course_categories", "", "timemodified", "integer", "10", "unsigned");
  370. }
  371. if ($oldversion < 2003080400) {
  372. table_column("course_categories", "courseorder", "courseorder", "integer", "10", "unsigned");
  373. table_column("course", "", "sortorder", "integer", "10", "unsigned", "0", "", "category");
  374. }
  375. if ($oldversion < 2003080700) {
  376. notify("Cleaning up categories and course ordering...");
  377. fix_course_sortorder();
  378. }
  379. if ($oldversion < 2003081001) {
  380. table_column("course", "format", "format", "varchar", "10", "", "topics");
  381. }
  382. if ($oldversion < 2003081500) {
  383. // print_simple_box("Some important changes have been made to how course creators work. Formerly, they could create new courses and assign teachers, and teachers could edit courses. Now, ordinary teachers can no longer edit courses - they <b>need to be a teacher of a course AND a course creator</b>. A new site-wide configuration variable allows you to choose whether to allow course creators to create new courses as well (by default this is off). <p>The following update will automatically convert all your existing teachers into course creators, to maintain backward compatibility. Make sure you look at your upgraded site carefully and understand these new changes.", "center", "50%", "$THEME->cellheading", "20", "noticebox");
  384. // $count = 0;
  385. // $errorcount = 0;
  386. // if ($teachers = get_records("user_teachers")) {
  387. // foreach ($teachers as $teacher) {
  388. // if (! record_exists("user_coursecreators", "userid", $teacher->userid)) {
  389. // $creator = NULL;
  390. // $creator->userid = $teacher->userid;
  391. // if (!insert_record("user_coursecreators", $creator)) {
  392. // $errorcount++;
  393. // } else {
  394. // $count++;
  395. // }
  396. // }
  397. // }
  398. // }
  399. // print_simple_box("$count teachers were upgraded to course creators (with $errorcount errors)", "center", "50%", "$THEME->cellheading", "20", "noticebox");
  400. }
  401. if ($oldversion < 2003081501) {
  402. execute_sql(" CREATE TABLE `{$CFG->prefix}scale` (
  403. `id` int(10) unsigned NOT NULL auto_increment,
  404. `courseid` int(10) unsigned NOT NULL default '0',
  405. `userid` int(10) unsigned NOT NULL default '0',
  406. `name` varchar(255) NOT NULL default '',
  407. `scale` text NOT NULL,
  408. `description` text NOT NULL,
  409. `timemodified` int(10) unsigned NOT NULL default '0',
  410. PRIMARY KEY (id)
  411. ) ENGINE=MyISAM COMMENT='Defines grading scales'");
  412. }
  413. if ($oldversion < 2003081503) {
  414. table_column("forum", "", "scale", "integer", "10", "unsigned", "0", "", "assessed");
  415. get_scales_menu(0); // Just to force the default scale to be created
  416. }
  417. if ($oldversion < 2003081600) {
  418. table_column("user_teachers", "", "editall", "integer", "1", "unsigned", "1", "", "role");
  419. table_column("user_teachers", "", "timemodified", "integer", "10", "unsigned", "0", "", "editall");
  420. }
  421. if ($oldversion < 2003081900) {
  422. table_column("course_categories", "courseorder", "coursecount", "integer", "10", "unsigned", "0");
  423. }
  424. if ($oldversion < 2003082001) {
  425. table_column("course", "", "showgrades", "integer", "2", "unsigned", "1", "", "format");
  426. }
  427. if ($oldversion < 2003082101) {
  428. execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX category (category) ");
  429. }
  430. if ($oldversion < 2003082702) {
  431. execute_sql(" INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname,\" \",lastname)') ");
  432. }
  433. if ($oldversion < 2003091400) {
  434. table_column("course_modules", "", "indent", "integer", "5", "unsigned", "0", "", "score");
  435. }
  436. if ($oldversion < 2003092900) {
  437. table_column("course", "", "maxbytes", "integer", "10", "unsigned", "0", "", "marker");
  438. }
  439. if ($oldversion < 2003102700) {
  440. table_column("user_students", "", "timeaccess", "integer", "10", "unsigned", "0", "", "time");
  441. table_column("user_teachers", "", "timeaccess", "integer", "10", "unsigned", "0", "", "timemodified");
  442. $db->debug = false;
  443. $CFG->debug = 0;
  444. notify("Calculating access times. Please wait - this may take a long time on big sites...", "green");
  445. flush();
  446. if ($courses = get_records_select("course", "category > 0")) {
  447. foreach ($courses as $course) {
  448. notify("Processing " . format_string($course->fullname) . " ...", "green");
  449. flush();
  450. if ($users = get_records_select("user_teachers", "course = '$course->id'",
  451. "id", "id, userid, timeaccess")) {
  452. foreach ($users as $user) {
  453. $loginfo = get_record_sql("SELECT id, time FROM {$CFG->prefix}log WHERE course = '$course->id' and userid = '$user->userid' ORDER by time DESC");
  454. if (empty($loginfo->time)) {
  455. $loginfo->time = 0;
  456. }
  457. execute_sql("UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$loginfo->time'
  458. WHERE userid = '$user->userid' AND course = '$course->id'", false);
  459. }
  460. }
  461. if ($users = get_records_select("user_students", "course = '$course->id'",
  462. "id", "id, userid, timeaccess")) {
  463. foreach ($users as $user) {
  464. $loginfo = get_record_sql("SELECT id, time FROM {$CFG->prefix}log
  465. WHERE course = '$course->id' and userid = '$user->userid'
  466. ORDER by time DESC");
  467. if (empty($loginfo->time)) {
  468. $loginfo->time = 0;
  469. }
  470. execute_sql("UPDATE {$CFG->prefix}user_students
  471. SET timeaccess = '$loginfo->time'
  472. WHERE userid = '$user->userid' AND course = '$course->id'", false);
  473. }
  474. }
  475. }
  476. }
  477. notify("All courses complete.", "green");
  478. $db->debug = true;
  479. }
  480. if ($oldversion < 2003103100) {
  481. table_column("course", "", "showreports", "integer", "4", "unsigned", "0", "", "maxbytes");
  482. }
  483. if ($oldversion < 2003121600) {
  484. modify_database("", "CREATE TABLE `prefix_groups` (
  485. `id` int(10) unsigned NOT NULL auto_increment,
  486. `courseid` int(10) unsigned NOT NULL default '0',
  487. `name` varchar(254) NOT NULL default '',
  488. `description` text NOT NULL,
  489. `lang` varchar(10) NOT NULL default 'en',
  490. `picture` int(10) unsigned NOT NULL default '0',
  491. `timecreated` int(10) unsigned NOT NULL default '0',
  492. `timemodified` int(10) unsigned NOT NULL default '0',
  493. PRIMARY KEY (`id`),
  494. KEY `courseid` (`courseid`)
  495. ) ENGINE=MyISAM COMMENT='Each record is a group in a course.'; ");
  496. modify_database("", "CREATE TABLE `prefix_groups_members` (
  497. `id` int(10) unsigned NOT NULL auto_increment,
  498. `groupid` int(10) unsigned NOT NULL default '0',
  499. `userid` int(10) unsigned NOT NULL default '0',
  500. `timeadded` int(10) unsigned NOT NULL default '0',
  501. PRIMARY KEY (`id`),
  502. KEY `groupid` (`groupid`)
  503. ) ENGINE=MyISAM COMMENT='Lists memberships of users in groups'; ");
  504. }
  505. if ($oldversion < 2003121800) {
  506. table_column("course", "modinfo", "modinfo", "longtext", "", "", "");
  507. }
  508. if ($oldversion < 2003122600) {
  509. table_column("course", "", "groupmode", "integer", "4", "unsigned", "0", "", "showreports");
  510. table_column("course", "", "groupmodeforce", "integer", "4", "unsigned", "0", "", "groupmode");
  511. }
  512. if ($oldversion < 2004010900) {
  513. table_column("course_modules", "", "groupmode", "integer", "4", "unsigned", "0", "", "visible");
  514. }
  515. if ($oldversion < 2004011700) {
  516. modify_database("", "CREATE TABLE `prefix_event` (
  517. `id` int(10) unsigned NOT NULL auto_increment,
  518. `name` varchar(255) NOT NULL default '',
  519. `description` text NOT NULL,
  520. `courseid` int(10) unsigned NOT NULL default '0',
  521. `groupid` int(10) unsigned NOT NULL default '0',
  522. `userid` int(10) unsigned NOT NULL default '0',
  523. `modulename` varchar(20) NOT NULL default '',
  524. `instance` int(10) unsigned NOT NULL default '0',
  525. `eventtype` varchar(20) NOT NULL default '',
  526. `timestart` int(10) unsigned NOT NULL default '0',
  527. `timeduration` int(10) unsigned NOT NULL default '0',
  528. `timemodified` int(10) unsigned NOT NULL default '0',
  529. PRIMARY KEY (`id`),
  530. UNIQUE KEY `id` (`id`),
  531. KEY `courseid` (`courseid`),
  532. KEY `userid` (`userid`)
  533. ) ENGINE=MyISAM COMMENT='For everything with a time associated to it'; ");
  534. }
  535. if ($oldversion < 2004012800) {
  536. modify_database("", "CREATE TABLE `prefix_user_preferences` (
  537. `id` int(10) unsigned NOT NULL auto_increment,
  538. `userid` int(10) unsigned NOT NULL default '0',
  539. `name` varchar(50) NOT NULL default '',
  540. `value` varchar(255) NOT NULL default '',
  541. PRIMARY KEY (`id`),
  542. UNIQUE KEY `id` (`id`),
  543. KEY `useridname` (userid,name)
  544. ) ENGINE=MyISAM COMMENT='Allows modules to store arbitrary user preferences'; ");
  545. }
  546. if ($oldversion < 2004012900) {
  547. table_column("config", "value", "value", "text", "", "", "");
  548. }
  549. if ($oldversion < 2004013101) {
  550. table_column("log", "", "cmid", "integer", "10", "unsigned", "0", "", "module");
  551. set_config("upgrade", "logs");
  552. }
  553. if ($oldversion < 2004020900) {
  554. table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce");
  555. }
  556. if ($oldversion < 2004020903) {
  557. modify_database("", "CREATE TABLE `prefix_cache_text` (
  558. `id` int(10) unsigned NOT NULL auto_increment,
  559. `md5key` varchar(32) NOT NULL default '',
  560. `formattedtext` longtext NOT NULL,
  561. `timemodified` int(10) unsigned NOT NULL default '0',
  562. PRIMARY KEY (`id`),
  563. KEY `md5key` (`md5key`)
  564. ) ENGINE=MyISAM COMMENT='For storing temporary copies of processed texts';");
  565. }
  566. if ($oldversion < 2004021000) {
  567. $textfilters = array();
  568. for ($i=1; $i<=10; $i++) {
  569. $variable = "textfilter$i";
  570. if (!empty($CFG->$variable)) { /// No more filters
  571. if (is_readable("$CFG->dirroot/".$CFG->$variable)) {
  572. $textfilters[] = $CFG->$variable;
  573. }
  574. }
  575. }
  576. $textfilters = implode(',', $textfilters);
  577. if (empty($textfilters)) {
  578. $textfilters = 'mod/glossary/dynalink.php';
  579. }
  580. set_config('textfilters', $textfilters);
  581. }
  582. if ($oldversion < 2004021201) {
  583. modify_database("", "CREATE TABLE `prefix_cache_filters` (
  584. `id` int(10) unsigned NOT NULL auto_increment,
  585. `filter` varchar(32) NOT NULL default '',
  586. `version` int(10) unsigned NOT NULL default '0',
  587. `md5key` varchar(32) NOT NULL default '',
  588. `rawtext` text NOT NULL,
  589. `timemodified` int(10) unsigned NOT NULL default '0',
  590. PRIMARY KEY (`id`),
  591. KEY `filtermd5key` (filter,md5key)
  592. ) ENGINE=MyISAM COMMENT='For keeping information about cached data';");
  593. }
  594. if ($oldversion < 2004021500) {
  595. table_column("groups", "", "hidepicture", "integer", "2", "unsigned", "0", "", "picture");
  596. }
  597. if ($oldversion < 2004021700) {
  598. if (!empty($CFG->textfilters)) {
  599. $CFG->textfilters = str_replace("tex_filter.php", "filter.php", $CFG->textfilters);
  600. $CFG->textfilters = str_replace("multilang.php", "filter.php", $CFG->textfilters);
  601. $CFG->textfilters = str_replace("censor.php", "filter.php", $CFG->textfilters);
  602. $CFG->textfilters = str_replace("mediaplugin.php", "filter.php", $CFG->textfilters);
  603. $CFG->textfilters = str_replace("algebra_filter.php", "filter.php", $CFG->textfilters);
  604. $CFG->textfilters = str_replace("dynalink.php", "filter.php", $CFG->textfilters);
  605. set_config("textfilters", $CFG->textfilters);
  606. }
  607. }
  608. if ($oldversion < 2004022000) {
  609. table_column("user", "", "emailstop", "integer", "1", "unsigned", "0", "not null", "email");
  610. }
  611. if ($oldversion < 2004022200) { /// Final renaming I hope. :-)
  612. if (!empty($CFG->textfilters)) {
  613. $CFG->textfilters = str_replace("/filter.php", "", $CFG->textfilters);
  614. $CFG->textfilters = str_replace("mod/glossary/dynalink.php", "mod/glossary", $CFG->textfilters);
  615. $textfilters = explode(',', $CFG->textfilters);
  616. foreach ($textfilters as $key => $textfilter) {
  617. $textfilters[$key] = trim($textfilter);
  618. }
  619. set_config("textfilters", implode(',',$textfilters));
  620. }
  621. }
  622. if ($oldversion < 2004030702) { /// Because of the renaming of Czech language pack
  623. execute_sql("UPDATE {$CFG->prefix}user SET lang = 'cs' WHERE lang = 'cz'");
  624. execute_sql("UPDATE {$CFG->prefix}course SET lang = 'cs' WHERE lang = 'cz'");
  625. }
  626. if ($oldversion < 2004041800) { /// Integrate Block System from contrib
  627. table_column("course", "", "blockinfo", "varchar", "255", "", "", "not null", "modinfo");
  628. }
  629. if ($oldversion < 2004042600) { /// Rebuild course caches for resource icons
  630. //include_once("$CFG->dirroot/course/lib.php");
  631. //rebuild_course_cache();
  632. }
  633. if ($oldversion < 2004042700) { /// Increase size of lang fields
  634. table_column("user", "lang", "lang", "varchar", "10", "", "en");
  635. table_column("groups", "lang", "lang", "varchar", "10", "", "");
  636. table_column("course", "lang", "lang", "varchar", "10", "", "");
  637. }
  638. if ($oldversion < 2004042701) { /// Add hiddentopics field to control hidden topics behaviour
  639. table_column("course", "", "hiddentopics", "integer", "1", "unsigned", "0", "not null", "visible");
  640. }
  641. if ($oldversion < 2004042702) { /// add a format field for the description
  642. table_column("event", "", "format", "integer", "4", "unsigned", "0", "not null", "description");
  643. }
  644. if ($oldversion < 2004042900) {
  645. execute_sql(" ALTER TABLE `{$CFG->prefix}course` DROP `showrecent` ");
  646. }
  647. if ($oldversion < 2004043001) { /// Change hiddentopics to hiddensections
  648. table_column("course", "hiddentopics", "hiddensections", "integer", "2", "unsigned", "0", "not null");
  649. }
  650. if ($oldversion < 2004050400) { /// add a visible field for events
  651. table_column("event", "", "visible", "tinyint", "1", "", "1", "not null", "timeduration");
  652. if ($events = get_records('event')) {
  653. foreach($events as $event) {
  654. if ($moduleid = get_field('modules', 'id', 'name', $event->modulename)) {
  655. if (get_field('course_modules', 'visible', 'module', $moduleid, 'instance', $event->instance) == 0) {
  656. set_field('event', 'visible', 0, 'id', $event->id);
  657. }
  658. }
  659. }
  660. }
  661. }
  662. if ($oldversion < 2004052800) { /// First version tagged "1.4 development", version.php 1.227
  663. set_config('siteblocksadded', true); /// This will be used later by the block upgrade
  664. }
  665. if ($oldversion < 2004053000) { /// set defaults for site course
  666. $site = get_site();
  667. set_field('course', 'numsections', 0, 'id', $site->id);
  668. set_field('course', 'groupmodeforce', 1, 'id', $site->id);
  669. set_field('course', 'teacher', get_string('administrator'), 'id', $site->id);
  670. set_field('course', 'teachers', get_string('administrators'), 'id', $site->id);
  671. set_field('course', 'student', get_string('user'), 'id', $site->id);
  672. set_field('course', 'students', get_string('users'), 'id', $site->id);
  673. }
  674. if ($oldversion < 2004060100) {
  675. set_config('digestmailtime', 0);
  676. table_column('user', "", 'maildigest', 'tinyint', '1', '', '0', 'not null', 'mailformat');
  677. }
  678. if ($oldversion < 2004062400) {
  679. table_column('user_teachers', "", 'timeend', 'int', '10', 'unsigned', '0', 'not null', 'editall');
  680. table_column('user_teachers', "", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall');
  681. }
  682. if ($oldversion < 2004062401) {
  683. table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname');
  684. execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default
  685. }
  686. if ($oldversion < 2004062600) {
  687. table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang');
  688. }
  689. if ($oldversion < 2004072900) {
  690. table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate');
  691. }
  692. if ($oldversion < 2004072901) { // Fixing error in schema
  693. if ($record = get_record('log_display', 'module', 'course', 'action', 'update')) {
  694. delete_records('log_display', 'module', 'course', 'action', 'update');
  695. insert_record('log_display', $record, false);
  696. }
  697. }
  698. if ($oldversion < 2004081200) { // Fixing version errors in some blocks
  699. set_field('blocks', 'version', 2004081200, 'name', 'admin');
  700. set_field('blocks', 'version', 2004081200, 'name', 'calendar_month');
  701. set_field('blocks', 'version', 2004081200, 'name', 'course_list');
  702. }
  703. if ($oldversion < 2004081500) { // Adding new "auth" field to user table to allow more flexibility
  704. table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id');
  705. execute_sql("UPDATE {$CFG->prefix}user SET auth = 'manual'"); // Set everyone to 'manual' to be sure
  706. if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is
  707. $adminlist = array();
  708. foreach ($admins as $user) {
  709. $adminlist[] = $user->id;
  710. }
  711. $adminlist = implode(',', $adminlist);
  712. execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)");
  713. }
  714. }
  715. if ($oldversion < 2004082200) { // Making admins teachers on site course
  716. $site = get_site();
  717. $admins = get_admins();
  718. foreach ($admins as $admin) {
  719. add_teacher($admin->id, $site->id);
  720. }
  721. }
  722. if ($oldversion < 2004082600) {
  723. //update auth-fields for external users
  724. // following code would not work in 1.8
  725. /* include_once ($CFG->dirroot."/auth/".$CFG->auth."/lib.php");
  726. if (function_exists('auth_get_userlist')) {
  727. $externalusers = auth_get_userlist();
  728. if (!empty($externalusers)){
  729. $externalusers = '\''. implode('\',\'',$externalusers).'\'';
  730. execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE username IN ($externalusers)");
  731. }
  732. }*/
  733. }
  734. if ($oldversion < 2004082900) { // Make sure guest is "manual" too.
  735. set_field('user', 'auth', 'manual', 'username', 'guest');
  736. }
  737. /* Commented out unused guid-field code
  738. if ($oldversion < 2004090300) { // Add guid-field used in user syncronization
  739. table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth');
  740. execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX authguid (auth, guid)");
  741. }
  742. */
  743. if ($oldversion < 2004091900) { // modify idnumber to hold longer values
  744. table_column('user', 'idnumber', 'idnumber', 'varchar', '64', '', '', '', '');
  745. execute_sql("ALTER TABLE {$CFG->prefix}user DROP INDEX user_idnumber",false); // added in case of conflicts with upgrade from 14stable
  746. execute_sql("ALTER TABLE {$CFG->prefix}user DROP INDEX user_auth",false); // added in case of conflicts with upgrade from 14stable
  747. execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX idnumber (idnumber)");
  748. execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX auth (auth)");
  749. }
  750. if ($oldversion < 2004093001) { // add new table for sessions storage
  751. execute_sql(" CREATE TABLE `{$CFG->prefix}sessions` (
  752. `sesskey` char(32) NOT null,
  753. `expiry` int(11) unsigned NOT null,
  754. `expireref` varchar(64),
  755. `data` text NOT null,
  756. PRIMARY KEY (`sesskey`),
  757. KEY (`expiry`)
  758. ) ENGINE=MyISAM COMMENT='Optional database session storage, not used by default';");
  759. }
  760. if ($oldversion < 2004111500) { // Update any users/courses using wrongly-named lang pack
  761. execute_sql("UPDATE {$CFG->prefix}user SET lang = 'mi_nt' WHERE lang = 'ma_nt'");
  762. execute_sql("UPDATE {$CFG->prefix}course SET lang = 'mi_nt' WHERE lang = 'ma_nt'");
  763. }
  764. if ($oldversion < 2004111700) { // add indexes. - drop them first silently to avoid conflicts when upgrading.
  765. execute_sql(" ALTER TABLE `{$CFG->prefix}course` DROP INDEX idnumber;",false);
  766. execute_sql(" ALTER TABLE `{$CFG->prefix}course` DROP INDEX shortname;",false);
  767. execute_sql(" ALTER TABLE `{$CFG->prefix}user_students` DROP INDEX userid;",false);
  768. execute_sql(" ALTER TABLE `{$CFG->prefix}user_teachers` DROP INDEX userid;",false);
  769. execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX idnumber (idnumber);");
  770. execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX shortname (shortname);");
  771. execute_sql(" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX userid (userid);");
  772. execute_sql(" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX userid (userid);");
  773. }
  774. if ($oldversion < 2004111700) {// add an index to event for timestart and timeduration. - drop them first silently to avoid conflicts when upgrading.
  775. execute_sql("ALTER TABLE {$CFG->prefix}event DROP INDEX timestart;",false);
  776. execute_sql("ALTER TABLE {$CFG->prefix}event DROP INDEX timeduration;",false);
  777. modify_database('','ALTER TABLE prefix_event ADD INDEX timestart (timestart);');
  778. modify_database('','ALTER TABLE prefix_event ADD INDEX timeduration (timeduration);');
  779. }
  780. if ($oldversion < 2004111700) { //add indexes on modules and course_modules. - drop them first silently to avoid conflicts when upgrading.
  781. execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key visible;",false);
  782. execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key course;",false);
  783. execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key module;",false);
  784. execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key instance;",false);
  785. execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key deleted;",false);
  786. execute_sql("ALTER TABLE {$CFG->prefix}modules drop key name;",false);
  787. modify_database('','ALTER TABLE prefix_course_modules add key visible(visible);');
  788. modify_database('','ALTER TABLE prefix_course_modules add key course(course);');
  789. modify_database('','ALTER TABLE prefix_course_modules add key module(module);');
  790. modify_database('','ALTER TABLE prefix_course_modules add key instance (instance);');
  791. modify_database('','ALTER TABLE prefix_course_modules add key deleted (deleted);');
  792. modify_database('','ALTER TABLE prefix_modules add key name(name);');
  793. }
  794. if ($oldversion < 2004111700) { // add an index on the groups_members table. - drop them first silently to avoid conflicts when upgrading.
  795. execute_sql("ALTER TABLE {$CFG->prefix}groups_members DROP INDEX userid;",false);
  796. modify_database('','ALTER TABLE prefix_groups_members ADD INDEX userid (userid);');
  797. }
  798. if ($oldversion < 2004111700) { // add an index on user students timeaccess (used for sorting)- drop them first silently to avoid conflicts when upgrading
  799. execute_sql("ALTER TABLE {$CFG->prefix}user_students DROP INDEX timeaccess;",false);
  800. modify_database('','ALTER TABLE prefix_user_students ADD INDEX timeaccess (timeaccess);');
  801. }
  802. if ($oldversion < 2004111700) { // add indexes on faux-foreign keys. - drop them first silently to avoid conflicts when upgrading.
  803. execute_sql("ALTER TABLE {$CFG->prefix}scale DROP INDEX courseid;",false);
  804. execute_sql("ALTER TABLE {$CFG->prefix}user_admins DROP INDEX userid;",false);
  805. execute_sql("ALTER TABLE {$CFG->prefix}user_coursecreators DROP INDEX userid;",false);
  806. modify_database('','ALTER TABLE prefix_scale ADD INDEX courseid (courseid);');
  807. modify_database('','ALTER TABLE prefix_user_admins ADD INDEX userid (userid);');
  808. modify_database('','ALTER TABLE prefix_user_coursecreators ADD INDEX userid (userid);');
  809. }
  810. if ($oldversion < 2004111700) { // replace index on course
  811. fix_course_sortorder(0,0,1);
  812. execute_sql("ALTER TABLE `{$CFG->prefix}course` DROP KEY category",false);
  813. execute_sql("ALTER TABLE `{$CFG->prefix}course` DROP KEY category_sortorder;",false);
  814. modify_database('', "ALTER TABLE `prefix_course` ADD UNIQUE KEY category_sortorder(category,sortorder)");
  815. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;",false);
  816. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;",false);
  817. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;",false);
  818. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;",false);
  819. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;",false);
  820. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;",false);
  821. execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;",false);
  822. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_deleted_idx (deleted)");
  823. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_confirmed_idx (confirmed)");
  824. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_firstname_idx (firstname)");
  825. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastname_idx (lastname)");
  826. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_city_idx (city)");
  827. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_country_idx (country)");
  828. modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastaccess_i…

Large files files are truncated, but you can click here to view the full file