]> git.mjollnir.org Git - moodle.git/commitdiff
More checks to solve support requests before they happen.
authormoodler <moodler>
Mon, 13 Jan 2003 14:05:29 +0000 (14:05 +0000)
committermoodler <moodler>
Mon, 13 Jan 2003 14:05:29 +0000 (14:05 +0000)
admin/index.php

index b1c80d91b1e91a17d0cc34161c3469a7189e2f67..c84a261f4a20e0d4fd87e6edb8512afabab3c2c8 100644 (file)
@@ -1,11 +1,18 @@
 <?PHP // $Id$
 
+/// Check that config.php exists
+    if (!file_exists("../config.php")) {
+        echo "<H2 align=center>You need to create a config.php.<BR>
+                  See the <A HREF=\"http://moodle.com/doc/?frame=install.html\">installation instructions</A>.</H2>";
+        die;
+    }
+
     require_once("../config.php");
 
 
 /// Check that PHP is of a sufficient version
 
-    if ( ! check_php_version("4.1.0") ) {
+    if (!check_php_version("4.1.0")) {
         $version = phpversion();
         print_heading("Sorry, Moodle requires PHP 4.1.0 or later (currently using version $version)");
         die;
         error("Moodle has not been configured yet.  You need to to edit config.php first.");
     }
 
+
+/// Check settings in config.php
+
+    $dirroot = dirname(realpath("../config.php"));
+    if ($dirroot != $CFG->dirroot) {
+        error("Please fix your settings in config.php:
+              <P>You have:
+              <P>\$CFG->dirroot = \"$CFG->dirroot\";
+              <P>but it should be:
+              <P>\$CFG->dirroot = \"$dirroot\";");
+    }
+
+
 /// Check if the main tables have been installed yet or not.
 
     if (! $tables = $db->Metatables() ) {    // No tables yet at all.