94
94
if ( $oldversion < 2003101600 ) {
95
95
execute_sql( "ALTER TABLE `{$CFG->prefix}glossary` " .
96
96
"ADD `usedynalink` TINYINT(2) UNSIGNED NOT NULL DEFAULT '1' AFTER `allowcomments` " );
98
98
execute_sql( "ALTER TABLE `{$CFG->prefix}glossary_entries` " .
99
99
"ADD `usedynalink` TINYINT(2) UNSIGNED NOT NULL DEFAULT '1' AFTER `sourceglossaryid`, ".
100
100
"ADD `casesensitive` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' AFTER `usedynalink` ");
127
127
if ( $oldversion < 2003103100 ) {
128
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and categories you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
128
print_simple_box('This update might take several seconds.<br />The more glossaries, entries and categories you have created, the more it will take so please be patient.','center', '50%', '', '20', 'noticebox');
129
129
if ( $glossaries = get_records("glossary")) {
131
131
foreach ( $glossaries as $glossary ) {
260
260
if ( $oldversion < 2004051400 ) {
261
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
261
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", '', "20", "noticebox");
262
262
if ( $entries = get_records("glossary_entries", '', '', '', 'id,concept')) {
263
263
foreach($entries as $entry) {
264
264
set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id);
345
345
set_field('glossary','editalways','1','mainglossary','0');
348
if ($oldversion < 2004080932) {
348
if ($oldversion < 2004111200) {
349
execute_sql("ALTER TABLE {$CFG->prefix}glossary DROP INDEX course;",false);
350
execute_sql("ALTER TABLE {$CFG->prefix}glossary_alias DROP INDEX entryid;",false);
351
execute_sql("ALTER TABLE {$CFG->prefix}glossary_categories DROP INDEX glossaryid;",false);
352
execute_sql("ALTER TABLE {$CFG->prefix}glossary_comments DROP INDEX entryid;",false);
353
execute_sql("ALTER TABLE {$CFG->prefix}glossary_comments DROP INDEX userid;",false);
354
execute_sql("ALTER TABLE {$CFG->prefix}glossary_entries DROP INDEX glossaryid;",false);
355
execute_sql("ALTER TABLE {$CFG->prefix}glossary_entries DROP INDEX userid;",false);
356
execute_sql("ALTER TABLE {$CFG->prefix}glossary_entries DROP INDEX concept;",false);
357
execute_sql("ALTER TABLE {$CFG->prefix}glossary_entries_categories DROP INDEX entryid;",false);
358
execute_sql("ALTER TABLE {$CFG->prefix}glossary_entries_categories DROP INDEX categoryid;",false);
359
execute_sql("ALTER TABLE {$CFG->prefix}glossary_ratings DROP INDEX userid;",false);
360
execute_sql("ALTER TABLE {$CFG->prefix}glossary_ratings DROP INDEX entryid;",false);
349
362
modify_database('','ALTER TABLE prefix_glossary ADD INDEX course (course);');
350
363
modify_database('','ALTER TABLE prefix_glossary_alias ADD INDEX entryid (entryid);');
351
364
modify_database('','ALTER TABLE prefix_glossary_categories ADD INDEX glossaryid (glossaryid);');
360
373
modify_database('','ALTER TABLE prefix_glossary_ratings ADD INDEX entryid (entryid);');
377
//Delete orphaned categories (bug 2140)
378
if ($oldversion < 2005011100) {
379
$categories = get_records('glossary_categories', '', '', '', 'id, glossaryid');
381
foreach ($categories as $category) {
382
$glossary = get_record('glossary', 'id', "$category->glossaryid");
384
delete_records('glossary_categories', 'id', "$category->id");
390
//Allowprintview flag
391
if ($oldversion < 2005011200) {
392
table_column('glossary','','allowprintview','tinyint','2', 'unsigned', '1', '', 'allowcomments');
393
$glossaries = get_records('glossary', '', '', '', 'id, name');
395
foreach ($glossaries as $glossary) {
396
set_field('glossary', 'allowprintview', '1', 'id', "$glossary->id");
401
if ($oldversion < 2005031001) {
402
modify_database('',"INSERT INTO prefix_log_display VALUES ('glossary', 'view entry', 'glossary_entries', 'concept');");
405
if ($oldversion < 2005041100) { // replace wiki-like with markdown
406
include_once( "$CFG->dirroot/lib/wiki_to_markdown.php" );
407
$wtm = new WikiToMarkdown();
408
// update glossary_entries->definition
409
$sql = "select course from {$CFG->prefix}glossary,{$CFG->prefix}glossary_entries ";
410
$sql .= "where {$CFG->prefix}glossary.id = {$CFG->prefix}glossary_entries.glossaryid ";
411
$sql .= "and {$CFG->prefix}glossary_entries.id = ";
412
$wtm->update( 'glossary_entries','definition','format' );
413
// update glossary_comments->text
414
$sql = "select course from {$CFG->prefix}glossary,{$CFG->prefix}glossary_entries,{$CFG->prefix}glossary_comments ";
415
$sql .= "where {$CFG->prefix}glossary.id = {$CFG->prefix}glossary_entries.glossaryid ";
416
$sql .= "and {$CFG->prefix}glossary_entries.id = {$CFG->prefix}glossary_comments.entryid ";
417
$sql .= "and {$CFG->prefix}glossary_comments.id = ";
418
$wtm->update( 'glossary_comments','text','format',$sql );