Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for bug 4011 -- a MySQL specific workaround did not work with dat…

…abase names with hyphens, and broke the whole plugin for other databases. This patch fixes both issues.
  • Loading branch information...
commit 0aff0bf622484ab1fb341fa4d2f50c78a0079eaf 1 parent 72ed108
martinlanghoff authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 enrol/database/enrol.php
View
11 enrol/database/enrol.php
@@ -21,13 +21,14 @@ function get_student_courses(&$user) {
/// If the database fails we can at least use this
// This is a hack to workaround what seems to be a bug in ADOdb with accessing
- // two databases of the same kind ... it seems to get confused when trying to access
+ // two MySQL databases ... it seems to get confused when trying to access
// the first database again, after having accessed the second.
// The following hack will make the database explicit which keeps it happy
-
- if (strpos($CFG->prefix, $CFG->dbname) === false) {
- $oldprefix = $CFG->prefix;
- $CFG->prefix = "$CFG->dbname.$CFG->prefix";
+ if ($CFG->dbtype === 'mysql' && $CFG->enrol_dbtype === 'mysql') {
+ if (strpos($CFG->prefix, $CFG->dbname) === false) {
+ $oldprefix = $CFG->prefix;
+ $CFG->prefix = "`$CFG->dbname`.$CFG->prefix";
+ }
}
// Try to connect to the external database
Please sign in to comment.
Something went wrong with that request. Please try again.