private function setup_sandbox() { global $CFG; $sandbox = $this->sandbox; if ($sandbox === null) { $this->sandbox = $sandbox = $this->get_best_sandbox($this->language); if ($sandbox === null) { throw new coderunner_exception("Language {$this->language} is not available on this system"); } } else { if (!get_config('qtype_coderunner', strtolower($sandbox) . '_enabled')) { throw new coderunner_exception("Question is configured to use a disabled sandbox ({$sandbox})"); } } $sandboxes = qtype_coderunner_sandbox::available_sandboxes(); $sandboxclass = $sandboxes[$sandbox]; $filename = qtype_coderunner_sandbox::get_filename($sandbox); require_once $CFG->dirroot . "/question/type/coderunner/sandbox/{$filename}"; $this->sandboxinstance = new $sandboxclass(); }