24 include_once(
"./classes/class.ilDBUpdate.php");
38 $a_db_handler, $tmp_flag, $a_db_prefix)
40 $this->db_prefix = $a_db_prefix;
45 $this->db =& $a_db_handler;
59 $this->db = $mySetup->db;
63 $this->ctype = $a_ctype;
64 $this->cname = $a_cname;
65 $this->slot_id = $a_slot_id;
66 $this->pname = $a_pname;
68 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
70 $this->cname, $this->slot_id);
77 $this->current_file = $updatefile;
78 $this->DB_UPDATE_FILE = $this->PATH.
80 $this->slot_name, $this->pname);
85 $this->LAST_UPDATE_FILE = $this->PATH.
87 $this->slot_name, $this->pname);
99 return "dbupdate.php";
118 $q =
"SELECT db_version FROM il_plugin ".
119 " WHERE component_type = ".$this->db->quote($this->ctype).
120 " AND component_name = ".$this->db->quote($this->cname).
121 " AND slot_id = ".$this->db->quote($this->slot_id).
122 " AND name = ".$this->db->quote($this->pname);
123 $set = $this->db->query($q);
126 $this->currentVersion = (int) $rec[
"db_version"];
136 $q =
"UPDATE il_plugin SET db_version = ".$this->db->quote($a_version).
137 " WHERE component_type = ".$this->db->quote($this->ctype).
138 " AND component_name = ".$this->db->quote($this->cname).
139 " AND slot_id = ".$this->db->quote($this->slot_id).
140 " AND name = ".$this->db->quote($this->pname);
141 $this->db->query($q);
142 $this->currentVersion = $a_version;
157 if ((is_int(stripos($q,
"create table")) || is_int(stripos($q,
"alter table")) ||
158 is_int(stripos($q,
"drop table")))
159 && !is_int(stripos($q, $this->db_prefix)))
161 return "Plugin may only create or alter tables that start with prefix ".