X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fgoogle_apps.php;h=66138b84feaced7f3c455d2cca717683a82888ff;hb=0b2c582e3daf62d24b2e61742b37b2530f842926;hp=60b83117f75af5a224df13c9aab1162d903211e8;hpb=fe13bc1d7ba9f72d452ec07baf8538a74b7c67b8;p=platal.git diff --git a/bin/cron/google_apps.php b/bin/cron/google_apps.php index 60b8311..66138b8 100755 --- a/bin/cron/google_apps.php +++ b/bin/cron/google_apps.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q mailstorage->googleapps_domain) { exit; } /* Updates the l_userid parameter for newer user accounts. */ $res = XDB::iterator( - "SELECT g.g_account_name, a.id + "SELECT g.g_account_name, a.uid FROM gapps_accounts AS g LEFT JOIN aliases as a ON (a.alias = g.g_account_name AND a.type = 'a_vie') WHERE (g.l_userid IS NULL OR g.l_userid <= 0) AND a.uid IS NOT NULL"); @@ -41,10 +41,10 @@ while ($account = $res->next()) { "UPDATE gapps_accounts SET l_userid = {?} WHERE g_account_name = {?}", - $account['id'], $account['g_account_name']); + $account['uid'], $account['g_account_name']); } -/* Emits a warning for GApps accounts without local user_id. */ +/* Emits a warning for GApps accounts without local uid. */ $res = XDB::iterator( "SELECT g.g_account_name FROM gapps_accounts AS g @@ -52,13 +52,13 @@ $res = XDB::iterator( WHERE (g.l_userid IS NULL OR g.l_userid <= 0) AND a.uid IS NULL"); while ($account = $res->next()) { if (!preg_match("/^admin-/", $account['g_account_name'])) { - printf("Warning: GApps account '%s' has no local user_id.\n", $account['g_account_name']); + printf("Warning: GApps account '%s' has no local uid.\n", $account['g_account_name']); } } /* Updates the l_userid parameter for newer nicknames. */ $res = XDB::iterator( - "SELECT g.g_account_name, a.id + "SELECT g.g_account_name, a.uid FROM gapps_nicknames AS g LEFT JOIN aliases AS a ON (a.alias = g.g_account_name AND a.type = 'a_vie') WHERE (g.l_userid IS NULL or g.l_userid <= 0) AND a.uid IS NOT NULL @@ -68,10 +68,10 @@ while ($nickname = $res->next()) { "UPDATE gapps_nicknames SET l_userid = {?} WHERE g_account_name = {?}", - $nickname['id'], $nickname['g_account_name']); + $nickname['uid'], $nickname['g_account_name']); } -/* Emits a warning for nicknames without local user_id. */ +/* Emits a warning for nicknames without local uid. */ $res = XDB::iterator( "SELECT g.g_account_name FROM gapps_nicknames AS g @@ -79,7 +79,7 @@ $res = XDB::iterator( WHERE (g.l_userid IS NULL OR g.l_userid <= 0) AND a.uid IS NULL"); while ($nickname = $res->next()) { if (!preg_match("/^admin-/", $nickname['g_account_name'])) { - printf("Warning: Nickname '%s' has no local user_id.\n", $nickname['g_account_name']); + printf("Warning: Nickname '%s' has no local uid.\n", $nickname['g_account_name']); } } @@ -101,7 +101,7 @@ while ($nickname = $res->next()) { "INSERT INTO gapps_queue SET q_recipient_id = {?}, p_entry_date = NOW(), p_notbefore_date = NOW(), p_priority = 'offline', j_type = 'n_create', j_parameters = {?}", - $nickname['id'], + $nickname['uid'], json_encode($nickname)); } } @@ -118,7 +118,7 @@ while ($nickname = $res->next()) { "INSERT INTO gapps_queue SET q_recipient_id = {?}, p_entry_date = NOW(), p_notbefore_date = NOW(), p_priority = 'offline', j_type = 'n_delete', j_parameters = {?}", - $nickname['id'], + $nickname['uid'], json_encode($nickname)); }