ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDBUpdate Class Reference

Database Update class. More...

+ Inheritance diagram for ilDBUpdate:
+ Collaboration diagram for ilDBUpdate:

Public Member Functions

 ilDBUpdate ($a_db_handler=0, $tmp_flag=false)
 constructor
 getFileForStep ($a_version)
 Get db update file name for db step.
 initStep ($i)
 Init Step.
 _DBUpdate ()
 destructor
 readDBUpdateFile ()
 readLastUpdateFile ()
 getCurrentVersion ()
 setCurrentVersion ($a_version)
 setRunningStatus ($a_nr)
 Set running status for a step.
 getRunningStatus ()
 Get running status.
 clearRunningStatus ()
 Clear running status.
 readFileVersion ()
 getFileVersion ()
 Get Version of file.
 execQuery ($db, $str)
 execute a query
 checkQuery ($q)
 check query
 applyUpdate ($a_break=0)
 Apply update.
 loadXMLInfo ()
 applyUpdateNr ($nr, $hotfix=false, $custom_update=false)
 apply an update
 getDBVersionStatus ()
 getTables ()
 getTableStatus ($table)
 optimizeTables ($tables)
 getHotfixCurrentVersion ()
 Get current hotfix version.
 setHotfixCurrentVersion ($a_version)
 Set current hotfix version.
 getHotfixFileVersion ()
 Get current hotfix version.
 readHotfixFileVersion ($a_file_content)
 Set current hotfix version.
 readHotfixInfo ($a_force=false)
 Get status of hotfix file.
 hotfixAvailable ()
 Get status of hotfix file.
 applyHotfix ()
 Apply hotfix.
 getCustomUpdatesCurrentVersion ()
 setCustomUpdatesCurrentVersion ($a_version)
 getCustomUpdatesFileVersion ()
 readCustomUpdatesFileVersion ($a_file_content)
 readCustomUpdatesInfo ($a_force=false)
 customUpdatesAvailable ()
 applyCustomUpdates ()
 getUpdateSteps ($a_break=0)
 Get update steps as string (for presentation)
 getHotfixSteps ()
 Get hotfix steps.
 getUpdateStepNr ($nr, $hotfix=false, $custom_update=false)
 Get single update step for presentation.

Data Fields

 $DB_UPDATE_FILE
 db update file
 $currentVersion
 $fileVersion

Detailed Description

Database Update class.

Author
Peter Gabriel pgabr.nosp@m.iel@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilDBUpdate.php 46891 2013-12-17 14:51:19Z fschmid

Definition at line 12 of file class.ilDBUpdate.php.

Member Function Documentation

ilDBUpdate::_DBUpdate ( )

destructor

Returns
boolean

Reimplemented in ilPluginDBUpdate.

Definition at line 111 of file class.ilDBUpdate.php.

{
$this->db->disconnect();
}
ilDBUpdate::applyCustomUpdates ( )

Definition at line 781 of file class.ilDBUpdate.php.

References $GLOBALS, $ilCtrlStructureReader, applyUpdateNr(), getCustomUpdatesCurrentVersion(), getCustomUpdatesFileVersion(), loadXMLInfo(), and readCustomUpdatesInfo().

{
global $ilCtrlStructureReader, $ilMySQLAbstraction;
include_once './Services/Database/classes/class.ilMySQLAbstraction.php';
$ilMySQLAbstraction = new ilMySQLAbstraction();
$GLOBALS['ilMySQLAbstraction'] = $ilMySQLAbstraction;
$this->readCustomUpdatesInfo(true);
if ($c < $f)
{
$msg = array();
for ($i=($c+1); $i<=$f; $i++)
{
// $this->initStep($i); // nothings happens here
$this->filecontent = $this->custom_updates_content;
if ($this->applyUpdateNr($i, false, true) == false)
{
$msg[] = array(
"msg" => "update_error: ".$this->error,
"nr" => $i
);
$this->updateMsg = $msg;
return false;
}
else
{
$msg[] = array(
"msg" => "custom_update_applied",
"nr" => $i
);
}
}
$this->updateMsg = $msg;
}
else
{
$this->updateMsg = "no_changes";
}
return $this->loadXMLInfo();
}

