mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Introducing CFG->dbfamily and deleting check_db_compat(). MDL-7061
This commit is contained in:
parent
32db0d42c9
commit
485056620e
1 changed files with 3 additions and 26 deletions
|
@ -787,7 +787,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
|
|||
global $CFG;
|
||||
|
||||
//to allow case-insensitive search for postgesql
|
||||
if ($CFG->dbtype == 'postgres7') {
|
||||
if ($CFG->dbfamily == 'postgres') {
|
||||
$LIKE = 'ILIKE';
|
||||
$NOTLIKE = 'NOT ILIKE'; // case-insensitive
|
||||
$REGEXP = '~*';
|
||||
|
@ -806,7 +806,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
|
|||
|
||||
/// Under Oracle and MSSQL, trim the + and - operators and perform
|
||||
/// simpler LIKE search
|
||||
if ($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n' || $CFG->dbtype == 'odbc_mssql') {
|
||||
if ($CFG->dbfamily == 'oracle' || $CFG->dbfamily == 'mssql') {
|
||||
$searchterm = trim($searchterm, '+-');
|
||||
}
|
||||
|
||||
|
@ -967,7 +967,7 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0, $depth=0, $path='')
|
|||
$n = $n + $catgap;
|
||||
// if the new sequence overlaps the current sequence, lack of transactions
|
||||
// will stop us -- shift things aside for a moment...
|
||||
if ($safe || ($n >= $min && $n+$count+1 < $min && $CFG->dbtype==='mysql')) {
|
||||
if ($safe || ($n >= $min && $n+$count+1 < $min && $CFG->dbfamily==='mysql')) {
|
||||
$shift = $max + $n + 1000;
|
||||
execute_sql("UPDATE {$CFG->prefix}course
|
||||
SET sortorder=sortorder+$shift
|
||||
|
@ -1548,29 +1548,6 @@ function print_object($object) {
|
|||
echo '<pre>'.htmlspecialchars(print_r($object,true)).'</pre>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks for pg or mysql > 4
|
||||
*/
|
||||
|
||||
function check_db_compat() {
|
||||
global $CFG,$db;
|
||||
|
||||
if ($CFG->dbtype == 'postgres7') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$rs = $db->Execute("SELECT version();")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (intval($rs->fields[0]) <= 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function course_parent_visible($course = null) {
|
||||
global $CFG;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue