Moodle
  1. Moodle
  2. MDL-32071

Fatal errors caused by calls to get_db_family() which should be get_dbfamily()

    Details

    • Testing Instructions:
      Hide

      1/ enable experimental $CFG->forum_usetextsearches = true;
      2/ go to advanced forum search ( no idea where is the link, I edited forum/search.php?id=courseid")
      3/ try to search
      4/ repeat 1-3 with both postgresql and mysql
      4/ no idea how to test the wiki upgrade, sorry

      Show
      1/ enable experimental $CFG->forum_usetextsearches = true; 2/ go to advanced forum search ( no idea where is the link, I edited forum/search.php?id=courseid") 3/ try to search 4/ repeat 1-3 with both postgresql and mysql 4/ no idea how to test the wiki upgrade, sorry
    • Workaround:
      Hide

      Change calls to get_db_family() to be get_dbfamily()

      Show
      Change calls to get_db_family() to be get_dbfamily()
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w12_MDL-32071_m23_dbfamily
    • Rank:
      38765

      Description

      In all version of Moodle 2.x, the following files have occurrences of call to non-existing function get_db_family():

      lib/searchlib.php:362: if ($DB->get_db_family() != 'mysql') {
      lib/searchlib.php:369: if ($DB->get_db_family() == 'mysql') {
      mod/wiki/db/migration/wiki/ewikimoodlelib.php:195: switch ($DB->get_db_family()) {

      Fix is to change it to get_dbfamily(). This problem is the same as was reported in MDL-19620.

        Activity

        Hide
        Petr Škoda added a comment -

        thanks for the report

        Show
        Petr Škoda added a comment - thanks for the report
        Hide
        Petr Škoda added a comment -

        I have fixed the text search SQL trouble at the same, thanks again, ciao.

        Show
        Petr Škoda added a comment - I have fixed the text search SQL trouble at the same, thanks again, ciao.
        Hide
        Sam Hemelryk added a comment -

        Thanks Petr - this has been integrated now

        Show
        Sam Hemelryk added a comment - Thanks Petr - this has been integrated now
        Hide
        Rajesh Taneja added a comment -

        Sorry Guys, it failed because table type doesn't support FULLTEXT indexes. Following error was generated on MOODLE_2.x, mysql. (I hope I was not supposed to manipulate database)

        Debug info: The used table type doesn't support FULLTEXT indexes
        SELECT COUNT(*)
        FROM mdl_forum_posts p,
        mdl_forum_discussions d,
        mdl_user u
        WHERE MATCH (p.message, p.subject) AGAINST (? IN BOOLEAN MODE)
        AND p.discussion = d.id
        AND p.userid = u.id
        AND ((d.forum IN (?,?)))
        
        [array (
        0 => '+hello*',
        1 => 1,
        2 => 4,
        )]
        Stack trace:
        
            line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
            line 809 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
            line 1290 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
            line 1365 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
            line 1536 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
            line 2056 of /mod/forum/lib.php: call to moodle_database->count_records_sql()
            line 145 of /mod/forum/search.php: call to forum_search_posts()
        
        Show
        Rajesh Taneja added a comment - Sorry Guys, it failed because table type doesn't support FULLTEXT indexes. Following error was generated on MOODLE_2.x, mysql. (I hope I was not supposed to manipulate database) Debug info: The used table type doesn't support FULLTEXT indexes SELECT COUNT(*) FROM mdl_forum_posts p, mdl_forum_discussions d, mdl_user u WHERE MATCH (p.message, p.subject) AGAINST (? IN BOOLEAN MODE) AND p.discussion = d.id AND p.userid = u.id AND ((d.forum IN (?,?))) [array ( 0 => '+hello*', 1 => 1, 2 => 4, )] Stack trace: line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown line 809 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 1290 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql() line 1365 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql() line 1536 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql() line 2056 of /mod/forum/lib.php: call to moodle_database->count_records_sql() line 145 of /mod/forum/search.php: call to forum_search_posts()
        Hide
        Petr Škoda added a comment -

        Ahh, please ignore the FULLTEXT problem, it is highly experimental feature that is not supposed to work on all servers, I just fixed obvious fatal errors there. Accidentally I have tested it on mysql with MyISAM, InnoDB does not support FULLTEXT indexes.

        Sorry for the confusion in testing instructions, this should be tested only on PG and legacy MyISAM (which is strongly discouraged now).

        Show
        Petr Škoda added a comment - Ahh, please ignore the FULLTEXT problem, it is highly experimental feature that is not supposed to work on all servers, I just fixed obvious fatal errors there. Accidentally I have tested it on mysql with MyISAM, InnoDB does not support FULLTEXT indexes. Sorry for the confusion in testing instructions, this should be tested only on PG and legacy MyISAM (which is strongly discouraged now).
        Hide
        Rajesh Taneja added a comment -

        Testing on PG...

        Show
        Rajesh Taneja added a comment - Testing on PG...
        Hide
        Rajesh Taneja added a comment -

        Works Great on PG..
        Will request integrator's to reset the status, so I can pass the test.

        Thanks Petr, for all the explanation and hard work

        Show
        Rajesh Taneja added a comment - Works Great on PG.. Will request integrator's to reset the status, so I can pass the test. Thanks Petr, for all the explanation and hard work
        Hide
        Rajesh Taneja added a comment -

        Thanks Dan P, for resetting this

        Passing it as, no error found on postgreSql

        Show
        Rajesh Taneja added a comment - Thanks Dan P, for resetting this Passing it as, no error found on postgreSql
        Hide
        Sam Hemelryk added a comment -

        Congratulations are in order, you've made it, or at least your code has!
        It's now part of Moodle and both the git and cvs repositories have been updated.

        This issue is being marked as fixed and closed.

        Thank you.

        Show
        Sam Hemelryk added a comment - Congratulations are in order, you've made it, or at least your code has! It's now part of Moodle and both the git and cvs repositories have been updated. This issue is being marked as fixed and closed. Thank you.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: