19declare(strict_types=1);
27 protected \ilDBInterface
$db;
36 if ($this->db->tableExists(
'reg_dual_opt_in')) {
65 $this->db->createTable(
'reg_dual_opt_in', $fields);
66 $this->db->addPrimaryKey(
'reg_dual_opt_in', [
'id']);
71 if (!$this->db->tableExists(
'usr_data') ||
72 !$this->db->tableColumnExists(
'usr_data',
'reg_hash')) {
76 $res = $this->db->query(
78 SELECT ud.usr_id, ud.reg_hash, ud.create_date
80 INNER JOIN object_data od ON od.obj_id = ud.usr_id
81 WHERE ud.reg_hash IS NOT
NULL AND ud.reg_hash <>
''
86 $this->db->manipulateF(
87 'INSERT INTO reg_dual_opt_in (id, usr_id, reg_hash, creation_date) VALUES (%s, %s, %s, %s)',
95 (
new UUIDFactory())->uuid4(),
98 (
new \DateTimeImmutable($row->create_date,
new \DateTimeZone(
'UTC')))->getTimestamp()
106 if (!$this->db->tableExists(
'usr_data') ||
107 !$this->db->tableColumnExists(
'usr_data',
'reg_hash')) {
111 $this->db->dropTableColumn(
'usr_data',
'reg_hash');
116 if ($this->db->tableExists(
'reg_dual_opt_in') &&
117 !$this->db->indexExistsByFields(
'reg_dual_opt_in', [
'reg_hash'])) {
118 $this->db->addIndex(
'reg_dual_opt_in', [
'reg_hash'],
'i1');
121 if ($this->db->tableExists(
'reg_dual_opt_in') &&
122 !$this->db->indexExistsByFields(
'reg_dual_opt_in', [
'usr_id'])) {
123 $this->db->addIndex(
'reg_dual_opt_in', [
'usr_id'],
'i2');
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...