ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDBUpdateEA Class Reference

Database Update class. More...

+ Inheritance diagram for ilDBUpdateEA:
+ Collaboration diagram for ilDBUpdateEA:

Public Member Functions

 hotfixAvailable ()
 Get status of hotfix file.
 getHotfixCurrentVersionEA ()
 Get current hotfix version.
 setHotfixCurrentVersionEA ($a_version)
 Set current hotfix version.
 getHotfixFileVersionEA ()
 Get current hotfix version.
 readHotfixInfoEA ($a_force=false)
 Get status of hotfix file.
 applyUpdateEANr ($nr)
 apply an update
 getHotfixCurrentVersionAsString ()
 getHotfixFileVersionAsString ()
 applyHotfix ()
 Apply hotfix.
- Public Member Functions inherited from ilDBUpdate
 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)
 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.

Private Attributes

 $hotfix_file_version_ea = 0
 $hotfix_current_version_ea = 0

Additional Inherited Members

- Data Fields inherited from ilDBUpdate
 $DB_UPDATE_FILE
 db update file
 $currentVersion
 $fileVersion

Detailed Description

Database Update class.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

Definition at line 13 of file class.ilDBUpdateEA.php.

Member Function Documentation

ilDBUpdateEA::applyHotfix ( )

Apply hotfix.

Reimplemented from ilDBUpdate.

Definition at line 210 of file class.ilDBUpdateEA.php.

References $f, $GLOBALS, $ilCtrlStructureReader, applyUpdateEANr(), getHotfixCurrentVersionEA(), getHotfixFileVersionEA(), ilDBUpdate\loadXMLInfo(), and readHotfixInfoEA().

{
global $ilCtrlStructureReader, $ilMySQLAbstraction;
include_once './Services/Database/classes/class.ilMySQLAbstraction.php';
$ilMySQLAbstraction = new ilMySQLAbstraction();
$GLOBALS['ilMySQLAbstraction'] = $ilMySQLAbstraction;
$this->readHotfixInfoEA(true);
if ($c < $f)
{
$msg = array();
for ($i=($c+1); $i<=$f; $i++)
{
$this->filecontent = $this->hotfix_content_ea;
if ($this->applyUpdateEANr($i) == 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:

ilDBUpdateEA::applyUpdateEANr (   $nr)

apply an update

Parameters
intnr number what patch to apply
Returns
bool private

Definition at line 90 of file class.ilDBUpdateEA.php.

References $error, $ilCtrlStructureReader, $ilDB, $ilErr, $row, ilDBUpdate\execQuery(), and setHotfixCurrentVersionEA().

Referenced by applyHotfix().

{
global $ilDB,$ilErr,$ilUser,$ilCtrlStructureReader,$ilModuleReader,$ilMySQLAbstraction;
//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))
{
$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);
eval($code);
$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;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdateEA::getHotfixCurrentVersionAsString ( )

Definition at line 183 of file class.ilDBUpdateEA.php.

References ilDBUpdate\getHotfixCurrentVersion(), and getHotfixCurrentVersionEA().

{
if ($this->getHotfixCurrentVersion() > 0 || $this->getHotfixCurrentVersionEA() > 0)
{
return sprintf("ILIAS: %d / EA: %d", $this->getHotfixCurrentVersion(), $this->getHotfixCurrentVersionEA());
}
else
{
return "";
}
}

+ Here is the call graph for this function:

ilDBUpdateEA::getHotfixCurrentVersionEA ( )

Get current hotfix version.

Definition at line 36 of file class.ilDBUpdateEA.php.

References $hotfix_current_version_ea, and readHotfixInfoEA().

Referenced by applyHotfix(), and getHotfixCurrentVersionAsString().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdateEA::getHotfixFileVersionAsString ( )

Definition at line 195 of file class.ilDBUpdateEA.php.

References ilDBUpdate\getHotfixFileVersion(), and getHotfixFileVersionEA().

{
if ($this->getHotfixFileVersion() > 0 || $this->getHotfixFileVersionEA() > 0)
{
return sprintf("ILIAS: %d / EA: %d", $this->getHotfixFileVersion(), $this->getHotfixFileVersionEA());
}
else
{
return "";
}
}

+ Here is the call graph for this function:

ilDBUpdateEA::getHotfixFileVersionEA ( )

Get current hotfix version.

Definition at line 56 of file class.ilDBUpdateEA.php.

References $hotfix_file_version_ea, and readHotfixInfoEA().

Referenced by applyHotfix(), and getHotfixFileVersionAsString().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdateEA::hotfixAvailable ( )

Get status of hotfix file.

Reimplemented from ilDBUpdate.

Definition at line 21 of file class.ilDBUpdateEA.php.

References readHotfixInfoEA().

{
$hotfixavailable = parent::hotfixAvailable();
$this->readHotfixInfoEA();
if ($hotfixavailable || $this->hotfix_file_version_ea > $this->hotfix_current_version_ea)
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilDBUpdateEA::readHotfixInfoEA (   $a_force = false)

Get status of hotfix file.

Definition at line 65 of file class.ilDBUpdateEA.php.

References $GLOBALS, and ilDBUpdate\readHotfixFileVersion().

Referenced by applyHotfix(), getHotfixCurrentVersionEA(), getHotfixFileVersionEA(), hotfixAvailable(), and setHotfixCurrentVersionEA().

{
if ($this->hotfix_info_read_ea && !$a_force)
{
return;
}
include_once './Services/Administration/classes/class.ilSetting.php';
$GLOBALS["ilDB"] = $this->db;
$this->hotfix_setting_ea = new ilSetting();
$hotfix_file = $this->PATH."setup/sql/ilias_ea_dbfixes.php";
if (is_file($hotfix_file))
{
$this->hotfix_content_ea = @file($hotfix_file);
$this->hotfix_current_version_ea = (int) $this->hotfix_setting_ea->get("db_hotfixes_ea");
$this->hotfix_file_version_ea = $this->readHotfixFileVersion($this->hotfix_content_ea);
}
$this->hotfix_info_read_ea = true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDBUpdateEA::setHotfixCurrentVersionEA (   $a_version)

Set current hotfix version.

Definition at line 45 of file class.ilDBUpdateEA.php.

References readHotfixInfoEA().

Referenced by applyUpdateEANr().

{
$this->readHotfixInfoEA();
$this->hotfix_setting->set("db_hotfixes_ea", $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:

Field Documentation

ilDBUpdateEA::$hotfix_current_version_ea = 0
private

Definition at line 16 of file class.ilDBUpdateEA.php.

Referenced by getHotfixCurrentVersionEA().

ilDBUpdateEA::$hotfix_file_version_ea = 0
private

Definition at line 15 of file class.ilDBUpdateEA.php.

Referenced by getHotfixFileVersionEA().


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