Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28537

Wrong MySQL syntax causes error while synchronizing LDAP users

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Run Moodle 1.9.12 with MySQL version where 'TYPE' not supported as table_option
      Configure LDAP Authentication
      Run the synchronization script "moodle\auth\ldap\auth_ldap_sync_users.php"

      Show
      Run Moodle 1.9.12 with MySQL version where 'TYPE' not supported as table_option Configure LDAP Authentication Run the synchronization script "moodle\auth\ldap\auth_ldap_sync_users.php"
    • Workaround:
      Hide

      Modify line #566 of script "moodle\auth\ldap\auth.php", because in MySQL 5.5 doesn't support "type" table option, instead it uses ENGINE option.

      From:
      $createtemptablesql = 'CREATE TEMPORARY TABLE ' . $temptable . ' (username VARCHAR(64), PRIMARY KEY (username)) TYPE=MyISAM';

      To:
      $createtemptablesql = 'CREATE TEMPORARY TABLE ' . $temptable . ' (username VARCHAR(64), PRIMARY KEY (username)) ENGINE=MyISAM';

      Show
      Modify line #566 of script "moodle\auth\ldap\auth.php", because in MySQL 5.5 doesn't support "type" table option, instead it uses ENGINE option. From: $createtemptablesql = 'CREATE TEMPORARY TABLE ' . $temptable . ' (username VARCHAR(64), PRIMARY KEY (username)) TYPE=MyISAM'; To: $createtemptablesql = 'CREATE TEMPORARY TABLE ' . $temptable . ' (username VARCHAR(64), PRIMARY KEY (username)) ENGINE=MyISAM';
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      I'm running Moodle 1.9.12+ (Build: 20110701) with MySQL 5.5 and after configuring LDAP Authentication i try to execute the "moodle\auth\ldap\auth_ldap_sync_users.php" script to synchronize my users. But the following error is shown:

      Configuring temp table
      Creating temp table mdl_extuser
      Failed to create temporary users table - aborting

      The problem is in line #566 of script "moodle\auth\ldap\auth.php", because in MySQL 5.5 doesn't support "type" table option, instead it uses ENGINE option. So i changed the code from:
      $createtemptablesql = 'CREATE TEMPORARY TABLE ' . $temptable . ' (username VARCHAR(64), PRIMARY KEY (username)) TYPE=MyISAM';

      To:
      $createtemptablesql = 'CREATE TEMPORARY TABLE ' . $temptable . ' (username VARCHAR(64), PRIMARY KEY (username)) ENGINE=MyISAM';

      But it will probably fail on MySQL older versions.

        Attachments

          Activity

            People

            Assignee:
            samhemelryk Sam Hemelryk
            Reporter:
            leandrorepolho Leandro
            Peer reviewer:
            Aparup Banerjee
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Aparup Banerjee
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Oct/11