Skip to content
Snippets Groups Projects
Commit 6d3b1f9f authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Refactor healthcheck script. Add explicit check for unicode: issue #995.

parent 369cf2df
No related branches found
No related tags found
No related merge requests found
......@@ -28,15 +28,8 @@ define('NO_OUTPUT_BUFFERING', true);
require_once(__DIR__.'/../../../../config.php');
require_once($CFG->dirroot .'/course/lib.php');
require_once($CFG->libdir .'/filelib.php');
require_once(__DIR__ . '/../locallib.php');
require_once(__DIR__ . '/../stack/utils.class.php');
require_once(__DIR__ . '/../stack/options.class.php');
require_once(__DIR__ . '/../stack/cas/cassession2.class.php');
require_once(__DIR__ . '/../stack/cas/castext2/castext2_evaluatable.class.php');
require_once(__DIR__ . '/../stack/cas/connector.dbcache.class.php');
require_once(__DIR__ . '/../stack/cas/installhelper.class.php');
require_once(__DIR__ . '/../stack/cas/connector.healthcheck.class.php');
// Check permissions.
require_login();
......@@ -49,23 +42,12 @@ $PAGE->set_url('/question/type/stack/adminui/healthcheck.php');
$title = stack_string('healthcheck');
$PAGE->set_title($title);
$config = stack_utils::get_config();
// Start output.
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
$config = stack_utils::get_config();
// This array holds summary info, for a table at the end of the pager.
$summary = array();
$summary[] = array('', $config->platform );
// Mbstring.
if (!extension_loaded('mbstring')) {
echo $OUTPUT->heading(stack_string('healthchecknombstring'), 3);
echo $OUTPUT->footer();
exit;
}
// Clear the cache if requested.
if (data_submitted() && optional_param('clearcache', false, PARAM_BOOL)) {
require_sesskey();
......@@ -92,115 +74,39 @@ if (data_submitted() && optional_param('createmaximaimage', false, PARAM_BOOL))
exit;
}
// LaTeX.
echo $OUTPUT->heading(stack_string('healthchecklatex'), 3);
echo html_writer::tag('p', stack_string('healthcheckmathsdisplaymethod',
stack_maths::configured_output_name()));
echo html_writer::tag('p', stack_string('healthchecklatexintro'));
echo html_writer::tag('dt', stack_string('texdisplaystyle'));
echo html_writer::tag('dd', stack_string('healthchecksampledisplaytex'));
echo html_writer::tag('dt', stack_string('texinlinestyle'));
echo html_writer::tag('dd', stack_string('healthchecksampleinlinetex'));
if ($config->mathsdisplay === 'mathjax') {
echo html_writer::tag('p', stack_string('healthchecklatexmathjax'));
} else {
$settingsurl = new moodle_url('/admin/filters.php');
echo html_writer::tag('p', stack_string('healthcheckfilters',
array('filter' => stack_maths::configured_output_name(), 'url' => $settingsurl->out())));
}
// Maxima config.
echo $OUTPUT->heading(stack_string('healthcheckconfig'), 3);
// From this point do all health-related actions.
// Try to list available versions of Maxima (linux only, without the DB).
if ($config->platform !== 'win') {
$connection = stack_connection_helper::make();
if (is_a($connection, 'stack_cas_connection_linux')) {
echo html_writer::tag('pre', $connection->get_maxima_available());
}
}
// Check for location of Maxima.
$maximalocation = stack_cas_configuration::confirm_maxima_win_location();
if ('' != $maximalocation) {
$message = stack_string('healthcheckconfigintro1').' '.html_writer::tag('tt', $maximalocation);
echo html_writer::tag('p', $message);
$summary[] = array(null, $message);
}
// Check if the current options for library packages are permitted (maximalibraries).
list($valid, $message) = stack_cas_configuration::validate_maximalibraries();
if (!$valid) {
echo html_writer::tag('p', $message);
$summary[] = array(false, $message);
// Mbstring. This is an install requirement, rather than a CAS healtcheck.
if (!extension_loaded('mbstring')) {
echo $OUTPUT->heading(stack_string('healthchecknombstring'), 3);
echo $OUTPUT->footer();
exit;
}
// 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);
$healthcheck = new stack_cas_healthcheck($config);
$tab = '';
foreach ($healthcheck->get_test_results() as $test) {
$tl = '';
if (true === $test['result']) {
$tl .= html_writer::tag('td', stack_string('testsuitepass'));
} else if (false === $test['result']) {
$tl .= html_writer::tag('td', stack_string('testsuitefail'));
} else {
$tl .= html_writer::tag('td', ' ');
}
// 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 === 'linux' && $genuinecascall) {
echo $OUTPUT->heading(stack_string('healthautomaxopt'), 3);
echo html_writer::tag('p', stack_string('healthautomaxoptintro'));
list($message, $debug, $result, $commandline, $rawcommand)
= stack_connection_helper::stackmaxima_auto_maxima_optimise($genuinedebug);
$summary[] = array($result, $message);
echo html_writer::tag('p', $message);
echo output_debug(stack_string('debuginfo'), $debug);
$tl .= html_writer::tag('td', $test['summary']);
$tab .= html_writer::tag('tr', $tl)."\n";
}
echo html_writer::tag('table', $tab);
if ($healthcheck->get_overall_result()) {
echo html_writer::tag('p', stack_string('healthcheckpass'), array('class' => 'overallresult pass'));
} else {
echo html_writer::tag('p', stack_string('healthcheckfail'), array('class' => 'overallresult fail'));
}
// Test the version of the STACK libraries that Maxima is using.
// When Maxima is being run pre-compiled (maxima-optimise) or on a server,
// it is possible for the version of the Maxima libraries to get out of synch
// with the qtype_stack code.
echo $OUTPUT->heading(stack_string('healthchecksstackmaximaversion'), 3);
list($message, $details, $result) = stack_connection_helper::stackmaxima_version_healthcheck();
$summary[] = array($result, stack_string($message, $details));
$summary[] = array(null, stack_string('settingmaximalibraries') . ' ' . $config->maximalibraries);
echo html_writer::tag('p', stack_string($message, $details));
// Test plots.
output_cas_text(stack_string('healthcheckplots'),
stack_string('healthcheckplotsintro'), get_string('healthchecksampleplots', 'qtype_stack'));
// State of the cache.
echo $OUTPUT->heading(stack_string('settingcasresultscache'), 3);
$message = stack_string('healthcheckcache_' . $config->casresultscache);
$summary[] = array(null, $message);
echo html_writer::tag('p', $message);
if ('db' == $config->casresultscache) {
echo html_writer::tag('p', stack_string('healthcheckcachestatus',
stack_cas_connection_db_cache::entries_count($DB)));
......@@ -216,49 +122,38 @@ if ($config->platform != 'win') {
stack_string('healthcheckcreateimage'));
}
echo '<hr />';
$tab = '';
foreach ($summary as $line) {
$tl = '';
if (true === $line[0]) {
$tl .= html_writer::tag('td', '<span class="ok">OK</span>');
} else if (false === $line[0]) {
$tl .= html_writer::tag('td', '<span class="error">FAILED</span>');
} else {
$tl .= html_writer::tag('td', ' ');
}
$tl .= html_writer::tag('td', $line[1]);
$tab .= html_writer::tag('tr', $tl)."\n";
}
echo html_writer::tag('table', $tab);
echo $OUTPUT->footer();
function output_cas_text($title, $intro, $castext) {
global $OUTPUT;
// LaTeX. This is an install requirement, rather than a CAS healtcheck.
echo $OUTPUT->heading(stack_string('healthchecklatex'), 3);
echo html_writer::tag('p', stack_string('healthcheckmathsdisplaymethod',
stack_maths::configured_output_name()));
echo html_writer::tag('p', stack_string('healthchecklatexintro'));
echo $OUTPUT->heading($title, 3);
echo html_writer::tag('p', $intro);
echo html_writer::tag('pre', s($castext));
echo html_writer::tag('dt', stack_string('texdisplaystyle'));
echo html_writer::tag('dd', stack_string('healthchecksampledisplaytex'));
$ct = castext2_evaluatable::make_from_source($castext, 'healthcheck');
$session = new stack_cas_session2([$ct]);
$session->instantiate();
echo html_writer::tag('dt', stack_string('texinlinestyle'));
echo html_writer::tag('dd', stack_string('healthchecksampleinlinetex'));
echo html_writer::tag('p', stack_ouput_castext($ct->get_rendered()));
echo output_debug(stack_string('errors'), $ct->get_errors());
echo output_debug(stack_string('debuginfo'), $session->get_debuginfo());
if ($config->mathsdisplay === 'mathjax') {
echo html_writer::tag('p', stack_string('healthchecklatexmathjax'));
} else {
$settingsurl = new moodle_url('/admin/filters.php');
echo html_writer::tag('p', stack_string('healthcheckfilters',
array('filter' => stack_maths::configured_output_name(), 'url' => $settingsurl->out())));
}
function output_debug($title, $message) {
global $OUTPUT;
if (!$message) {
return;
// Output details.
foreach ($healthcheck->get_test_results() as $test) {
if ($test['details'] !== null) {
echo '<hr />';
$heading = stack_string($test['tag']);
if ($test['result'] === false) {
$heading = stack_string('testsuitefail') . ' ' . $heading;
}
echo $OUTPUT->heading($heading, 3);
echo $test['details'];
}
return $OUTPUT->box($OUTPUT->heading($title) . $message);
}
echo $OUTPUT->footer();
......@@ -610,9 +610,7 @@ $string['healthcheckcache_db'] = 'CAS results are being cached in the database.'
$string['healthcheckcache_none'] = 'CAS results are not being cached.';
$string['healthcheckcache_otherdb'] = 'CAS results are being cached in another database.';
$string['healthcheckcachestatus'] = 'The cache currently contains {$a} entries.';
$string['healthcheckconfig'] = 'Maxima configuration file';
$string['healthcheckconfigintro1'] = 'Found, and using, Maxima in the following directory:';
$string['healthcheckconfigintro2'] = 'Trying to automatically write the Maxima configuration file.';
$string['healthcheckconnect'] = 'Trying to connect to the CAS';
$string['healthcheckconnectintro'] = 'We are trying to evaluate the following CAS text:';
$string['healthcheckfilters'] = 'Please ensure that the {$a->filter} is enabled on the <a href="{$a->url}">Manage filters</a> page.';
......@@ -623,9 +621,12 @@ $string['healthchecklatexmathjax'] = 'STACK relies on the Moodle MathJax filter.
$string['healthcheckmathsdisplaymethod'] = 'Maths display method being used: {$a}.';
$string['healthcheckmaximabat'] = 'The maxima.bat file is missing';
$string['healthcheckmaximabatinfo'] = 'This script tried to automatically copy the maxima.bat script from inside "C:\Program files\Maxima-1.xx.y\bin" into "{$a}\stack". However, this seems not to have worked. Please copy this file manually.';
$string['healthchecksamplecas'] = 'The derivative of {@ x^4/(1+x^4) @} is \[ \frac{d}{dx} \frac{x^4}{1+x^4} = {@ diff(x^4/(1+x^4),x) @}. \] Confirm if unicode is supported: \(\forall\) should be displayed {@unicode(8704)@}.';
$string['healthchecksamplecas'] = 'The derivative of {@ x^4/(1+x^4) @} is \[ \frac{d}{dx} \frac{x^4}{1+x^4} = {@ diff(x^4/(1+x^4),x) @}. \]';
$string['healthcheckconnectunicode'] = 'Trying to send unicode to the CAS';
$string['healthchecksamplecasunicode'] = 'Confirm if unicode is supported: \(\forall\) should be displayed {@unicode(8704)@}.';
$string['healthchecksampledisplaytex'] = '\[\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.\]';
$string['healthchecksampleinlinetex'] = '\(\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}\).';
$string['healthcheckmaximalocal'] = 'Contents of the maximalocal file';
$string['healthcheckplots'] = 'Graph plotting';
$string['healthcheckplotsintro'] = 'There should be two different plots. If two identical plots are seen then this is an error in naming the plot files. If no errors are returned, but a plot is not displayed then one of the following may help. (i) check read permissions on the two temporary directories. (ii) change the options used by GNUPlot to create the plot. Currently there is no web interface to these options.';
$string['healthchecksampleplots'] = 'Two example plots below. {@plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3])@} {@plot([sin(x),x,x^2,x^3],[x,-3,3],[y,-3,3],grid2d)@} A third, smaller, plot should be displayed below with traditional axes. {@plot([x,2*x^2-1,x*(4*x^2-3),8*x^4-8*x^2+1,x*(16*x^4-20*x^2+5),(2*x^2-1)*(16*x^4-16*x^2+1)],[x,-1,1],[y,-1.2,1.2],[box, false],[yx_ratio, 1],[axes, solid],[xtics, -3, 1, 3],[ytics, -3, 1, 3],[size,250,250])@}';
......@@ -654,6 +655,9 @@ $string['healthautomaxopt_notok'] = 'Maxima image not created automatically.';
$string['healthautomaxopt_nolisp'] = 'Unable to determine LISP version, so Maxima image not created automatically.';
$string['healthautomaxopt_nolisprun'] = 'Unable to automatically locate lisp.run. Try "sudo updatedb" from the command line and refer to the optimization docs.';
$string['healthcheckcreateimage'] = 'Create Maxima image';
$string['healthcheckmaximaavailable'] = 'Versions of Maxima available on this server';
$string['healthcheckpass'] = 'The healthcheck passed without detecting any issues. However, please read the detail below carefully. Not every problem can be automatically detected.';
$string['healthcheckfail'] = 'The healthcheck detected serious problems. Please read the diagnostic information below for more detail.';
$string['stackInstall_replace_dollars_desc'] = 'The <a href="{$a->link}">fix maths delimiters script</a> can be used to replace old-style delimiters like <code>@...@</code>, <code>$...$</code> and <code>$$...$$</code> in your questions with the new recommended <code>{@...@}</code>, <code>\(...\)</code> and <code>\[...\]</code>.';
$string['stackInstall_testsuite_title'] = 'A test suite for STACK Answer tests';
$string['stackInstall_testsuite_title_desc'] = 'The <a href="{$a->link}">answer-tests script</a> verifies that the answer tests are performing correctly. They are also useful to learn by example how each answer-test can be used.';
......
<?php
// This file is part of Stack - http://stack.maths.ed.ac.uk/
//
// Stack is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Stack is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../locallib.php');
require_once(__DIR__ . '/../utils.class.php');
require_once(__DIR__ . '/../options.class.php');
require_once(__DIR__ . '/connectorhelper.class.php');
require_once(__DIR__ . '/cassession2.class.php');
require_once(__DIR__ . '/castext2/castext2_evaluatable.class.php');
require_once(__DIR__ . '/connector.dbcache.class.php');
require_once(__DIR__ . '/installhelper.class.php');
/**
* This class supports the healthcheck functions..
*
* @copyright 2023 The University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/ast.container.class.php');
require_once(__DIR__ . '/connectorhelper.class.php');
require_once(__DIR__ . '/cassession2.class.php');
class stack_cas_healthcheck {
/* This variable holds the state of the healthcheck. */
protected $ishealthy = true;
protected $config = null;
protected $tests = array();
public function __construct($config) {
global $CFG;
$this->config = $config;
// Record the platform in the summary.
$test = array();
$test['tag'] = 'platform';
$test['result'] = null;
$test['summary'] = $config->platform;
$test['details'] = null;
$this->tests[] = $test;
// Check if the current options for library packages are permitted (maximalibraries).
list($result, $message) = stack_cas_configuration::validate_maximalibraries();
if (!$result) {
$this->ishealthy = false;
$test = array();
$test['tag'] = 'stackmaximalibraries';
$test['result'] = $result;
$test['summary'] = $message;
$test['details'] = $message;
$this->tests[] = $test;
}
// Try to connect to create maxima local.
stack_cas_configuration::create_maximalocal();
// Make sure we are in a position to call maxima.
switch ($config->platform) {
case 'win':
$maximalocation = stack_cas_configuration::confirm_maxima_win_location();
if ('' != $maximalocation) {
$test = array();
$test['tag'] = 'stackmaximalibraries';
$test['result'] = null;
$test['summary'] = null;
$test['details'] = html_writer::tag('p', stack_string('healthcheckconfigintro1').' '.
html_writer::tag('tt', $maximalocation));
$this->tests[] = $test;
} else {
$this->ishealthy = false;
$test = array();
$test['result'] = false;
$test['summary'] = "Could not confirm the location of Maxima";
$this->tests[] = $test;
}
stack_cas_configuration::copy_maxima_bat();
if (!is_readable($CFG->dataroot . '/stack/maxima.bat')) {
$this->ishealthy = false;
$test = array();
$test['tag'] = 'healthcheckmaximabat';
$test['result'] = false;
$test['summary'] = stack_string('healthcheckmaximabatinfo', $CFG->dataroot);
$test['details'] = html_writer::tag('p', stack_string('healthcheckmaximabatinfo', $CFG->dataroot));
$this->tests[] = $test;
}
break;
case 'server':
// We do nothing to this.
break;
default:
// Linux/optimised.
$connection = stack_connection_helper::make();
if (is_a($connection, 'stack_cas_connection_linux')) {
$test = array();
$test['tag'] = 'healthcheckmaximaavailable';
$test['result'] = null;
$test['summary'] = null;
$test['details'] = html_writer::tag('pre', $connection->get_maxima_available());
$this->tests[] = $test;
}
break;
}
// Record the contents of the maximalocal file.
if ($this->ishealthy) {
$test = array();
$test['tag'] = 'healthcheckmaximalocal';
$test['result'] = null;
$test['summary'] = null;
$test['details'] = html_writer::tag('textarea', stack_cas_configuration::generate_maximalocal_contents(),
array('readonly' => 'readonly', 'wrap' => 'virtual', 'rows' => '32', 'cols' => '100'));
$this->tests[] = $test;
}
// Test an *uncached* call to the CAS. I.e. a genuine call to the process.
if ($this->ishealthy) {
list($message, $genuinedebug, $result) = stack_connection_helper::stackmaxima_genuine_connect();
$this->ishealthy = $result;
$test = array();
$test['tag'] = 'healthuncached';
$test['result'] = $result;
$test['summary'] = $message;
$test['details'] = html_writer::tag('p', stack_string('healthuncachedintro')) . $message;
$test['details'] .= $genuinedebug;
$this->tests[] = $test;
}
// Test Maxima connection.
if ($this->ishealthy) {
// Intentionally use get_string for the sample CAS and plots, so we don't render
// the maths too soon.
$this->output_cas_text('healthcheckconnect',
stack_string('healthcheckconnectintro'), get_string('healthchecksamplecas', 'qtype_stack'));
$this->output_cas_text('healthcheckconnectunicode',
stack_string('healthcheckconnectintro'), get_string('healthchecksamplecasunicode', 'qtype_stack'));
$this->output_cas_text('healthcheckplots',
stack_string('healthcheckplotsintro'), get_string('healthchecksampleplots', '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 ($this->ishealthy && $config->platform === 'linux') {
list($message, $debug, $result, $commandline, $rawcommand)
= stack_connection_helper::stackmaxima_auto_maxima_optimise($genuinedebug);
$test = array();
$test['tag'] = 'healthautomaxopt';
$test['result'] = $result;
$test['summary'] = $message;
$test['details'] = html_writer::tag('p', stack_string('healthautomaxoptintro'));
$test['details'] .= html_writer::tag('pre', $debug);
$this->tests[] = $test;
}
if ($this->ishealthy) {
list($message, $details, $result) = stack_connection_helper::stackmaxima_version_healthcheck();
$test = array();
$test['tag'] = 'healthchecksstackmaximaversion';
$test['result'] = $result;
$test['summary'] = stack_string($message, $details);
$test['details'] = stack_string($message, $details);
$this->tests[] = $test;
}
$test = array();
$test['tag'] = 'settingmaximalibraries';
$test['result'] = null;
$test['summary'] = $config->maximalibraries;
$test['details'] = null;
$this->tests[] = $test;
$test = array();
$test['tag'] = 'settingcasresultscache';
$test['result'] = null;
$test['summary'] = stack_string('healthcheckcache_' . $config->casresultscache);
$test['details'] = null;
$this->tests[] = $test;
}
/*
* Try and evaluate the raw castext and build a result entry.
*/
private function output_cas_text($title, $intro, $castext) {
$ct = castext2_evaluatable::make_from_source($castext, 'healthcheck');
$session = new stack_cas_session2([$ct]);
$session->instantiate();
$test = array();
$test['tag'] = $title;
$test['result'] = null;
$test['summary'] = null;
$test['details'] = html_writer::tag('p', $intro) . html_writer::tag('pre', s($castext));
if ($session->get_errors()) {
$this->ishealthy = false;
$test['result'] = false;
$test['summary'] = stack_string('errors') . $ct->get_errors();
$test['details'] .= stack_string('errors') . $ct->get_errors();
$test['details'] .= stack_string('debuginfo') . $session->get_debuginfo();
} else {
$test['details'] .= html_writer::tag('p', stack_ouput_castext($ct->get_rendered()));
}
$this->tests[] = $test;
}
/*
* This function returns a summary of the status of the healthcheck.
*/
public function get_test_results() {
return $this->tests;
}
/*
* Return overall results.
*/
public function get_overall_result() {
return $this->ishealthy;
}
}
......@@ -183,10 +183,6 @@ class stack_cas_configuration {
public function copy_maxima_bat() {
global $CFG;
if ($this->settings->platform != 'win') {
return true;
}
$batchfilename = $this->maxima_win_location() . 'bin/maxima.bat';
if (substr_count($batchfilename, ' ') === 0) {
$batchfilecontents = "rem Auto-generated Maxima batch file. \n\n";
......@@ -205,16 +201,6 @@ class stack_cas_configuration {
return true;
}
public function maxima_bat_is_ok() {
global $CFG;
if ($this->settings->platform != 'win') {
return true;
}
return is_readable($CFG->dataroot . '/stack/maxima.bat');
}
public function get_maximalocal_contents() {
$contents = <<<END
/* ***********************************************************************/
......@@ -324,8 +310,6 @@ END;
make_upload_directory('stack/plots');
make_upload_directory('stack/tmp');
self::get_instance()->copy_maxima_bat();
if (!file_put_contents(self::maximalocal_location(), self::generate_maximalocal_contents())) {
throw new stack_exception('Failed to write Maxima configuration file.');
}
......@@ -339,14 +323,6 @@ END;
return self::get_instance()->get_maximalocal_contents();
}
/**
* Generate the contents for the maximalocal configuration file.
* @return string the contents that the maximalocal.mac file should have.
*/
public static function maxima_bat_is_missing() {
return !self::get_instance()->maxima_bat_is_ok();
}
/**
* Generate the directoryname
* @return string the contents that the maximalocal.mac file should have.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment