4 include_once(
"./Services/Database/classes/class.ilDBUpdate.php");
18 $a_db_handler, $tmp_flag, $a_db_prefix)
20 $this->db_prefix = $a_db_prefix;
25 $this->db =& $a_db_handler;
39 $this->db = $mySetup->db;
43 $this->ctype = $a_ctype;
44 $this->cname = $a_cname;
45 $this->slot_id = $a_slot_id;
46 $this->pname = $a_pname;
48 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
50 $this->cname, $this->slot_id);
57 $this->current_file = $updatefile;
58 $this->DB_UPDATE_FILE = $this->PATH.
60 $this->slot_name, $this->pname);
65 $this->LAST_UPDATE_FILE = $this->PATH.
67 $this->slot_name, $this->pname);
79 return "dbupdate.php";
98 $q =
"SELECT db_version FROM il_plugin ".
99 " WHERE component_type = ".$this->db->quote($this->ctype,
"text").
100 " AND component_name = ".$this->db->quote($this->cname,
"text").
101 " AND slot_id = ".$this->db->quote($this->slot_id,
"text").
102 " AND name = ".$this->db->quote($this->pname,
"text");
103 $set = $this->db->query($q);
104 $rec = $this->db->fetchAssoc($set);
106 $this->currentVersion = (int) $rec[
"db_version"];
116 $q =
"UPDATE il_plugin SET db_version = ".$this->db->quote((
int) $a_version,
"integer").
117 " WHERE component_type = ".$this->db->quote($this->ctype,
"text").
118 " AND component_name = ".$this->db->quote($this->cname,
"text").
119 " AND slot_id = ".$this->db->quote($this->slot_id,
"text").
120 " AND name = ".$this->db->quote($this->pname,
"text");
121 $this->db->manipulate($q);
122 $this->currentVersion = $a_version;
137 if ((is_int(stripos($q,
"create table")) || is_int(stripos($q,
"alter table")) ||
138 is_int(stripos($q,
"drop table")))
139 && !is_int(stripos($q, $this->db_prefix)))
141 return "Plugin may only create or alter tables that use prefix ".