}
// Try to connect to create maxima local.
echo html_writer::tag('p', stack_string('healthcheckconfigintro2'));
stack_cas_configuration::create_maximalocal();
echo html_writer::tag('textarea', stack_cas_configuration::generate_maximalocal_contents(), array('readonly' => 'readonly', 'wrap' => 'virtual', 'rows' => '32', 'cols' => '100'));
// Maxima config.
if (stack_cas_configuration::maxima_bat_is_missing()) {
    echo $OUTPUT->heading(stack_string('healthcheckmaximabat'), 3);
    $message = stack_string('healthcheckmaximabatinfo', $CFG->dataroot);
    echo html_writer::tag('p', $message);
    $summary[] = array(false, $message);
}
// Test an *uncached* call to the CAS.  I.e. a genuine call to the process.
echo $OUTPUT->heading(stack_string('healthuncached'), 3);
echo html_writer::tag('p', stack_string('healthuncachedintro'));
list($message, $genuinedebug, $result) = stack_connection_helper::stackmaxima_genuine_connect();
$summary[] = array($result, $message);
echo html_writer::tag('p', $message);
echo output_debug(stack_string('debuginfo'), $genuinedebug);
$genuinecascall = $result;
// Test Maxima connection.
// Intentionally use get_string for the sample CAS and plots, so we don't render
// the maths too soon.
output_cas_text(stack_string('healthcheckconnect'), stack_string('healthcheckconnectintro'), get_string('healthchecksamplecas', 'qtype_stack'));
// If we have a linux machine, and we are testing the raw connection then we should
// attempt to automatically create an optimized maxima image on the system.
if ($config->platform === 'unix' and $genuinecascall) {
    echo $OUTPUT->heading(stack_string('healthautomaxopt'), 3);
    echo html_writer::tag('p', stack_string('healthautomaxoptintro'));
    list($message, $debug, $result) = stack_connection_helper::stackmaxima_auto_maxima_optimise($genuinedebug);
    $summary[] = array($result, $message);