4include_once(
"./Services/Database/classes/class.ilDBUpdate.php");
 
   26        $this->db_prefix = $a_db_prefix;
 
   30            $this->db = $a_db_handler;
 
   39            $mySetup = 
$DIC[
'mySetup'];
 
   40            $this->db = $mySetup->db;
 
   44        $this->ctype = $a_ctype;
 
   45        $this->cname = $a_cname;
 
   46        $this->slot_id = $a_slot_id;
 
   47        $this->pname = $a_pname;
 
   49        include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
 
   61        $this->current_file = $updatefile;
 
   62        $this->DB_UPDATE_FILE = $this->
PATH .
 
   73        $this->LAST_UPDATE_FILE = $this->
PATH .
 
   91        return "dbupdate.php";
 
  110        $q = 
"SELECT db_version FROM il_plugin " .
 
  111            " WHERE component_type = " . $this->db->quote($this->ctype, 
"text") .
 
  112            " AND component_name = " . $this->db->quote($this->cname, 
"text") .
 
  113            " AND slot_id = " . $this->db->quote($this->slot_id, 
"text") .
 
  114            " AND name = " . $this->db->quote($this->pname, 
"text");
 
  115        $set = $this->db->query($q);
 
  116        $rec = $this->db->fetchAssoc($set);
 
  118        $this->currentVersion = (int) $rec[
"db_version"];
 
  128        $q = 
"UPDATE il_plugin SET db_version = " . $this->db->quote((
int) $a_version, 
"integer") .
 
  129            " WHERE component_type = " . $this->db->quote($this->ctype, 
"text") .
 
  130            " AND component_name = " . $this->db->quote($this->cname, 
"text") .
 
  131            " AND slot_id = " . $this->db->quote($this->slot_id, 
"text") .
 
  132            " AND name = " . $this->db->quote($this->pname, 
"text");
 
  133        $this->db->manipulate($q);
 
  134        $this->currentVersion = $a_version;
 
  149        if ((is_int(stripos($q, 
"create table")) || is_int(stripos($q, 
"alter table")) ||
 
  150            is_int(stripos($q, 
"drop table")))
 
  151            && !is_int(stripos($q, $this->db_prefix))) {
 
  152            return "Plugin may only create or alter tables that use prefix " .
 
An exception for terminatinating execution or to throw for unit testing.
__construct( $a_ctype, $a_cname, $a_slot_id, $a_pname, $a_db_handler, $tmp_flag, $a_db_prefix)
constructor
getCurrentVersion()
Get current DB version.
getFileForStep($a_version)
Get db update file name for db step.
checkQuery($q)
This is a very simple check.
setCurrentVersion($a_version)
Set current DB version.
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
static getDBUpdateScriptName(string $a_ctype, string $a_cname, string $a_slot_name, string $a_pname)