mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'w12_MDL-29515_m23_deprdb' of git://github.com/skodak/moodle
This commit is contained in:
commit
d68c62fe12
File diff suppressed because it is too large
Load Diff
@ -1863,23 +1863,6 @@ abstract class moodle_database {
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the proper SQL to do LIKE in a case-insensitive way.
|
||||
*
|
||||
* Note the LIKE are case sensitive for Oracle. Oracle 10g is required to use
|
||||
* the case insensitive search using regexp_like() or NLS_COMP=LINGUISTIC :-(
|
||||
* See http://docs.moodle.org/en/XMLDB_Problems#Case-insensitive_searches
|
||||
*
|
||||
* @deprecated since Moodle 2.0 MDL-23925 - please do not use this function any more.
|
||||
* @todo MDL-31280 to remove deprecated functions prior to 2.3 release.
|
||||
* @return string Do not use this function!
|
||||
* @see sql_like()
|
||||
*/
|
||||
public function sql_ilike() {
|
||||
debugging('sql_ilike() is deprecated, please use sql_like() instead');
|
||||
return 'LIKE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the proper SQL to do CONCAT between the elements(fieldnames) passed.
|
||||
*
|
||||
|
@ -1139,7 +1139,7 @@ class mssql_native_moodle_database extends moodle_database {
|
||||
*/
|
||||
public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = '\\') {
|
||||
if (strpos($param, '%') !== false) {
|
||||
debugging('Potential SQL injection detected, sql_ilike() expects bound parameters (? or :named)');
|
||||
debugging('Potential SQL injection detected, sql_like() expects bound parameters (? or :named)');
|
||||
}
|
||||
|
||||
$collation = $this->get_collation();
|
||||
|
@ -1178,7 +1178,7 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
*/
|
||||
public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = '\\') {
|
||||
if (strpos($param, '%') !== false) {
|
||||
debugging('Potential SQL injection detected, sql_ilike() expects bound parameters (? or :named)');
|
||||
debugging('Potential SQL injection detected, sql_like() expects bound parameters (? or :named)');
|
||||
}
|
||||
$escapechar = $this->mysqli->real_escape_string($escapechar); // prevents problems with C-style escapes of enclosing '\'
|
||||
|
||||
|
@ -1543,7 +1543,7 @@ class oci_native_moodle_database extends moodle_database {
|
||||
*/
|
||||
public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = '\\') {
|
||||
if (strpos($param, '%') !== false) {
|
||||
debugging('Potential SQL injection detected, sql_ilike() expects bound parameters (? or :named)');
|
||||
debugging('Potential SQL injection detected, sql_like() expects bound parameters (? or :named)');
|
||||
}
|
||||
|
||||
$LIKE = $notlike ? 'NOT LIKE' : 'LIKE';
|
||||
|
@ -1102,7 +1102,7 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
*/
|
||||
public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = '\\') {
|
||||
if (strpos($param, '%') !== false) {
|
||||
debugging('Potential SQL injection detected, sql_ilike() expects bound parameters (? or :named)');
|
||||
debugging('Potential SQL injection detected, sql_like() expects bound parameters (? or :named)');
|
||||
}
|
||||
$escapechar = pg_escape_string($this->pgsql, $escapechar); // prevents problems with C-style escapes of enclosing '\'
|
||||
|
||||
@ -1115,11 +1115,6 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
return "$fieldname $LIKE $param ESCAPE '$escapechar'";
|
||||
}
|
||||
|
||||
public function sql_ilike() {
|
||||
debugging('sql_ilike() is deprecated, please use sql_like() instead');
|
||||
return 'ILIKE';
|
||||
}
|
||||
|
||||
public function sql_bitxor($int1, $int2) {
|
||||
return '((' . $int1 . ') # (' . $int2 . '))';
|
||||
}
|
||||
|
@ -3537,33 +3537,6 @@ class dml_test extends UnitTestCase {
|
||||
//$this->assertEqual(count($records), 3, 'Accent insensitive LIKE searches may not be supported in all databases, this is not a problem.');
|
||||
}
|
||||
|
||||
function test_sql_ilike() {
|
||||
// note: this is deprecated, just make sure it does not throw error
|
||||
$DB = $this->tdb;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
$table = $this->get_test_table();
|
||||
$tablename = $table->getName();
|
||||
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$dbman->create_table($table);
|
||||
|
||||
$DB->insert_record($tablename, array('name'=>'SuperDuperRecord'));
|
||||
$DB->insert_record($tablename, array('name'=>'NoDupor'));
|
||||
$DB->insert_record($tablename, array('name'=>'ouch'));
|
||||
|
||||
// make sure it prints debug message
|
||||
$this->enable_debugging();
|
||||
$sql = "SELECT * FROM {{$tablename}} WHERE name ".$DB->sql_ilike()." ?";
|
||||
$params = array("%dup_r%");
|
||||
$this->assertFalse($this->get_debugging() === '');
|
||||
|
||||
// following must not throw exception, we ignore result
|
||||
$DB->get_records_sql($sql, $params);
|
||||
}
|
||||
|
||||
function test_coalesce() {
|
||||
$DB = $this->tdb;
|
||||
|
||||
@ -4626,4 +4599,4 @@ class dml_test_object_one {
|
||||
public function __toString() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1195,7 +1195,7 @@ class sqlsrv_native_moodle_database extends moodle_database {
|
||||
*/
|
||||
public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = '\\') {
|
||||
if (strpos($param, '%') !== false) {
|
||||
debugging('Potential SQL injection detected, sql_ilike() expects bound parameters (? or :named)');
|
||||
debugging('Potential SQL injection detected, sql_like() expects bound parameters (? or :named)');
|
||||
}
|
||||
|
||||
$collation = $this->get_collation();
|
||||
|
@ -60,17 +60,6 @@ class xmldb_field extends xmldb_object {
|
||||
$this->set_attributes($type, $precision, $unsigned, $notnull, $sequence, $default, $previous);
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
|
||||
function setAttributes($type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $enum=null, $enumvalues=null, $default=null, $previous=null) {
|
||||
|
||||
debugging('XMLDBField->setAttributes() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_field->set_attributes() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->set_attributes($type, $precision, $unsigned, $notnull, $sequence, $default, $previous);
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
||||
/**
|
||||
* Set all the attributes of one xmldb_field
|
||||
*
|
||||
@ -748,14 +737,3 @@ class xmldb_field extends xmldb_object {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
class XMLDBField extends xmldb_field {
|
||||
|
||||
function __construct($name) {
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
@ -57,16 +57,6 @@ class xmldb_index extends xmldb_object {
|
||||
return $this->set_attributes($type, $fields);
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
function setAttributes($type, $fields) {
|
||||
|
||||
debugging('XMLDBIndex->setAttributes() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_index->set_attributes() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->set_attributes($type, $fields);
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
||||
/**
|
||||
* Set all the attributes of one xmldb_index
|
||||
*
|
||||
@ -356,14 +346,3 @@ class xmldb_index extends xmldb_object {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
class XMLDBIndex extends xmldb_index {
|
||||
|
||||
function __construct($name) {
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
@ -45,17 +45,6 @@ class xmldb_key extends xmldb_object {
|
||||
$this->set_attributes($type, $fields, $reftable, $reffields);
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
|
||||
function setAttributes($type, $fields, $reftable=null, $reffields=null) {
|
||||
|
||||
debugging('XMLDBKey->setAttributes() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_key->set_attributes() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->set_attributes($type, $fields, $reftable, $reffields);
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
||||
/**
|
||||
* Set all the attributes of one xmldb_key
|
||||
*
|
||||
@ -469,14 +458,3 @@ class xmldb_key extends xmldb_object {
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
class XMLDBKey extends xmldb_key {
|
||||
|
||||
function __construct($name) {
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
@ -704,17 +704,6 @@ class xmldb_table extends xmldb_object {
|
||||
return $o;
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
function addFieldInfo($name, $type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $enum=null, $enumvalues=null, $default=null, $previous=null) {
|
||||
|
||||
debugging('XMLDBTable->addFieldInfo() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_table->add_field() instead', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->add_field($name, $type, $precision, $unsigned, $notnull, $sequence, $default, $previous);
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
||||
/**
|
||||
* This function will add one new field to the table with all
|
||||
* its attributes defined
|
||||
@ -735,18 +724,6 @@ class xmldb_table extends xmldb_object {
|
||||
return $field;
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
|
||||
function addKeyInfo($name, $type, $fields, $reftable=null, $reffields=null) {
|
||||
|
||||
debugging('XMLDBTable->addKeyInfo() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_table->add_key() instead', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->add_key($name, $type, $fields, $reftable, $reffields);
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
||||
/**
|
||||
* This function will add one new key to the table with all
|
||||
* its attributes defined
|
||||
@ -762,17 +739,6 @@ class xmldb_table extends xmldb_object {
|
||||
$this->addKey($key);
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
function addIndexInfo($name, $type, $fields) {
|
||||
|
||||
debugging('XMLDBTable->addIndexInfo() has been deprecated in Moodle 2.0. Will be out in Moodle 2.1. Please use xmldb_table->add_index() instead', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->add_index($name, $type, $fields);
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
||||
/**
|
||||
* This function will add one new index to the table with all
|
||||
* its attributes defined
|
||||
@ -830,14 +796,3 @@ class xmldb_table extends xmldb_object {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: Delete for 2.1 (deeprecated in 2.0).
|
||||
/// Deprecated API starts here
|
||||
class XMLDBTable extends xmldb_table {
|
||||
|
||||
function __construct($name) {
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
}
|
||||
/// Deprecated API ends here
|
||||
|
Loading…
x
Reference in New Issue
Block a user