ILIAS  release_8 Revision v8.23
ilMailDatabaseUpdateSteps Class Reference
+ Inheritance diagram for ilMailDatabaseUpdateSteps:
+ Collaboration diagram for ilMailDatabaseUpdateSteps:

Public Member Functions

 prepare (ilDBInterface $db)
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
 step_4 ()
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 21 of file class.ilMailDatabaseUpdateSteps.php.

Member Function Documentation

◆ prepare()

ilMailDatabaseUpdateSteps::prepare ( ilDBInterface  $db)

Definition at line 25 of file class.ilMailDatabaseUpdateSteps.php.

References $db.

25  : void
26  {
27  $this->db = $db;
28  }

◆ step_1()

ilMailDatabaseUpdateSteps::step_1 ( )

Definition at line 30 of file class.ilMailDatabaseUpdateSteps.php.

30  : void
31  {
32  if ($this->db->tableExists('mail') && $this->db->tableColumnExists('mail', 'm_email')) {
33  $this->db->dropTableColumn('mail', 'm_email');
34  }
35  }

◆ step_2()

ilMailDatabaseUpdateSteps::step_2 ( )

Definition at line 37 of file class.ilMailDatabaseUpdateSteps.php.

37  : void
38  {
39  $result = $this->db->queryF('SELECT value FROM settings WHERE module = %s AND keyword = %s', ['text', 'text'], ['common', 'mail_system_sys_signature']);
40  $row = $this->db->fetchAssoc($result);
41  if (isset($row['value']) && $row['value'] !== '') {
42  $new_value = str_replace(['[CLIENT_NAME]', '[CLIENT_DESC]', '[CLIENT_URL]'], ['[INSTALLATION_NAME]', '[INSTALLATION_DESC]', '[ILIAS_URL]'], $row['value']);
43  if ($new_value !== $row['value']) {
44  $this->db->manipulateF(
45  'UPDATE settings SET value = %s WHERE module = %s AND keyword = %s',
46  ['text', 'text', 'text'],
47  [$new_value, 'common', 'mail_system_sys_signature']
48  );
49  }
50  }
51  }

◆ step_3()

ilMailDatabaseUpdateSteps::step_3 ( )

Definition at line 53 of file class.ilMailDatabaseUpdateSteps.php.

53  : void
54  {
55  $result = $this->db->query("SELECT tpl_id, m_message FROM mail_man_tpl WHERE m_message LIKE '%[CLIENT_NAME]%'");
56  while ($row = $this->db->fetchAssoc($result)) {
57  if (isset($row['m_message'], $row['tpl_id']) && $row['m_message'] !== '' && $row['tpl_id'] !== '') {
58  $new_value = str_replace('[CLIENT_NAME]', '[INSTALLATION_NAME]', $row['m_message']);
59  if ($new_value !== $row['m_message']) {
60  $this->db->manipulateF(
61  'UPDATE mail_man_tpl SET m_message = %s WHERE tpl_id = %s',
62  ['text', 'text'],
63  [$new_value, $row['tpl_id']]
64  );
65  }
66  }
67  }
68  }

◆ step_4()

ilMailDatabaseUpdateSteps::step_4 ( )

Definition at line 70 of file class.ilMailDatabaseUpdateSteps.php.

70  : void
71  {
72  $result = $this->db->query("SELECT lang, type, body FROM mail_template WHERE body LIKE '%[CLIENT_NAME]%'");
73  while ($row = $this->db->fetchAssoc($result)) {
74  if (isset($row['lang'], $row['type'], $row['body']) && $row['body'] !== '') {
75  $new_value = str_replace('[CLIENT_NAME]', '[INSTALLATION_NAME]', $row['body']);
76  if ($new_value !== $row['body']) {
77  $this->db->manipulateF(
78  'UPDATE mail_template SET body = %s WHERE lang = %s AND type = %s',
79  ['text', 'text', 'text'],
80  [$new_value, $row['lang'], $row['type']]
81  );
82  }
83  }
84  }
85  }

Field Documentation

◆ $db

ilDBInterface ilMailDatabaseUpdateSteps::$db
protected

Definition at line 23 of file class.ilMailDatabaseUpdateSteps.php.

Referenced by prepare().


The documentation for this class was generated from the following file: