-WARNING: the CVS tree is currently a little unstable,
- as I'm doing some major work on the code.
+README $Id$
+------
- It may or may not work right now.
-
- Martin - 18 May 2002
-------------------------------------------------------
All the documention is in the "doc" subdirectory. :-)
-WARNING: the CVS tree is currently a little unstable,
- as I'm doing some major work on the code.
+README $Id$
+------
- It may or may not work right now.
-
- Martin - 18 May 2002
-------------------------------------------------------
All the documention is in the "doc" subdirectory. :-)
+++ /dev/null
-%Id%
-
-UPGRADING MOODLE
-----------------
-
-This file keeps track of changes to Moodle that may break
-installations. Whenever you upgrade the Moodle code from
-an earlier version (by CVS, for example), check this file
-to see if there is anything else you need to do to keep
-your Moodle installation humming smoothly.
-
----------------------------------------------------------
-
-
-
-4-7-2002 Added 'teacher' type to forum->type
-
-You can use this SQL command to update your forum table:
-
-ALTER TABLE `forum` CHANGE `type` `type` ENUM('discussion','news','social','general','eachuser','teacher') DEFAULT 'general' NOT NULL
--- /dev/null
+UPGRADING $Id$
+---------
+
+Since the first main release of Moodle (2002080100)
+most upgrading is done automatically. See the file
+version.php for all the details.
+
+When upgrading from any previous version of Moodle,
+all you normally will need to do is this:
+
+1a) Update the source files using CVS
+
+ or
+
+1b) Make a backup of the current working installation
+ files, then put the new files here. Make sure you
+ copy your old config.php back here (or make a new
+ one by editing config-dist.php).
+
+2) Login as the admin user and visit /admin using a
+ web browser.
+
+If all goes well, your databases will be upgraded to
+suit the new files, and you can go on using Moodle
+normally.
+
+If you have problems, let me know.
+
+Cheers,
+Martin
+
die;
}
+ // Check version of Moodle code on disk compared with database
+ // and upgrade if possible.
+
+ include_once("$CFG->dirroot/version.php"); # defines $version and upgrades
+
+ if ($dversion = get_field("config", "value", "name", "version")) {
+ if ($version > $dversion) { // upgrade
+ notify("Upgrading databases from version $dversion to $version...");
+ if (upgrade_moodle($dversion)) {
+ if (set_field("config", "value", "$version", "name", "version")) {
+ notify("Databases were successfully upgraded");
+ print_heading("<A HREF=\"index.php\">Continue</A>");
+ die;
+ } else {
+ notify("Upgrade failed! (Could not update version in config table)");
+ }
+ } else {
+ notify("Upgrade failed! See /version.php");
+ }
+ } else if ($version < $dversion) {
+ notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
+ }
+
+ } else {
+ $dversion->name = "version";
+ $dversion->value = $version;
+ if (insert_record("config", $dversion)) {
+ notify("You are currently using Moodle version $version");
+ print_heading("<A HREF=\"index.php\">Continue</A>");
+ die;
+ } else {
+ error("A problem occurred inserting current version into databases");
+ }
+ }
+
// Find and check all modules and load them up.
$dir = opendir("$CFG->dirroot/mod");
while ($mod = readdir($dir)) {
--- /dev/null
+<?PHP //$Id$
+// This file keeps track of upgrades to Moodle.
+//
+// Sometimes, changes between versions involve
+// alterations to database structures and other
+// major things that may break installations.
+//
+// This file specifies the current version of
+// Moodle installed, which can be compared against
+// a previous version (see the "config" table).
+//
+// To do this, visit the "admin" page.
+//
+// The upgrade function in this file will attempt
+// to perform all the necessary actions to upgrade
+// your older databases to the current version.
+// If there's something it cannot do itself, it
+// will tell you what you need to do.
+
+$version = 2002072704;
+
+function upgrade_moodle($oldversion) {
+
+ return true;
+}
+
+?>