Uploaded image for project: '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

      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.

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          thanks for the report

          Show
          skodak Petr Skoda added a comment - thanks for the report
          Hide
          skodak Petr Skoda added a comment -

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

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

          Thanks Petr - this has been integrated now

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks Petr - this has been integrated now
          Hide
          rajeshtaneja 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
          rajeshtaneja 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
          skodak Petr Skoda 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
          skodak Petr Skoda 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
          rajeshtaneja Rajesh Taneja added a comment -

          Testing on PG...

          Show
          rajeshtaneja Rajesh Taneja added a comment - Testing on PG...
          Hide
          rajeshtaneja 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
          rajeshtaneja 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
          rajeshtaneja Rajesh Taneja added a comment -

          Thanks Dan P, for resetting this

          Passing it as, no error found on postgreSql

          Show
          rajeshtaneja Rajesh Taneja added a comment - Thanks Dan P, for resetting this Passing it as, no error found on postgreSql
          Hide
          samhemelryk 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
          samhemelryk 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:
                Fix Release Date:
                14/May/12