ILIAS  release_8 Revision v8.24
class.ilCertificateDatabaseUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilDBInterface $db;
24
25 public function prepare(ilDBInterface $db): void
26 {
27 $this->db = $db;
28 }
29
30 public function step_1(): void
31 {
32 if ($this->db->tableExists('il_cert_template') && $this->db->tableColumnExists('il_cert_template', 'certificate_content_bu')) {
33 $this->db->dropTableColumn('il_cert_template', 'certificate_content_bu');
34 }
35 if ($this->db->tableExists('il_cert_user_cert') && $this->db->tableColumnExists('il_cert_user_cert', 'certificate_content_bu')) {
36 $this->db->dropTableColumn('il_cert_user_cert', 'certificate_content_bu');
37 }
38 }
39
40 public function step_2(): void
41 {
42 if ($this->db->tableExists('il_cert_template') && $this->db->tableColumnExists('il_cert_template', 'certificate_content_backup')) {
43 $this->db->dropTableColumn('il_cert_template', 'certificate_content_backup');
44 }
45 if ($this->db->tableExists('il_cert_user_cert') && $this->db->tableColumnExists('il_cert_user_cert', 'certificate_content_backup')) {
46 $this->db->dropTableColumn('il_cert_user_cert', 'certificate_content_backup');
47 }
48 }
49
50 public function step_3(): void
51 {
52 if ($this->db->tableExists('il_cert_bgtask_migr')) {
53 $this->db->dropTable('il_cert_bgtask_migr');
54 }
55 }
56
57 public function step_4(): void
58 {
59 if ($this->db->tableExists('il_cert_user_cert') && $this->db->tableColumnExists('il_cert_user_cert', 'user_id')) {
60 $this->db->renameTableColumn('il_cert_user_cert', 'user_id', 'usr_id');
61 }
62 }
63
64 public function step_5(): void
65 {
66 if (
67 $this->db->tableExists('il_cert_template')
68 && !$this->db->indexExistsByFields('il_cert_template', ['background_image_path', 'currently_active'])
69 ) {
70 $this->db->addIndex('il_cert_template', ['background_image_path', 'currently_active'], 'i5');
71 }
72
73 if (
74 $this->db->tableExists('il_cert_user_cert')
75 && !$this->db->indexExistsByFields('il_cert_user_cert', ['background_image_path', 'currently_active'])
76 ) {
77 $this->db->addIndex('il_cert_user_cert', ['background_image_path', 'currently_active'], 'i7');
78 }
79 }
80}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...