4 include_once(
"./Services/Database/classes/class.ilDBUpdate.php");
26 $this->db_prefix = $a_db_prefix;
30 $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");
60 $this->current_file = $updatefile;
61 $this->DB_UPDATE_FILE = $this->
PATH .
72 $this->LAST_UPDATE_FILE = $this->
PATH .
90 return "dbupdate.php";
109 $q =
"SELECT db_version FROM il_plugin " .
110 " WHERE component_type = " . $this->db->quote($this->ctype,
"text") .
111 " AND component_name = " . $this->db->quote($this->cname,
"text") .
112 " AND slot_id = " . $this->db->quote($this->slot_id,
"text") .
113 " AND name = " . $this->db->quote($this->pname,
"text");
114 $set = $this->db->query($q);
115 $rec = $this->db->fetchAssoc($set);
117 $this->currentVersion = (int) $rec[
"db_version"];
127 $q =
"UPDATE il_plugin SET db_version = " . $this->db->quote((
int) $a_version,
"integer") .
128 " WHERE component_type = " . $this->db->quote($this->ctype,
"text") .
129 " AND component_name = " . $this->db->quote($this->cname,
"text") .
130 " AND slot_id = " . $this->db->quote($this->slot_id,
"text") .
131 " AND name = " . $this->db->quote($this->pname,
"text");
132 $this->db->manipulate($q);
133 $this->currentVersion = $a_version;
148 if ((is_int(stripos($q,
"create table")) || is_int(stripos($q,
"alter table")) ||
149 is_int(stripos($q,
"drop table")))
150 && !is_int(stripos($q, $this->db_prefix))) {
151 return "Plugin may only create or alter tables that use prefix " .
__construct( $a_ctype, $a_cname, $a_slot_id, $a_pname, $a_db_handler, $tmp_flag, $a_db_prefix)
constructor
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
setCurrentVersion($a_version)
Set current DB version.
checkQuery($q)
This is a very simple check.
static getDBUpdateScriptName($a_ctype, $a_cname, $a_slot_name, $a_pname)
Get DB update script filename (full path)
getCurrentVersion()
Get current DB version.
getFileForStep($a_version)
Get db update file name for db step.