From 187e22dbe0a42ec5c29977321d60335d600dfbe9 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 14 May 2004 19:14:57 +0000 Subject: [PATCH] Upgraded glossary to 2004051400. The process will launch an update of entry->concept and alias->alias to trim them. This should close bug 985 forever... (http://moodle.org/bugs/bug.php?op=show&bugid=985) --- mod/glossary/db/mysql.php | 15 +++++++++++++++ mod/glossary/db/postgres7.php | 14 ++++++++++++++ mod/glossary/edit.php | 1 - mod/glossary/version.php | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mod/glossary/db/mysql.php b/mod/glossary/db/mysql.php index 00eaeabb06..f23ba6ae09 100644 --- a/mod/glossary/db/mysql.php +++ b/mod/glossary/db/mysql.php @@ -255,6 +255,21 @@ function glossary_upgrade($oldversion) { table_column("glossary","","rssarticles","tinyint","2", "unsigned", "0", "", "rsstype"); set_config("glossary_enablerssfeeds",0); } + + + if ( $oldversion < 2004051400 ) { + print_simple_box("This update might take several seconds.

The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox"); + if ( $entries = get_records("glossary_entries")) { + foreach($entries as $entry) { + set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id); + } + } + if ( $aliases = get_records("glossary_alias")) { + foreach($aliases as $alias) { + set_field("glossary_alias","alias",addslashes(trim($alias->alias)),"id",$alias->id); + } + } + } return true; } diff --git a/mod/glossary/db/postgres7.php b/mod/glossary/db/postgres7.php index 76974f0ac5..eef62fda5b 100644 --- a/mod/glossary/db/postgres7.php +++ b/mod/glossary/db/postgres7.php @@ -19,6 +19,20 @@ function glossary_upgrade($oldversion) { set_config("glossary_enablerssfeeds",0); } + if ( $oldversion < 2004051400 ) { + print_simple_box("This update might take several seconds.

The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox"); + if ( $entries = get_records("glossary_entries")) { + foreach($entries as $entry) { + set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id); + } + } + if ( $aliases = get_records("glossary_alias")) { + foreach($aliases as $alias) { + set_field("glossary_alias","alias",addslashes(trim($alias->alias)),"id",$alias->id); + } + } + } + return true; } diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index a11facd1f5..38a2030d1c 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -121,7 +121,6 @@ if ( $confirm ) { } } else { -echo "Creating!!!!!"; $newentry->userid = $USER->id; $newentry->timecreated = $timenow; $newentry->sourceglossaryid = 0; diff --git a/mod/glossary/version.php b/mod/glossary/version.php index 9d48af27e1..44a1ac8702 100644 --- a/mod/glossary/version.php +++ b/mod/glossary/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2004050900; // The current module version (Date: YYYYMMDDXX) +$module->version = 2004051400; // The current module version (Date: YYYYMMDDXX) $module->requires = 2004050300; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) -- 2.39.5