diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 783909ad627..b55622d11d5 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -1428,8 +1428,28 @@ function main_upgrade($oldversion=0) { } // end foreach field } } - + if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS. + if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) { + if (count_records('attendance')) { // We have some data, so should keep it + + set_field('modules', 'visible', 0, 'name', 'attendance'); + notify('The Attendance module has been discontinued. If you really want to + continue using it, you should download it individually from + http://download.moodle.org/modules and install it, then + reactivate it from Admin >> Configuration >> Modules. + None of your existing data has been deleted, so all existing + Attendance activities should re-appear.'); + + } else { // No data, so do a complete delete + + execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false); + delete_records('modules', 'name', 'attendance'); + notify("The Attendance module has been discontinued and removed from your site. + You weren't using it anyway. ;-)"); + } + } + } return $result; } diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 8c9b4ae648d..d7fad1f79d6 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -1149,6 +1149,28 @@ function main_upgrade($oldversion=0) { } } + if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS. + if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) { + if (count_records('attendance')) { // We have some data, so should keep it + + set_field('modules', 'visible', 0, 'name', 'attendance'); + notify('The Attendance module has been discontinued. If you really want to + continue using it, you should download it individually from + http://download.moodle.org/modules and install it, then + reactivate it from Admin >> Configuration >> Modules. + None of your existing data has been deleted, so all existing + Attendance activities should re-appear.'); + + } else { // No data, so do a complete delete + + execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false); + delete_records('modules', 'name', 'attendance'); + notify("The Attendance module has been discontinued and removed from your site. + You weren't using it anyway. ;-)"); + } + } + } + return $result; } diff --git a/version.php b/version.php index a0b002a9d51..a0f94669658 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2005060200; // YYYYMMDD = date + $version = 2005060201; // YYYYMMDD = date // XY = increments within a single day $release = '1.6 development'; // Human-friendly version name