From 528d1ca043841b86d49e0614ddc69d2d31501c8d Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 1 Mar 2006 09:09:03 +0000 Subject: [PATCH] Merged feature to email database connection erorrs to someone into stable --- config-dist.php | 6 ++++++ lib/setup.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/config-dist.php b/config-dist.php index b64d1a1acdc..0fe1de2ba3a 100644 --- a/config-dist.php +++ b/config-dist.php @@ -264,6 +264,12 @@ $CFG->admin = 'admin'; // If you are going to publish your log, or the output of your web stats analyzer // this will weaken the security of your website. // +// Email database connection errors to someone. If Moodle cannot connect to the +// database, then email this address with a notice. +// +// $CFG->emailconnectionerrors = your@emailaddress.com; +// +// //========================================================================= diff --git a/lib/setup.php b/lib/setup.php index ba8f8bcc966..27529073964 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -137,6 +137,12 @@ $CFG->httpswwwroot = $CFG->wwwroot; echo '

The site administrator should also check that the database details have been correctly specified in config.php

'; echo ''; echo ''; + + if (!empty($CFG->emailconnectionerrorsto)) { + mail($CFG->emailconnectionerrorsto, + 'WARNING: Database connection error: '.$CFG->wwwroot, + 'Connection error: '.$CFG->wwwroot); + } die; }