3 // Deletes the moodledata directory, COMPLETELY!!
4 // BE VERY CAREFUL USING THIS!
6 require_once("../config.php");
11 error("You must be admin to use this script!");
14 $deletedir = $CFG->dataroot
; // The directory to delete!
17 notice_yesno ("Are you completely sure you want to delete everything inside the directory $deletedir ?", "delete.php?sure=yes", "index.php");
22 notice_yesno ("Are you REALLY REALLY completely sure you want to delete everything inside the directory $deletedir (this includes all user images, and any other course files that have been created) ?", "delete.php?sure=yes&reallysure=yes", "index.php");
28 delete_subdirectories($deletedir);
30 echo "<H1 align=center>Done!</H1>";
31 print_continue($CFG->wwwroot
);
35 function delete_subdirectories($rootdir) {
37 $dir = opendir($rootdir);
39 while ($file = readdir($dir)) {
40 if ($file != "." and $file != "..") {
41 $fullfile = "$rootdir/$file";
42 if (filetype($fullfile) == "dir") {
43 delete_subdirectories($fullfile);
44 echo "Deleting $fullfile ... ";
45 if (rmdir($fullfile)) {
51 echo "Deleting $fullfile ... ";
52 if (unlink("$fullfile")) {