+ Here is the call graph for this function:

ilDBUpdate::applyHotfix ( )

Apply hotfix.

Definition at line 662 of file class.ilDBUpdate.php.

References $GLOBALS, $ilCtrlStructureReader, applyUpdateNr(), getHotfixCurrentVersion(), getHotfixFileVersion(), loadXMLInfo(), and readHotfixInfo().

{
global $ilCtrlStructureReader, $ilMySQLAbstraction;
include_once './Services/Database/classes/class.ilMySQLAbstraction.php';
$ilMySQLAbstraction = new ilMySQLAbstraction();
$GLOBALS['ilMySQLAbstraction'] = $ilMySQLAbstraction;
$this->readHotfixInfo(true);
$f = $this->getHotfixFileVersion();
$c = $this->getHotfixCurrentVersion();
if ($c < $f)
{
$msg = array();
for ($i=($c+1); $i<=$f; $i++)
{
// $this->initStep($i); // nothings happens here
$this->filecontent = $this->hotfix_content;
if ($this->applyUpdateNr($i, true) == false)
{
$msg[] = array(
"msg" => "update_error: ".$this->error,
"nr" => $i
);
$this->updateMsg = $msg;
return false;
}
else
{
$msg[] = array(
"msg" => "hotfix_applied",
"nr" => $i
);
}
}
$this->updateMsg = $msg;
}
else
{
$this->updateMsg = "no_changes";
}
return $this->loadXMLInfo();
}

+ Here is the call graph for this function:

ilDBUpdate::applyUpdate (   $a_break = 0)

Apply update.

Definition at line 285 of file class.ilDBUpdate.php.

References $currentVersion, $fileVersion, $GLOBALS, $ilCtrlStructureReader, applyUpdateNr(), getFileForStep(), initStep(), loadXMLInfo(), and readDBUpdateFile().

{
global $ilCtrlStructureReader, $ilMySQLAbstraction;
include_once './Services/Database/classes/class.ilMySQLAbstraction.php';
$ilMySQLAbstraction = new ilMySQLAbstraction();
$GLOBALS['ilMySQLAbstraction'] = $ilMySQLAbstraction;
if ($a_break > $this->currentVersion &&
$a_break < $this->fileVersion)
{
$f = $a_break;
}
if ($c < $f)
{
$msg = array();
for ($i=($c+1); $i<=$f; $i++)
{
// check wether next update file must be loaded
if ($this->current_file != $this->getFileForStep($i))
{
$this->DB_UPDATE_FILE = $this->PATH."setup/sql/".$this->getFileForStep($i);
$this->readDBUpdateFile();
}
$this->initStep($i);
if ($this->applyUpdateNr($i) == false)
{
$msg[] = array(
"msg" => "update_error: ".$this->error,
"nr" => $i
);
$this->updateMsg = $msg;
return false;
}
else
{
$msg[] = array(
"msg" => "update_applied",
"nr" => $i
);
}
}
$this->updateMsg = $msg;
}
else
{
$this->updateMsg = "no_changes";
}
if ($f < $this->fileVersion)
{
return true;
}
else
{
return $this->loadXMLInfo();
}
}

+ Here is the call graph for this function:

ilDBUpdate::applyUpdateNr (   $nr,
  $hotfix = false,
  $custom_update = false 
)

apply an update

Parameters
intnr number what patch to apply
Returns
bool private

Definition at line 397 of file class.ilDBUpdate.php.

References $ilCtrlStructureReader, $ilErr, $ilUser, $row, clearRunningStatus(), execQuery(), setCurrentVersion(), setCustomUpdatesCurrentVersion(), setHotfixCurrentVersion(), and setRunningStatus().

Referenced by applyCustomUpdates(), applyHotfix(), and applyUpdate().

