From ef69fa6e2934cf12fa7d1250e84e39a4fef2edb7 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 13 May 2012 13:17:51 +0200 Subject: [PATCH] MDL-28676 add hack mysqli php ext requirement for upgrades to 2.x The mysql extension is not supported in Moodle 2.x, this hack should inform admins that they must add mysqli support before doing 2.x upgrades. --- lib/environmentlib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/environmentlib.php b/lib/environmentlib.php index d547df7d32a..067b9cb41e3 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -482,6 +482,17 @@ function environment_check_php_extensions($version) { $result->setErrorCode(NO_PHP_EXTENSIONS_SECTION_FOUND); return array($result); } + +/// Hack alert: inject extra mysqli dependency, mysql PHP extension is not supported in Moodle 2.x, warn only ppl using MySQL. + global $CFG; + set_dbfamily(); + if ($CFG->dbfamily === 'mysql') { + $mver = normalize_version($version); + if (version_compare($mver, '2.0', 'ge')) { + $data['#']['PHP_EXTENSIONS']['0']['#']['PHP_EXTENSION'][] = array('#' => '', '@' => array('name' => 'mysqli', 'level' => 'required')); + } + } + /// Iterate over extensions checking them and creating the needed environment_results foreach($data['#']['PHP_EXTENSIONS']['0']['#']['PHP_EXTENSION'] as $extension) { $result = new environment_results('php_extension');