Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      32945

      Description

      Code to check that to current db schema matches install.xml.

        Activity

        Hide
        Penny Leach added a comment -

        Hey Andrei,

        Couple things:

        • obviously I can see you have a TODO about localising strings
        • You're checking for fields that exist in the database but not the schema, but not whole tables that exist in the database but not the schema. Perhaps you need to something similar to this:

        unset($dbfields[$fieldname]);
        paired with:
        foreach($dbfields as $fieldname=>$info)

        { $errors[$tablename][] = 'Field ' . $fieldname . ' is unexpected.' }

        but for tables.

        Other than that, it looks good to me.

        Show
        Penny Leach added a comment - Hey Andrei, Couple things: obviously I can see you have a TODO about localising strings You're checking for fields that exist in the database but not the schema, but not whole tables that exist in the database but not the schema. Perhaps you need to something similar to this: unset($dbfields [$fieldname] ); paired with: foreach($dbfields as $fieldname=>$info) { $errors[$tablename][] = 'Field ' . $fieldname . ' is unexpected.' } but for tables. Other than that, it looks good to me.
        Hide
        Andrei Bautu added a comment -

        We have this comment "we ignore other tables from the database since this can be a shared with other applications". People can have other tables in a Moodle database. We don't mind about them, because the will not export/import them.

        Show
        Andrei Bautu added a comment - We have this comment "we ignore other tables from the database since this can be a shared with other applications". People can have other tables in a Moodle database. We don't mind about them, because the will not export/import them.
        Hide
        Penny Leach added a comment -

        Yep, but what about ones that start with mdl_ ?

        Show
        Penny Leach added a comment - Yep, but what about ones that start with mdl_ ?
        Hide
        Petr Škoda added a comment -

        you can safely ignore the mdl_pma_xxx tables used by phpmyadmin
        there is also one table from adodb without prefix that can be safely ignored

        Show
        Petr Škoda added a comment - you can safely ignore the mdl_pma_xxx tables used by phpmyadmin there is also one table from adodb without prefix that can be safely ignored
        Hide
        Andrei Bautu added a comment -

        I would say that if they are not in the install.xml files, then we don't care about them, even if their names start with mdl_. I can change this if you want to.

        Show
        Andrei Bautu added a comment - I would say that if they are not in the install.xml files, then we don't care about them, even if their names start with mdl_. I can change this if you want to.
        Hide
        Petr Škoda added a comment -

        in cvs with minor changes, it is a bit more strict
        thanks!

        Show
        Petr Škoda added a comment - in cvs with minor changes, it is a bit more strict thanks!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: