5 include_once
"Services/Cron/classes/class.ilCronJob.php";
16 return "mail_address_sync";
23 $lng->loadLanguageModule(
"mail");
24 return $lng->txt(
"cron_update_addressbook");
31 $lng->loadLanguageModule(
"mail");
32 return $lng->txt(
"cron_update_addressbook_desc");
64 if($ilDB->getDBType() ==
'oracle')
66 $res1 = $ilDB->queryF(
'
67 SELECT addressbook.addr_id,
70 (CASE WHEN epref.value = %s THEN usr_data.email ELSE addressbook.email END) email
72 INNER JOIN usr_data ON usr_data.login = addressbook.login
73 INNER JOIN usr_pref ppref ON ppref.usr_id = usr_data.usr_id AND ppref.keyword = %s AND ppref.value != %s
74 LEFT JOIN usr_pref epref ON epref.usr_id = usr_data.usr_id AND epref.keyword = %s
75 WHERE addressbook.auto_update = %s',
76 array(
'text',
'text',
'text',
'text',
'integer'),
77 array(
'y',
'public_profile',
'n',
'public_email', 1)
80 $stmt = $ilDB->prepare(
'
86 array(
'text',
'text',
'text',
'integer')
89 while(
$row = $ilDB->fetchAssoc($res1))
91 $ilDB->execute($stmt, array(
$row[
'firstname'],
$row[
'lastname'],
$row[
'email'],
$row[
'addr_id']));
98 INNER JOIN usr_data ON usr_data.login = addressbook.login
99 INNER JOIN usr_pref ppref ON ppref.usr_id = usr_data.usr_id AND ppref.keyword = %s AND ppref.value != %s
100 LEFT JOIN usr_pref epref ON epref.usr_id = usr_data.usr_id AND epref.keyword = %s
102 addressbook.firstname = usr_data.firstname,
103 addressbook.lastname = usr_data.lastname,
104 addressbook.email = (CASE WHEN epref.value = %s THEN usr_data.email ELSE addressbook.email END)
105 WHERE addressbook.auto_update = %s',
106 array(
'text',
'text',
'text',
'text',
'integer'),
107 array(
'public_profile',
'n',
'public_email',
'y', 1)
121 $ilSetting->set(
'cron_upd_adrbook', (
bool)$a_currently_active);