Forums | Mahara Community

Support /
User sync does not work


Ralph Ballier's profile picture
Posts: 121

11 May 2018, 3:01

Hello,

I tried to create new users from ldap with the following command:

    php sync_users.php --institution = LMS --dryrun

That does not work. Below is the long error message.

it is probably because with a primary key all parts must "not be null", but in its SQL statement "DEFAULT NULL" I have shown the corresponding parts in bold.

--------------------------------------------------------- Begin error message -----------------------------------------------------

[INF] 99 (auth/ldap/lib.php:2090) ---------- started institution user sync for institution "LMS" at Thu, 10 May 2018 16:45:28 +0200 ----------
[INF] 99 (auth/ldap/lib.php:1087) ---------- started usersync for instance 3 at Thu, 10 May 2018 16:45:28 +0200 ----------
[DBG] 99 (lib/dml.php:157) mysqli error: [1171: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead] in EXECUTE("CREATE TEMPORARY TABLE auth_ldap_extusers_temp (
[DBG] 99 (lib/dml.php:157) extusername VARCHAR(64) DEFAULT NULL,
[DBG] 99 (lib/dml.php:157) firstname TEXT,
[DBG] 99 (lib/dml.php:157) lastname TEXT,
[DBG] 99 (lib/dml.php:157) email VARCHAR(255) DEFAULT NULL,
[DBG] 99 (lib/dml.php:157) studentid TEXT,
[DBG] 99 (lib/dml.php:157) preferredname TEXT,
[DBG] 99 (lib/dml.php:157) CONSTRAINT PRIMARY KEY (extusername)
[DBG] 99 (lib/dml.php:157) )ENGINE=innodb")Command was: CREATE TEMPORARY TABLE auth_ldap_extusers_temp (
[DBG] 99 (lib/dml.php:157) extusername VARCHAR(64) DEFAULT NULL,
[DBG] 99 (lib/dml.php:157) firstname TEXT,
[DBG] 99 (lib/dml.php:157) lastname TEXT,
[DBG] 99 (lib/dml.php:157) email VARCHAR(255) DEFAULT NULL,
[DBG] 99 (lib/dml.php:157) studentid TEXT,
[DBG] 99 (lib/dml.php:157) preferredname TEXT,
[DBG] 99 (lib/dml.php:157) CONSTRAINT PRIMARY KEY (extusername)
[DBG] 99 (lib/dml.php:157) )ENGINE=innodb
[WAR] 99 (lib/errors.php:859) Could not execute command: CREATE TEMPORARY TABLE auth_ldap_extusers_temp (
[WAR] 99 (lib/errors.php:859) extusername VARCHAR(64) DEFAULT NULL,
[WAR] 99 (lib/errors.php:859) firstname TEXT,
[WAR] 99 (lib/errors.php:859) lastname TEXT,
[WAR] 99 (lib/errors.php:859) email VARCHAR(255) DEFAULT NULL,
[WAR] 99 (lib/errors.php:859) studentid TEXT,
[WAR] 99 (lib/errors.php:859) preferredname TEXT,
[WAR] 99 (lib/errors.php:859) CONSTRAINT PRIMARY KEY (extusername)
[WAR] 99 (lib/errors.php:859) )ENGINE=innodb
Call stack (most recent first):
* log_message(string(size 290), integer, true, true) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/lib/errors.php:95
* log_warn(string(size 290)) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/lib/errors.php:859
* SQLException->__construct(string(size 290)) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/lib/dml.php:158
* execute_sql(string(size 263)) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/lib/dml.php:1451
* execute_sql_arr(array(size 1), false, true) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/lib/ddl.php:870
* create_temp_table(object(XMLDBTable), false, true) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/auth/ldap/lib.php:1104
* AuthLdap->sync_users(false) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/auth/ldap/lib.php:2128
* auth_ldap_sync_users(string(size 3), null, null, null, null, null, null) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/auth/ldap/cli/sync_users.php:174

[WAR] 99 (auth/ldap/lib.php:1106) Could not create temp table auth_ldap_extusers_temp
Call stack (most recent first):
* log_message(string(size 51), integer, false, true) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/lib/errors.php:95
* log_warn(string(size 51), false) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/auth/ldap/lib.php:1106
* AuthLdap->sync_users(false) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/auth/ldap/lib.php:2128
* auth_ldap_sync_users(string(size 3), null, null, null, null, null, null) at /var/www/vhosts/mahara.osz-lise-meitner.eu/httpdocs/auth/ldap/cli/sync_users.php:174

[INF] 99 (auth/ldap/lib.php:2131) ---------- finished institutino user sync at Thu, 10 May 2018 16:45:28 +0200 ----------
---------- ended at Thu, 10 May 2018 16:45:28 +0200 ----------

Kristina Hoeppner's profile picture
Posts: 4866

11 May 2018, 7:36

Hello Ralph,

Which version of Mahara do you use and what script are you talking about? The Mahara user sync for LDAP is available through the site admin interface when you set up LDAP authentication.

Cheers

Kristina

 

Ralph Ballier's profile picture
Posts: 121

11 May 2018, 8:55

Hello Kristina,

I tried it with the admin interface. There it says that the transfer by cron is made at midnight

Because I did not want to wait so long, I did that was in the info to this point is: I have set the time in the table "auth_cron".

When the time was over, there was no new member and no error message.

Only then, I have, as it is in the info to this point, the specified in my previous post script "auth/ldap/cli/sync_users.php" executed. I use the latest version 18.04.


Greeting
Ralph

3 results