You are here

function qformat_coursetestmanager::fulldelete in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format/coursetestmanager/format.php \qformat_coursetestmanager::fulldelete()
1 call to qformat_coursetestmanager::fulldelete()
qformat_coursetestmanager::deletedatabase in includes/moodle/question/format/coursetestmanager/format.php

File

includes/moodle/question/format/coursetestmanager/format.php, line 434

Class

qformat_coursetestmanager

Code

function fulldelete($location) {
  if (is_dir($location)) {
    $currdir = opendir($location);
    while (false !== ($file = readdir($currdir))) {
      if ($file != ".." && $file != ".") {
        $fullfile = $location . "/" . $file;
        if (is_dir($fullfile)) {
          if (!fulldelete($fullfile)) {
            return false;
          }
        }
        else {
          if (!unlink($fullfile)) {
            return false;
          }
        }
      }
    }
    closedir($currdir);
    if (!rmdir($location)) {
      return false;
    }
  }
  else {
    if (!unlink($location)) {
      return false;
    }
  }
  return true;
}