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

          mvidberg Marko Vidberg created issue -
          mvidberg Marko Vidberg made changes -
          Field Original Value New Value
          Priority Minor [ 4 ] Major [ 3 ]
          Workaround Change calls to get_db_family() to be get_dbfamily()
          Difficulty Easy [ 10023 ]
          skodak Petr Skoda made changes -
          Status Open [ 1 ] Development in progress [ 3 ]
          Hide
          skodak Petr Skoda added a comment -

          thanks for the report

          Show
          skodak Petr Skoda added a comment - thanks for the report
          skodak Petr Skoda made changes -
          Fix Version/s STABLE backlog [ 10463 ]
          Labels triaged
          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.
          skodak Petr Skoda made changes -
          Status Development in progress [ 3 ] Waiting for integration review [ 10010 ]
          Pull Master Diff URL https://github.com/skodak/moodle/compare/master...w12_MDL-32071_m23_dbfamily
          Pull Master Branch w12_MDL-32071_m23_dbfamily
          Pull 2.0 Diff URL https://github.com/skodak/moodle/compare/MOODLE_20_STABLE...w12_MDL-32071_m20_dbfamily
          Pull from Repository git://github.com/skodak/moodle.git
          Pull 2.0 Branch w12_MDL-32071_m20_dbfamily
          Fix Version/s 2.0.9 [ 12051 ]
          Fix Version/s 2.1.6 [ 12052 ]
          Fix Version/s 2.2.3 [ 12053 ]
          Fix Version/s 2.3 [ 10657 ]
          Fix Version/s STABLE backlog [ 10463 ]
          Testing Instructions 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
          Pull 2.1 Branch w12_MDL-32071_m21_dbfamily
          Pull 2.2 Diff URL https://github.com/skodak/moodle/compare/MOODLE_22_STABLE...w12_MDL-32071_m22_dbfamily
          Pull 2.1 Diff URL https://github.com/skodak/moodle/compare/MOODLE_21_STABLE...w12_MDL-32071_m21_dbfamily
          Pull 2.2 Branch w12_MDL-32071_m22_dbfamily
          samhemelryk Sam Hemelryk made changes -
          Currently in integration Yes [ 10041 ]
          samhemelryk Sam Hemelryk made changes -
          Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
          Integrator samhemelryk
          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
          samhemelryk Sam Hemelryk made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          Fix Version/s 2.3 [ 10657 ]
          salvetore Michael de Raadt made changes -
          Tester rajeshtaneja
          rajeshtaneja Rajesh Taneja made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          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()
          rajeshtaneja Rajesh Taneja made changes -
          Status Testing in progress [ 10011 ] Problem during testing [ 10007 ]
          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
          poltawski Dan Poltawski made changes -
          Status Problem during testing [ 10007 ] Integration review in progress [ 10004 ]
          poltawski Dan Poltawski made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          rajeshtaneja Rajesh Taneja made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          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
          rajeshtaneja Rajesh Taneja made changes -
          Status Testing in progress [ 10011 ] Tested [ 10006 ]
          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.
          samhemelryk Sam Hemelryk made changes -
          Status Tested [ 10006 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Currently in integration Yes [ 10041 ]
          stronk7 Eloy Lafuente (stronk7) made changes -
          Integration date 23/Mar/12

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/May/12