{
global $ilDB,$ilErr,$ilUser,$ilCtrlStructureReader,$ilModuleReader,$ilMySQLAbstraction;
//search for desired $nr
reset($this->filecontent);
if (!$hotfix)
{
$this->setRunningStatus($nr);
}
//init
$i = 0;
//go through filecontent
while (!ereg("^<#".$nr.">", $this->filecontent[$i]) && $i<count($this->filecontent))
{
$i++;
}
//update not found
if ($i == count($this->filecontent))
{
$this->error = "update_not_found";
return false;
}
$i++;
//update found, now extract this update to a new array
$update = array();
while ($i<count($this->filecontent) && !ereg("^<#".($nr+1).">", $this->filecontent[$i]))
{
$update[] = trim($this->filecontent[$i]);
$i++;
}
//now you have the update, now process it
$sql = array();
$php = array();
$mode = "sql";
foreach ($update as $row)
{
if (ereg("<\?php", $row))
{
if (count($sql)>0)
{
if ($this->execQuery($this->db, implode("\n", $sql)) == false)
{
$this->error = $this->error;
return false;
}
$sql = array();
}
$mode = "php";
}
elseif (ereg("\?>", $row))
{
if (count($php)>0)
{
$code = implode("\n", $php);
if (eval($code) === false)
{
$this->error = "Parse error: ".$code;
return false;
}
$php = array();
}
$mode = "sql";
}
else
{
if ($mode == "sql")
{
$sql[] = $row;
}
if ($mode == "php")
{
$php[] = $row;
}
} //else
} //foreach
if ($mode == "sql" && count($sql) > 0)
{
if ($this->execQuery($this->db, implode("\n", $sql)) == false)
{
$this->error = "dump_error: ".$this->error;
return false;
}
}
//increase db_Version number
if (!$hotfix && !$custom_update)
{
$this->setCurrentVersion($nr);
}
elseif($hotfix)
{
}
elseif($custom_update)
{
}
if (!$hotfix && !$custom_update)
{
}
//$this->currentVersion = $ilias->getSetting("db_version");
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::checkQuery (   $q)

check query

Reimplemented in ilPluginDBUpdate.

Definition at line 277 of file class.ilDBUpdate.php.

Referenced by execQuery().

{
return true;
}

+ Here is the caller graph for this function:

ilDBUpdate::clearRunningStatus ( )

Clear running status.

Definition at line 191 of file class.ilDBUpdate.php.

Referenced by applyUpdateNr().

{
include_once './Services/Administration/classes/class.ilSetting.php';
$set = new ilSetting("common", true);
$set->set("db_update_running", 0);
$this->db_update_running = 0;
}

+ Here is the caller graph for this function:

ilDBUpdate::customUpdatesAvailable ( )

Definition at line 768 of file class.ilDBUpdate.php.

References readCustomUpdatesInfo().

{
// trunk does not support custom updates
return false;
if ($this->custom_updates_file_version > $this->custom_updates_current_version)
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilDBUpdate::execQuery (   $db,
  $str 
)

execute a query

Parameters
objectDB
stringquery
Returns
boolean

Definition at line 230 of file class.ilDBUpdate.php.

References checkQuery(), and MDB2\isError().

Referenced by applyUpdateNr().

{
$sql = explode("\n",trim($str));
for ($i=0; $i<count($sql); $i++)
{
$sql[$i] = trim($sql[$i]);
if ($sql[$i] != "" && substr($sql[$i],0,1)!="#")
{
//take line per line, until last char is ";"
if (substr($sql[$i],-1)==";")
{
//query is complete
$q .= " ".substr($sql[$i],0,-1);
$check = $this->checkQuery($q);
if ($check === true)
{
$r = $db->query($q);
if (MDB2::isError($r))
{
$this->error = $r->getMessage();
return false;
}
}
else
{
$this->error = $check;
return false;
}
unset($q);
} //if
else
{
$q .= " ".$sql[$i];
} //else
} //if
} //for
if ($q != "")
{
echo "incomplete_statement: ".$q."<br>";
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::getCurrentVersion ( )

Reimplemented in ilPluginDBUpdate.

Definition at line 142 of file class.ilDBUpdate.php.

References $currentVersion, and $GLOBALS.

Referenced by ilDBUpdate().

{
$GLOBALS["ilDB"] = $this->db;
include_once './Services/Administration/classes/class.ilSetting.php';
$set = new ilSetting("common", true);
$this->currentVersion = (integer) $set->get("db_version");
}

+ Here is the caller graph for this function:

ilDBUpdate::getCustomUpdatesCurrentVersion ( )

Definition at line 713 of file class.ilDBUpdate.php.

References readCustomUpdatesInfo().

Referenced by applyCustomUpdates().

{
return $this->custom_updates_current_version;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::getCustomUpdatesFileVersion ( )

Definition at line 727 of file class.ilDBUpdate.php.

References readCustomUpdatesInfo().

Referenced by applyCustomUpdates().

{
return $this->custom_updates_file_version;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::getDBVersionStatus ( )

Definition at line 517 of file class.ilDBUpdate.php.

{
if ($this->fileVersion > $this->currentVersion)
return false;
else
return true;
}
ilDBUpdate::getFileForStep (   $a_version)

Get db update file name for db step.

Reimplemented in ilPluginDBUpdate.

Definition at line 79 of file class.ilDBUpdate.php.

Referenced by applyUpdate(), getUpdateSteps(), and ilDBUpdate().

{
//
// NOTE: IF YOU ADD A NEW FILE HERE, CHANGE ALSO THE CONSTRUCTOR
//
if ((int)$a_version > 2948) // last number in previous file
{
return "dbupdate_03.php";
}
else if ((int)$a_version > 864) // last number in previous file
{
return "dbupdate_02.php";
}
else
{
return "dbupdate.php";
}
}

+ Here is the caller graph for this function:

ilDBUpdate::getFileVersion ( )

Get Version of file.

Definition at line 219 of file class.ilDBUpdate.php.

References $fileVersion.

{
}
ilDBUpdate::getHotfixCurrentVersion ( )

Get current hotfix version.

Definition at line 573 of file class.ilDBUpdate.php.

References readHotfixInfo().

Referenced by applyHotfix(), and getHotfixSteps().

{
$this->readHotfixInfo();
return $this->hotfix_current_version;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::getHotfixFileVersion ( )

Get current hotfix version.

Definition at line 594 of file class.ilDBUpdate.php.

References readHotfixInfo().

Referenced by applyHotfix(), and getHotfixSteps().

{
$this->readHotfixInfo();
return $this->hotfix_file_version;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::getHotfixSteps ( )

Get hotfix steps.

Returns
string steps from the update file

Definition at line 876 of file class.ilDBUpdate.php.

References getHotfixCurrentVersion(), getHotfixFileVersion(), getUpdateStepNr(), and readHotfixInfo().

{
$this->readHotfixInfo(true);
$str = "";
$f = $this->getHotfixFileVersion();
$c = $this->getHotfixCurrentVersion();
if ($c < $f)
{
$msg = array();
for ($i=($c+1); $i<=$f; $i++)
{
$this->filecontent = $this->hotfix_content;
$str.= $this->getUpdateStepNr($i, true);
}
}
return $str;
}

+ Here is the call graph for this function:

ilDBUpdate::getRunningStatus ( )

Get running status.

Returns
int current runnning db step

Definition at line 179 of file class.ilDBUpdate.php.

{
include_once './Services/Administration/classes/class.ilSetting.php';
$set = new ilSetting("common", true);
$this->db_update_running = (integer) $set->get("db_update_running");
return $this->db_update_running;
}
ilDBUpdate::getTables ( )

Definition at line 525 of file class.ilDBUpdate.php.

References $query, $res, $row, and getTableStatus().

{
$a = array();
$query = "SHOW TABLES";
$res = $this->db->query($query);
while ($row = $res->fetchRow())
{
$status = $this->getTableStatus($row[0]);
$a[] = array(
"name" => $status["Table"],
"table" => $row[0],
"status" => $status["Msg_text"]
);
}
return $a;
}

+ Here is the call graph for this function:

ilDBUpdate::getTableStatus (   $table)

Definition at line 543 of file class.ilDBUpdate.php.

References $query, $res, $row, and DB_FETCHMODE_ASSOC.

Referenced by getTables().

{
$a = array();
$query = "ANALYZE TABLE ".$table;
$res = $this->db->query($query);
return $row;
}

+ Here is the caller graph for this function:

ilDBUpdate::getUpdateStepNr (   $nr,
  $hotfix = false,
  $custom_update = false 
)

Get single update step for presentation.

Definition at line 903 of file class.ilDBUpdate.php.

References $ilCtrlStructureReader, $ilErr, and $ilUser.

Referenced by getHotfixSteps(), and getUpdateSteps().

{
global $ilDB,$ilErr,$ilUser,$ilCtrlStructureReader,$ilModuleReader,$ilMySQLAbstraction;
$str = "";
//search for desired $nr
reset($this->filecontent);
//init
$i = 0;
//go through filecontent
while (!ereg("^<#".$nr.">", $this->filecontent[$i]) && $i<count($this->filecontent))
{
$i++;
}
//update not found
if ($i == count($this->filecontent))
{
return false;
}
$i++;
//update found, now extract this update to a new array
$update = array();
while ($i<count($this->filecontent) && !ereg("^<#".($nr+1).">", $this->filecontent[$i]))
{
$str.= $this->filecontent[$i];
$i++;
}
return "<pre><b><#".$nr."></b>\n".htmlentities($str)."</pre>";
}

+ Here is the caller graph for this function:

ilDBUpdate::getUpdateSteps (   $a_break = 0)

Get update steps as string (for presentation)

Returns
string steps from the update file

Definition at line 837 of file class.ilDBUpdate.php.

References $currentVersion, $fileVersion, $ilCtrlStructureReader, getFileForStep(), getUpdateStepNr(), and readDBUpdateFile().

{
global $ilCtrlStructureReader, $ilMySQLAbstraction;
$str = "";
if ($a_break > $this->currentVersion &&
$a_break < $this->fileVersion)
{
$f = $a_break;
}
if ($c < $f)
{
$msg = array();
for ($i=($c+1); $i<=$f; $i++)
{
// check wether next update file must be loaded
if ($this->current_file != $this->getFileForStep($i))
{
$this->DB_UPDATE_FILE = $this->PATH."setup/sql/".$this->getFileForStep($i);
$this->readDBUpdateFile();
}
$str.= $this->getUpdateStepNr($i);
}
}
return $str;
}

+ Here is the call graph for this function:

ilDBUpdate::hotfixAvailable ( )

Get status of hotfix file.

Definition at line 649 of file class.ilDBUpdate.php.

References readHotfixInfo().

{
$this->readHotfixInfo();
if ($this->hotfix_file_version > $this->hotfix_current_version)
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilDBUpdate::ilDBUpdate (   $a_db_handler = 0,
  $tmp_flag = false 
)

constructor

Definition at line 34 of file class.ilDBUpdate.php.

References getCurrentVersion(), getFileForStep(), readDBUpdateFile(), readFileVersion(), and readLastUpdateFile().

{
// workaround to allow setup migration
if ($a_db_handler)
{
$this->db =& $a_db_handler;
if ($tmp_flag)
{
$this->PATH = "./";
}
else
{
$this->PATH = "./";
//$this->PATH = "../";
}
}
else
{
global $mySetup;
$this->db = $mySetup->db;
$this->PATH = "./";
}
// get update file for current version
$updatefile = $this->getFileForStep($this->currentVersion + 1);
$this->current_file = $updatefile;
$this->DB_UPDATE_FILE = $this->PATH."setup/sql/".$updatefile;
//
// NOTE: IF YOU SET THIS TO THE NEWEST FILE, CHANGE ALSO getFileForStep()
//
$this->LAST_UPDATE_FILE = $this->PATH."setup/sql/dbupdate_03.php";
$this->readDBUpdateFile();
$this->readFileVersion();
}

+ Here is the call graph for this function:

ilDBUpdate::initStep (   $i)

Init Step.

Definition at line 101 of file class.ilDBUpdate.php.

Referenced by applyUpdate().

{
//
}

+ Here is the caller graph for this function:

ilDBUpdate::loadXMLInfo ( )

Reimplemented in ilPluginDBUpdate.

Definition at line 352 of file class.ilDBUpdate.php.

References $ilCtrlStructureReader, ilModule\getAvailableCoreModules(), ilService\getAvailableCoreServices(), and ILIAS_ABSOLUTE_PATH.

Referenced by applyCustomUpdates(), applyHotfix(), and applyUpdate().

{
// read module and service information into db
require_once "./setup/classes/class.ilModuleReader.php";
require_once "./setup/classes/class.ilServiceReader.php";
require_once "./setup/classes/class.ilCtrlStructureReader.php";
require_once "./Services/Component/classes/class.ilModule.php";
require_once "./Services/Component/classes/class.ilService.php";
$mr = new ilModuleReader("", "", "");
$mr->clearTables();
foreach($modules as $module)
{
$mr = new ilModuleReader(ILIAS_ABSOLUTE_PATH."/Modules/".$module["subdir"]."/module.xml",
$module["subdir"], "Modules");
$mr->getModules();
unset($mr);
}
$sr = new ilServiceReader("", "", "");
$sr->clearTables();
foreach($services as $service)
{
$sr = new ilServiceReader(ILIAS_ABSOLUTE_PATH."/Services/".$service["subdir"]."/service.xml",
$service["subdir"], "Services");
$sr->getServices();
unset($sr);
}
$ilCtrlStructureReader->readStructure();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::optimizeTables (   $tables)

Definition at line 553 of file class.ilDBUpdate.php.

References $_POST, $query, and $res.

{
$msg = array();
foreach ($_POST["tables"] as $key => $value)
{
$query = "OPTIMIZE TABLE ".$key;
$res = $this->db->query($query);
$msg[] = "table $key: ok";
}
return $msg;
}
ilDBUpdate::readCustomUpdatesFileVersion (   $a_file_content)

Definition at line 733 of file class.ilDBUpdate.php.

References $row.

Referenced by readCustomUpdatesInfo().

{
//go through filecontent and search for last occurence of <#x>
reset($a_file_content);
$regs = array();
foreach ($a_file_content as $row)
{
if (ereg("^<#([0-9]+)>", $row, $regs))
{
$version = $regs[1];
}
}
return (integer) $version;
}

+ Here is the caller graph for this function:

ilDBUpdate::readCustomUpdatesInfo (   $a_force = false)

Definition at line 749 of file class.ilDBUpdate.php.

References $GLOBALS, and readCustomUpdatesFileVersion().

Referenced by applyCustomUpdates(), customUpdatesAvailable(), getCustomUpdatesCurrentVersion(), getCustomUpdatesFileVersion(), and setCustomUpdatesCurrentVersion().

{
if ($this->custom_updates_info_read && !$a_force)
{
return;
}
include_once './Services/Administration/classes/class.ilSetting.php';
$GLOBALS["ilDB"] = $this->db;
$this->custom_updates_setting = new ilSetting();
$custom_updates_file = $this->PATH."setup/sql/dbupdate_custom.php";
if (is_file($custom_updates_file))
{
$this->custom_updates_content = @file($custom_updates_file);
$this->custom_updates_current_version = (int) $this->custom_updates_setting->get('db_version_custom', 0);
$this->custom_updates_file_version = $this->readCustomUpdatesFileVersion($this->custom_updates_content);
}
$this->custom_updates_info_read = true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::readDBUpdateFile ( )

Definition at line 116 of file class.ilDBUpdate.php.

Referenced by applyUpdate(), getUpdateSteps(), ilDBUpdate(), and ilPluginDBUpdate\ilPluginDBUpdate().

{
if (!file_exists($this->DB_UPDATE_FILE))
{
$this->error = "no_db_update_file";
$this->filecontent = array();
return false;
}
$this->filecontent = @file($this->DB_UPDATE_FILE);
return true;
}

+ Here is the caller graph for this function:

ilDBUpdate::readFileVersion ( )

Definition at line 199 of file class.ilDBUpdate.php.

References $fileVersion, and $row.

Referenced by ilDBUpdate(), and ilPluginDBUpdate\ilPluginDBUpdate().

{
//go through filecontent and search for last occurence of <#x>
reset($this->lastfilecontent);
$regs = array();
foreach ($this->lastfilecontent as $row)
{
if (ereg("^<#([0-9]+)>", $row, $regs))
{
$version = $regs[1];
}
}
$this->fileVersion = (integer) $version;
}

+ Here is the caller graph for this function:

ilDBUpdate::readHotfixFileVersion (   $a_file_content)

Set current hotfix version.

Definition at line 603 of file class.ilDBUpdate.php.

References $row.

Referenced by readHotfixInfo().

{
//go through filecontent and search for last occurence of <#x>
reset($a_file_content);
$regs = array();
foreach ($a_file_content as $row)
{
if (ereg("^<#([0-9]+)>", $row, $regs))
{
$version = $regs[1];
}
}
return (integer) $version;
}

+ Here is the caller graph for this function:

ilDBUpdate::readHotfixInfo (   $a_force = false)

Get status of hotfix file.

Definition at line 622 of file class.ilDBUpdate.php.

References $GLOBALS, ILIAS_VERSION_NUMERIC, and readHotfixFileVersion().

Referenced by applyHotfix(), getHotfixCurrentVersion(), getHotfixFileVersion(), getHotfixSteps(), hotfixAvailable(), and setHotfixCurrentVersion().

{
if ($this->hotfix_info_read && !$a_force)
{
return;
}
include_once './Services/Administration/classes/class.ilSetting.php';
$GLOBALS["ilDB"] = $this->db;
$this->hotfix_setting = new ilSetting("common", true);
$ilias_version = ILIAS_VERSION_NUMERIC;
$version_array = explode(".", $ilias_version);
$this->hotfix_version[0] = $version_array[0];
$this->hotfix_version[1] = $version_array[1];
$hotfix_file = $this->PATH."setup/sql/".$this->hotfix_version[0]."_".$this->hotfix_version[1]."_hotfixes.php";
if (is_file($hotfix_file))
{
$this->hotfix_content = @file($hotfix_file);
$this->hotfix_current_version = (int) $this->hotfix_setting->get("db_hotfixes_".
$this->hotfix_version[0]."_".$this->hotfix_version[1]);
$this->hotfix_file_version = $this->readHotfixFileVersion($this->hotfix_content);
}
$this->hotfix_info_read = true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::readLastUpdateFile ( )

Definition at line 129 of file class.ilDBUpdate.php.

Referenced by ilDBUpdate(), and ilPluginDBUpdate\ilPluginDBUpdate().

{
if (!file_exists($this->LAST_UPDATE_FILE))
{
$this->error = "no_last_update_file";
$this->lastfilecontent = array();
return false;
}
$this->lastfilecontent = @file($this->LAST_UPDATE_FILE);
return true;
}

+ Here is the caller graph for this function:

ilDBUpdate::setCurrentVersion (   $a_version)

Reimplemented in ilPluginDBUpdate.

Definition at line 151 of file class.ilDBUpdate.php.

Referenced by applyUpdateNr().

{
include_once './Services/Administration/classes/class.ilSetting.php';
$set = new ilSetting("common", true);
$set->set("db_version", $a_version);
$this->currentVersion = $a_version;
return true;
}

+ Here is the caller graph for this function:

ilDBUpdate::setCustomUpdatesCurrentVersion (   $a_version)

Definition at line 719 of file class.ilDBUpdate.php.

References readCustomUpdatesInfo().

Referenced by applyUpdateNr().

{
$this->custom_updates_setting->set('db_version_custom', $a_version);
$this->custom_updates_current_version = $a_version;
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::setHotfixCurrentVersion (   $a_version)

Set current hotfix version.

Definition at line 582 of file class.ilDBUpdate.php.

References readHotfixInfo().

Referenced by applyUpdateNr().

{
$this->readHotfixInfo();
$this->hotfix_setting->set("db_hotfixes_".
$this->hotfix_version[0]."_".$this->hotfix_version[1], $a_version);
$this->hotfix_current_version = $a_version;
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdate::setRunningStatus (   $a_nr)

Set running status for a step.

Parameters
intstep number

Definition at line 166 of file class.ilDBUpdate.php.

Referenced by applyUpdateNr().

{
include_once './Services/Administration/classes/class.ilSetting.php';
$set = new ilSetting("common", true);
$set->set("db_update_running", $a_nr);
$this->db_update_running = $a_nr;
}

+ Here is the caller graph for this function:

Field Documentation

ilDBUpdate::$currentVersion
ilDBUpdate::$DB_UPDATE_FILE

db update file

Definition at line 17 of file class.ilDBUpdate.php.

ilDBUpdate::$fileVersion

Definition at line 29 of file class.ilDBUpdate.php.

Referenced by applyUpdate(), getFileVersion(), getUpdateSteps(), and readFileVersion().


The documentation for this class was generated from the following file: