From db3252c18d9599a0187c471c5a023bb044d5f684 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Tue, 6 Jun 2017 09:08:48 +0200 Subject: [PATCH] MDL-59152 mlbackend_php: Check PHP version Part of MDL-57791 epic. --- lib/mlbackend/php/classes/processor.php | 3 +++ lib/mlbackend/php/lang/en/mlbackend_php.php | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/mlbackend/php/classes/processor.php b/lib/mlbackend/php/classes/processor.php index e6ed0cb934ca2..0ad106b5a22f0 100644 --- a/lib/mlbackend/php/classes/processor.php +++ b/lib/mlbackend/php/classes/processor.php @@ -55,6 +55,9 @@ class processor implements \core_analytics\predictor { protected $limitedsize = false; public function is_ready() { + if (version_compare(phpversion(), '7.0.0') < 0) { + return get_string('errorphp7required', 'mlbackend_php'); + } return true; } diff --git a/lib/mlbackend/php/lang/en/mlbackend_php.php b/lib/mlbackend/php/lang/en/mlbackend_php.php index 6fed20fc534eb..2262879f941b2 100644 --- a/lib/mlbackend/php/lang/en/mlbackend_php.php +++ b/lib/mlbackend/php/lang/en/mlbackend_php.php @@ -1,7 +1,8 @@ mlbackend_php_no_memory_limit if you are confident that your system can cope a {$a} dataset'; $string['errorcantloadmodel'] = 'Model file {$a} does not exist, ensure the model has been trained before using it to predict.'; -$string['errornotenoughdata'] = 'The evaluation results varied too much, you could try to gather more data to ensure the model is valid. Evaluation results standard deviation = {$a->deviation}, maximum recommended standard deviation = {$a->accepteddeviation}'; $string['errorlowscore'] = 'The evaluated model prediction accuracy is not very high, some predictions may not be accurate. Model score = {$a->score}, minimum score = {$a->minscore}'; -$string['datasetsizelimited'] = 'Only a part of the evaluation dataset has been evaluated due to its size. Set $CFG->mlbackend_php_no_memory_limit if you are confident that your system can cope a {$a} dataset'; +$string['errornotenoughdata'] = 'The evaluation results varied too much, you could try to gather more data to ensure the model is valid. Evaluation results standard deviation = {$a->deviation}, maximum recommended standard deviation = {$a->accepteddeviation}'; +$string['errorphp7required'] = 'The PHP machine learning backend requires PHP 7'; +$string['pluginname'] = 'PHP machine learning backend';