diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index eed77e964e5..714efb884f0 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -832,1069 +832,10 @@ function error($message, $link='') { } -/// Deprecated DDL functions, to be removed soon /// -/** - * @deprecated - * @global object - * @param string $table - * @return bool - */ -function table_exists($table) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->table_exists($table); -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function field_exists($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->field_exists($table, $field); -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $index - * @return bool - */ -function find_index_name($table, $index) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->find_index_name($table, $index); -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $index - * @return bool - */ -function index_exists($table, $index) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->index_exists($table, $index); -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $xmldb_key - * @return bool - */ -function find_key_name($table, $xmldb_key) { - global $DB; - debugging('Deprecated ddllib function used!'); - return $DB->get_manager()->find_key_name($table, $xmldb_key); -} - -/** - * @deprecated - * @global object - * @param string $table - * @return bool - */ -function drop_table($table) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->drop_table($table); - return true; -} - -/** - * @deprecated - * @global object - * @param string $file - * @return bool - */ -function install_from_xmldb_file($file) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->install_from_xmldb_file($file); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @return bool - */ -function create_table($table) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->create_table($table); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @return bool - */ -function create_temp_table($table) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->create_temp_table($table); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $newname - * @return bool - */ -function rename_table($table, $newname) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->rename_table($table, $newname); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function add_field($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->add_field($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function drop_field($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->drop_field($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function change_field_type($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->change_field_type($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function change_field_precision($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->change_field_precision($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function change_field_unsigned($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->change_field_unsigned($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function change_field_notnull($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->change_field_notnull($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @return bool - */ -function change_field_default($table, $field) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->change_field_default($table, $field); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $field - * @param string $newname - * @return bool - */ -function rename_field($table, $field, $newname) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->rename_field($table, $field, $newname); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $key - * @return bool - */ -function add_key($table, $key) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->add_key($table, $key); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $key - * @return bool - */ -function drop_key($table, $key) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->drop_key($table, $key); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $key - * @param string $newname - * @return bool - */ -function rename_key($table, $key, $newname) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->rename_key($table, $key, $newname); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $index - * @return bool - */ -function add_index($table, $index) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->add_index($table, $index); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $index - * @return bool - */ -function drop_index($table, $index) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->drop_index($table, $index); - return true; -} - -/** - * @deprecated - * @global object - * @param string $table - * @param string $index - * @param string $newname - * @return bool - */ -function rename_index($table, $index, $newname) { - global $DB; - debugging('Deprecated ddllib function used!'); - $DB->get_manager()->rename_index($table, $index, $newname); - return true; -} - - ////////////////////////// /// removed functions //// ////////////////////////// -/** - * @deprecated - * @param mixed $mixed - * @return void Throws an error and does nothing - */ -function stripslashes_safe($mixed) { - error('stripslashes_safe() not available anymore'); -} -/** - * @deprecated - * @param mixed $var - * @return void Throws an error and does nothing - */ -function stripslashes_recursive($var) { - error('stripslashes_recursive() not available anymore'); -} -/** - * @deprecated - * @param mixed $dataobject - * @return void Throws an error and does nothing - */ -function addslashes_object($dataobject) { - error('addslashes_object() not available anymore'); -} -/** - * @deprecated - * @param mixed $var - * @return void Throws an error and does nothing - */ -function addslashes_recursive($var) { - error('addslashes_recursive() not available anymore'); -} -/** - * @deprecated - * @param mixed $command - * @param bool $feedback - * @return void Throws an error and does nothing - */ -function execute_sql($command, $feedback=true) { - error('execute_sql() not available anymore'); -} -/** - * @deprecated use $DB->record_exists_select() instead - * @see moodle_database::record_exists_select() - * @param mixed $table - * @param mixed $select - * @return void Throws an error and does nothing - */ -function record_exists_select($table, $select='') { - error('record_exists_select() not available anymore'); -} -/** - * @deprecated use $DB->record_exists_sql() instead - * @see moodle_database::record_exists_sql() - * @param mixed $sql - * @return void Throws an error and does nothing - */ -function record_exists_sql($sql) { - error('record_exists_sql() not available anymore'); -} -/** - * @deprecated use $DB->count_records_select() instead - * @see moodle_database::count_records_select() - * @param mixed $table - * @param mixed $select - * @param mixed $countitem - * @return void Throws an error and does nothing - */ -function count_records_select($table, $select='', $countitem='COUNT(*)') { - error('count_records_select() not available anymore'); -} -/** - * @deprecated use $DB->count_records_sql() instead - * @see moodle_database::count_records_sql() - * @param mixed $sql - * @return void Throws an error and does nothing - */ -function count_records_sql($sql) { - error('count_records_sql() not available anymore'); -} -/** - * @deprecated use $DB->get_record_sql() instead - * @see moodle_database::get_record_sql() - * @param mixed $sql - * @param bool $expectmultiple - * @param bool $nolimit - * @return void Throws an error and does nothing - */ -function get_record_sql($sql, $expectmultiple=false, $nolimit=false) { - error('get_record_sql() not available anymore'); -} -/** - * @deprecated use $DB->get_record_select() instead - * @see moodle_database::get_record_select() - * @param mixed $table - * @param mixed $select - * @param mixed $fields - * @return void Throws an error and does nothing - */ -function get_record_select($table, $select='', $fields='*') { - error('get_record_select() not available anymore'); -} -/** - * @deprecated use $DB->get_recordset() instead - * @see moodle_database::get_recordset() - * @param mixed $table - * @param mixed $field - * @param mixed $value - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_recordset($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_recordset() not available anymore'); -} -/** - * @deprecated use $DB->get_recordset_sql() instead - * @see moodle_database::get_recordset_sql() - * @param mixed $sql - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) { - error('get_recordset_sql() not available anymore'); -} -/** - * @deprecated - * @param mixed $rs - * @return void Throws an error and does nothing - */ -function rs_fetch_record(&$rs) { - error('rs_fetch_record() not available anymore'); -} -/** - * @deprecated - * @param mixed $rs - * @return void Throws an error and does nothing - */ -function rs_next_record(&$rs) { - error('rs_next_record() not available anymore'); -} -/** - * @deprecated - * @param mixed $rs - * @return void Throws an error and does nothing - */ -function rs_fetch_next_record(&$rs) { - error('rs_fetch_next_record() not available anymore'); -} -/** - * @deprecated - * @param mixed $rs - * @return void Throws an error and does nothing - */ -function rs_EOF($rs) { - error('rs_EOF() not available anymore'); -} -/** - * @deprecated - * @param mixed $rs - * @return void Throws an error and does nothing - */ -function rs_close(&$rs) { - error('rs_close() not available anymore'); -} -/** - * @deprecated use $DB->get_records_select() instead - * @see moodle_database::get_records_select() - * @param mixed $table - * @param mixed $select - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_records_select($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_records_select() not available anymore'); -} -/** - * @deprecated use $DB->get_field_select() instead - * @see moodle_database::get_field_select() - * @param mixed $table - * @param mixed $return - * @param mixed $select - * @return void Throws an error and does nothing - */ -function get_field_select($table, $return, $select) { - error('get_field_select() not available anymore'); -} -/** - * @deprecated use $DB->get_field_sql() instead - * @see moodle_database::get_field_sql() - * @param mixed $sql - * @return void Throws an error and does nothing - */ -function get_field_sql($sql) { - error('get_field_sql() not available anymore'); -} -/** - * @deprecated use $DB->delete_records_select() instead - * @see moodle_database::delete_records_select() - * @param mixed $sql - * @param mixed $select - * @return void Throws an error and does nothing - */ -function delete_records_select($table, $select='') { - error('get_field_sql() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function configure_dbconnection() { - error('configure_dbconnection() removed'); -} -/** - * @deprecated - * @param mixed $field - * @return void Throws an error and does nothing - */ -function sql_max($field) { - error('sql_max() removed - use normal sql MAX() instead'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function sql_as() { - error('sql_as() removed - do not use AS for tables at all'); -} -/** - * @deprecated - * @param mixed $page - * @param mixed $recordsperpage - * @return void Throws an error and does nothing - */ -function sql_paging_limit($page, $recordsperpage) { - error('Function sql_paging_limit() is deprecated. Replace it with the correct use of limitfrom, limitnum parameters'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function db_uppercase() { - error('upper() removed - use normal sql UPPER()'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function db_lowercase() { - error('upper() removed - use normal sql LOWER()'); -} -/** - * @deprecated - * @param mixed $sqlfile - * @param mixed $sqlstring - * @return void Throws an error and does nothing - */ -function modify_database($sqlfile='', $sqlstring='') { - error('modify_database() removed - use new XMLDB functions'); -} -/** - * @deprecated - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @return void Throws an error and does nothing - */ -function where_clause($field1='', $value1='', $field2='', $value2='', $field3='', $value3='') { - error('where_clause() removed - use new functions with $conditions parameter'); -} -/** - * @deprecated - * @param mixed $sqlarr - * @param mixed $continue - * @param mixed $feedback - * @return void Throws an error and does nothing - */ -function execute_sql_arr($sqlarr, $continue=true, $feedback=true) { - error('execute_sql_arr() removed'); -} -/** - * @deprecated use $DB->get_records_list() instead - * @see moodle_database::get_records_list() - * @param mixed $table - * @param mixed $field - * @param mixed $values - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_records_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_records_list() removed'); -} -/** - * @deprecated use $DB->get_recordset_list() instead - * @see moodle_database::get_recordset_list() - * @param mixed $table - * @param mixed $field - * @param mixed $values - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_recordset_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_recordset_list() removed'); -} -/** - * @deprecated use $DB->get_records_menu() instead - * @see moodle_database::get_records_menu() - * @param mixed $table - * @param mixed $field - * @param mixed $value - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_records_menu($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_records_menu() removed'); -} -/** - * @deprecated use $DB->get_records_select_menu() instead - * @see moodle_database::get_records_select_menu() - * @param mixed $table - * @param mixed $select - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_records_select_menu($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_records_select_menu() removed'); -} -/** - * @deprecated use $DB->get_records_sql_menu() instead - * @see moodle_database::get_records_sql_menu() - * @param mixed $sql - * @param mixed $limitfrom - * @param mixed $limitnum - * @return void Throws an error and does nothing - */ -function get_records_sql_menu($sql, $limitfrom='', $limitnum='') { - error('get_records_sql_menu() removed'); -} -/** - * @deprecated - * @param mixed $table - * @param mixed $column - * @return void Throws an error and does nothing - */ -function column_type($table, $column) { - error('column_type() removed'); -} -/** - * @deprecated - * @param mixed $rs - * @return void Throws an error and does nothing - */ -function recordset_to_menu($rs) { - error('recordset_to_menu() removed'); -} -/** - * @deprecated - * @param mixed $records - * @param mixed $field1 - * @param mixed $field2 - * @return void Throws an error and does nothing - */ -function records_to_menu($records, $field1, $field2) { - error('records_to_menu() removed'); -} -/** - * @deprecated use $DB->set_field_select() instead - * @see moodle_database::set_field_select() - * @param mixed $table - * @param mixed $newfield - * @param mixed $newvalue - * @param mixed $select - * @param mixed $localcall - * @return void Throws an error and does nothing - */ -function set_field_select($table, $newfield, $newvalue, $select, $localcall = false) { - error('set_field_select() removed'); -} -/** - * @deprecated use $DB->get_fieldset_select() instead - * @see moodle_database::get_fieldset_select() - * @param mixed $table - * @param mixed $return - * @param mixed $select - * @return void Throws an error and does nothing - */ -function get_fieldset_select($table, $return, $select) { - error('get_fieldset_select() removed'); -} -/** - * @deprecated use $DB->get_fieldset_sql() instead - * @see moodle_database::get_fieldset_sql() - * @param mixed $sql - * @return void Throws an error and does nothing - */ -function get_fieldset_sql($sql) { - error('get_fieldset_sql() removed'); -} -/** - * @deprecated use $DB->sql_like() instead - * @see moodle_database::sql_like() - * @return void Throws an error and does nothing - */ -function sql_ilike() { - error('sql_ilike() not available anymore'); -} -/** - * @deprecated - * @param mixed $first - * @param mixed $last - * @return void Throws an error and does nothing - */ -function sql_fullname($first='firstname', $last='lastname') { - error('sql_fullname() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function sql_concat() { - error('sql_concat() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function sql_empty() { - error('sql_empty() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function sql_substr() { - error('sql_substr() not available anymore'); -} -/** - * @deprecated - * @param mixed $int1 - * @param mixed $int2 - * @return void Throws an error and does nothing - */ -function sql_bitand($int1, $int2) { - error('sql_bitand() not available anymore'); -} -/** - * @deprecated - * @param mixed $int1 - * @return void Throws an error and does nothing - */ -function sql_bitnot($int1) { - error('sql_bitnot() not available anymore'); -} -/** - * @deprecated - * @param mixed $int1 - * @param mixed $int2 - * @return void Throws an error and does nothing - */ -function sql_bitor($int1, $int2) { - error('sql_bitor() not available anymore'); -} -/** - * @deprecated - * @param mixed $int1 - * @param mixed $int2 - * @return void Throws an error and does nothing - */ -function sql_bitxor($int1, $int2) { - error('sql_bitxor() not available anymore'); -} -/** - * @deprecated - * @param mixed $fieldname - * @param mixed $text - * @return void Throws an error and does nothing - */ -function sql_cast_char2int($fieldname, $text=false) { - error('sql_cast_char2int() not available anymore'); -} -/** - * @deprecated - * @param mixed $fieldname - * @param mixed $numchars - * @return void Throws an error and does nothing - */ -function sql_compare_text($fieldname, $numchars=32) { - error('sql_compare_text() not available anymore'); -} -/** - * @deprecated - * @param mixed $fieldname - * @param mixed $numchars - * @return void Throws an error and does nothing - */ -function sql_order_by_text($fieldname, $numchars=32) { - error('sql_order_by_text() not available anymore'); -} -/** - * @deprecated - * @param mixed $fieldname - * @return void Throws an error and does nothing - */ -function sql_length($fieldname) { - error('sql_length() not available anymore'); -} -/** - * @deprecated - * @param mixed $separator - * @param mixed $elements - * @return void Throws an error and does nothing - */ -function sql_concat_join($separator="' '", $elements=array()) { - error('sql_concat_join() not available anymore'); -} -/** - * @deprecated - * @param mixed $tablename - * @param mixed $fieldname - * @param mixed $nullablefield - * @param mixed $textfield - * @return void Throws an error and does nothing - */ -function sql_isempty($tablename, $fieldname, $nullablefield, $textfield) { - error('sql_isempty() not available anymore'); -} -/** - * @deprecated - * @param mixed $tablename - * @param mixed $fieldname - * @param mixed $nullablefield - * @param mixed $textfield - * @return void Throws an error and does nothing - */ -function sql_isnotempty($tablename, $fieldname, $nullablefield, $textfield) { - error('sql_isnotempty() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function begin_sql() { - error('begin_sql() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function commit_sql() { - error('commit_sql() not available anymore'); -} -/** - * @deprecated - * @return void Throws an error and does nothing - */ -function rollback_sql() { - error('rollback_sql() not available anymore'); -} -/** - * @deprecated use $DB->insert_record() instead - * @see moodle_database::insert_record() - * @param mixed $table - * @param mixed $dataobject - * @param mixed $returnid - * @param mixed $primarykey - * @return void Throws an error and does nothing - */ -function insert_record($table, $dataobject, $returnid=true, $primarykey='id') { - error('insert_record() not available anymore'); -} -/** - * @deprecated use $DB->update_record() instead - * @see moodle_database::update_record() - * @param mixed $table - * @param mixed $dataobject - * @return void Throws an error and does nothing - */ -function update_record($table, $dataobject) { - error('update_record() not available anymore'); -} -/** - * @deprecated use $DB->get_records() instead - * @see moodle_database::get_records() - * @param mixed $table - * @param mixed $field - * @param mixed $value - * @param mixed $sort - * @param mixed $fields - * @param mixed $limitfrom - * @param mixed $limitnum - * - * @return void Throws an error and does nothing - */ -function get_records($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - error('get_records() not available anymore'); -} -/** - * @deprecated use $DB->get_record() instead - * @see moodle_database::get_record() - * @param mixed $table - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @param mixed $fields - * @return void Throws an error and does nothing - */ -function get_record($table, $field1, $value1, $field2='', $value2='', $field3='', $value3='', $fields='*') { - error('get_record() not available anymore'); -} -/** - * @deprecated use $DB->set_field() instead - * @see moodle_database::set_field() - * @param mixed $table - * @param mixed $newfield - * @param mixed $newvalue - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @return void Throws an error and does nothing - */ -function set_field($table, $newfield, $newvalue, $field1, $value1, $field2='', $value2='', $field3='', $value3='') { - error('set_field() not available anymore'); -} -/** - * @deprecated use $DB->count_records() instead - * @see moodle_database::count_records() - * @param mixed $table - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @return void Throws an error and does nothing - */ -function count_records($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') { - error('count_records() not available anymore'); -} -/** - * @deprecated use $DB->record_exists() instead - * @see moodle_database::record_exists() - * @param mixed $table - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @return void Throws an error and does nothing - */ -function record_exists($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') { - error('record_exists() not available anymore'); -} -/** - * @deprecated use $DB->delete_records() instead - * @see moodle_database::delete_records() - * @param mixed $table - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @return void Throws an error and does nothing - */ -function delete_records($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') { - error('delete_records() not available anymore'); -} -/** - * @deprecated use $DB->get_field() instead - * @see moodle_database::get_field() - * @param mixed $table - * @param mixed $return - * @param mixed $field1 - * @param mixed $value1 - * @param mixed $field2 - * @param mixed $value2 - * @param mixed $field3 - * @param mixed $value3 - * @return void Throws an error and does nothing - */ -function get_field($table, $return, $field1, $value1, $field2='', $value2='', $field3='', $value3='') { - error('get_field() not available anymore'); -} -/** - * @deprecated - * @param mixed $table - * @param mixed $oldfield - * @param mixed $field - * @param mixed $type - * @param mixed $size - * @param mixed $signed - * @param mixed $default - * @param mixed $null - * @param mixed $after - * @return void Throws an error and does nothing - */ -function table_column($table, $oldfield, $field, $type='integer', $size='10', - $signed='unsigned', $default='0', $null='not null', $after='') { - error('table_column() was removed, please use new ddl functions'); -} /** * @deprecated * @param mixed $name diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 3c736aef71c..cf723eb7f93 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -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. * diff --git a/lib/dml/mssql_native_moodle_database.php b/lib/dml/mssql_native_moodle_database.php index da600cf5dfd..18e76812dcb 100644 --- a/lib/dml/mssql_native_moodle_database.php +++ b/lib/dml/mssql_native_moodle_database.php @@ -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(); diff --git a/lib/dml/mysqli_native_moodle_database.php b/lib/dml/mysqli_native_moodle_database.php index 2f3ab2197a0..9770988f005 100644 --- a/lib/dml/mysqli_native_moodle_database.php +++ b/lib/dml/mysqli_native_moodle_database.php @@ -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 '\' diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index 8e10ff1ccb6..8beaf21d2a1 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -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'; diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index ed37e64b199..7262f65a5f6 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -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 . '))'; } diff --git a/lib/dml/simpletest/testdml.php b/lib/dml/simpletest/testdml.php index 39d76420068..c10eccaff71 100644 --- a/lib/dml/simpletest/testdml.php +++ b/lib/dml/simpletest/testdml.php @@ -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; } -} \ No newline at end of file +} diff --git a/lib/dml/sqlsrv_native_moodle_database.php b/lib/dml/sqlsrv_native_moodle_database.php index 914c00edc8a..2147e6c0a6c 100644 --- a/lib/dml/sqlsrv_native_moodle_database.php +++ b/lib/dml/sqlsrv_native_moodle_database.php @@ -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(); diff --git a/lib/xmldb/xmldb_field.php b/lib/xmldb/xmldb_field.php index cec73df60b4..a47f87e6514 100644 --- a/lib/xmldb/xmldb_field.php +++ b/lib/xmldb/xmldb_field.php @@ -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 diff --git a/lib/xmldb/xmldb_index.php b/lib/xmldb/xmldb_index.php index 5763a43440d..8e02412d43c 100644 --- a/lib/xmldb/xmldb_index.php +++ b/lib/xmldb/xmldb_index.php @@ -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 diff --git a/lib/xmldb/xmldb_key.php b/lib/xmldb/xmldb_key.php index 96c6091232f..de02a3f72d9 100644 --- a/lib/xmldb/xmldb_key.php +++ b/lib/xmldb/xmldb_key.php @@ -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 diff --git a/lib/xmldb/xmldb_table.php b/lib/xmldb/xmldb_table.php index 2267a7558c2..66148dfd752 100644 --- a/lib/xmldb/xmldb_table.php +++ b/lib/xmldb/xmldb_table.php @@ -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