mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 10:56:56 +02:00
MDL-44377 dml: enforce non-empty prefix for sqlsrv
Only MySQL is allowed to run Moodle instances without (with an empty) database prefix. The rationale is that "user" is a reserved word in every RDBMS but MySQL. Before this patch, installation was breaking badly, when the "user" CREATE TABLE statement was issued. With this patch the error is shown earlier (on connection) preventing any advance/use of the database. This check is present in all the drivers, just sqlsrv was missing it.
This commit is contained in:
parent
ed0a48b2c1
commit
36f74f56d8
1 changed files with 5 additions and 0 deletions
|
@ -130,6 +130,11 @@ class sqlsrv_native_moodle_database extends moodle_database {
|
||||||
* @throws dml_connection_exception if error
|
* @throws dml_connection_exception if error
|
||||||
*/
|
*/
|
||||||
public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dboptions=null) {
|
public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dboptions=null) {
|
||||||
|
if ($prefix == '' and !$this->external) {
|
||||||
|
// Enforce prefixes for everybody but mysql.
|
||||||
|
throw new dml_exception('prefixcannotbeempty', $this->get_dbfamily());
|
||||||
|
}
|
||||||
|
|
||||||
$driverstatus = $this->driver_installed();
|
$driverstatus = $this->driver_installed();
|
||||||
|
|
||||||
if ($driverstatus !== true) {
|
if ($driverstatus !== true) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue