Moodle
  1. Moodle
  2. MDL-31819

Install fails if plugins create admin users

    Details

    • Database:
      Any
    • Testing Instructions:
      Hide

      Fricken hard to test this one entirely.
      Best bet test that you can still install a new site.
      If you are really feelin' leet you could write a hack to add several admin users during installation (as early on as possible) and make sure things still function correctly.

      Show
      Fricken hard to test this one entirely. Best bet test that you can still install a new site. If you are really feelin' leet you could write a hack to add several admin users during installation (as early on as possible) and make sure things still function correctly.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Rank:
      38451

      Description

      If you add a local plugin that adds two admin users, the install fails with 'error reading from database' when redirecting to admin user edit page.

      Stack trace looks like this:

      2012-02-29 14:39:52: (mod_fastcgi.c.2699) FastCGI-stderr: Default exception handler: Error reading from database Debug: ERROR:  invalid input syntax for integer: "2,3"
      SELECT * FROM mdl_user WHERE id = $1 AND deleted <> 1
      [array (
        0 => '2,3',
      )]
      * line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
      * line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      * line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      * line 1297 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
      * line 1269 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      * line 4125 of /lib/moodlelib.php: call to moodle_database->get_record_select()
      * line 301 of /admin/index.php: call to get_complete_user_data()
      

      This occurs because it is assumed that there is only one admin at this stage and can be fixed with a small patch (github incoming).

      Applying this change will allow custom plugins to add admin users on install, which can be useful for any partners automating installation processes.

        Activity

        Show
        Tony Levi added a comment - https://github.com/tlevi/moodle/tree/mdl31819
        Hide
        Michael de Raadt added a comment -

        Thanks for reporting that and providing a potential solution.

        It might be worth noting in this report what plugin was doing this and the reasons why.

        Show
        Michael de Raadt added a comment - Thanks for reporting that and providing a potential solution. It might be worth noting in this report what plugin was doing this and the reasons why.
        Hide
        Tony Levi added a comment -

        It was a custom local plugin I was looking at using to automate our installs.

        While there isn't any need within core for this change, it does trivially enable what seems like useful functionality, and the current code is incorrect in its assumption.

        Show
        Tony Levi added a comment - It was a custom local plugin I was looking at using to automate our installs. While there isn't any need within core for this change, it does trivially enable what seems like useful functionality, and the current code is incorrect in its assumption.
        Hide
        Petr Škoda added a comment -

        makes sense, submitting for integration, thanks

        Show
        Petr Škoda added a comment - makes sense, submitting for integration, thanks
        Hide
        Eloy Lafuente (stronk7) added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Petr Škoda added a comment -

        resubmitting for integration, rebase is not necessary, thanks

        Show
        Petr Škoda added a comment - resubmitting for integration, rebase is not necessary, thanks
        Hide
        Sam Hemelryk added a comment -

        Thanks all, this has been integrated now!

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

        Installed 21, 22 and master without any problem.
        Thanks for working on this, Tony and Petr.

        Show
        Rajesh Taneja added a comment - Installed 21, 22 and master without any problem. Thanks for working on this, Tony and Petr.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!).

        icao_reverse('arreis olik rebemevon afla letoh ognat');
        

        Closing, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!). icao_reverse('arreis olik rebemevon afla letoh ognat'); Closing, ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: