Index: setup.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/setup.php,v
retrieving revision 1.212.2.15
diff -c -r1.212.2.15 setup.php
*** setup.php	7 May 2008 04:37:39 -0000	1.212.2.15
--- setup.php	1 Jul 2008 08:21:41 -0000
***************
*** 158,166 ****
          error_log('ADODB Error: '.$db->ErrorMsg()); // see MDL-14628
  
          if (empty($CFG->noemailever) and !empty($CFG->emailconnectionerrorsto)) {
!             mail($CFG->emailconnectionerrorsto, 
!                  'WARNING: Database connection error: '.$CFG->wwwroot, 
!                  'Connection error: '.$CFG->wwwroot);
          }
          die;
      }
--- 158,179 ----
          error_log('ADODB Error: '.$db->ErrorMsg()); // see MDL-14628
  
          if (empty($CFG->noemailever) and !empty($CFG->emailconnectionerrorsto)) {
!             if (file_exists($CFG->datadir.'/emailcount')){
!                 $fp = fopen($CFG->datadir.'/emailcount', 'rw');
!                 $content = fread($fp, 24);
!                 if((time() - (int)$content) > 600){
!                     mail($CFG->emailconnectionerrorsto, 
!                          'WARNING: Database connection error: '.$CFG->wwwroot, 
!                          'Connection error: '.$CFG->wwwroot);
!                     fwrite($fp, time());
!                 }
!             } else {
!                 mail($CFG->emailconnectionerrorsto, 
!                      'WARNING: Database connection error: '.$CFG->wwwroot, 
!                      'Connection error: '.$CFG->wwwroot);
!                 $fp = fopen($CFG->datadir.'/emailcount', 'w');
!                 fwrite($fp, time());
!             }
          }
          die;
      }
