19 declare(strict_types=1);
    49         $this->db = $a_db_handler;
    52         $class_map = require ILIAS_ABSOLUTE_PATH . 
'/libs/composer/vendor/composer/autoload_classmap.php';
    59         $sql = explode(
"\n", trim($str));
    60         foreach ($sql as $i => $statement) {
    61             $sql[$i] = trim($statement);
    62             if ($statement !== 
"" && $statement[0] !== 
"#") {
    64                 if (substr($statement, -1) === 
";") {
    67                     $q .= 
" " . substr($statement, 0, -1);
    72                         $this->error = (string) 
$check;
    78                     $q .= 
" " . $statement;
    82         if (isset(
$q) && 
$q !== 
"") {
    83             echo 
"incomplete_statement: " . 
$q . 
"<br>";
   104         if (isset(
$GLOBALS[
'ilCtrlStructureReader'])) {
   105             $ilCtrlStructureReader = 
$GLOBALS[
'ilCtrlStructureReader'];
   106         } elseif ($DIC->offsetExists(
'ilCtrlStructureReader')) {
   107             $ilCtrlStructureReader = $DIC[
'ilCtrlStructureReader'];
   110                 $this->ctrl_structure_iterator,
   113             $DIC->offsetSet(
'ilCtrlStructureReader', $ilCtrlStructureReader);
   116         $GLOBALS[
'ilCtrlStructureReader'] = $ilCtrlStructureReader;
   118         if ($this->client_ini) {
   119             $ilCtrlStructureReader->setIniFile($this->client_ini);
   121         $ilDB = $DIC->database();
   129     protected function applyUpdateNr(
int $nr, 
bool $custom_update = 
false): bool
   131         $ilCtrlStructureReader = null;
   135         reset($this->filecontent);
   141         while (!preg_match(
"/^<\#" . $nr . 
">/", $this->filecontent[$i]) && $i < count($this->filecontent)) {
   146         if ($i === count($this->filecontent)) {
   147             $this->error = 
'update_not_found';
   156         while ($i < count($this->filecontent) && !preg_match(
"/^<#" . ($nr + 1) . 
">/", $this->filecontent[$i])) {
   157             $update[] = trim($this->filecontent[$i]);
   166         foreach ($update as $row) {
   167             if (preg_match(
"/<\?php/", $row)) {
   168                 if (count($sql) > 0) {
   169                     if ($this->
execQuery($this->db, implode(
"\n", $sql)) === 
false) {
   175             } elseif (preg_match(
"/\?>/", $row)) {
   176                 if (count($php) > 0) {
   177                     $code = implode(
"\n", $php);
   178                     if (eval($code) === 
false) {
   179                         $this->error = 
'Parse error: ' . $code;
   187                 if ($mode === 
'sql') {
   191                 if ($mode === 
'php') {
   197         if ($mode === 
'sql' && count($sql) > 0 && $this->
execQuery($this->db, implode(
"\n", $sql)) === 
false) {
   203         if ($custom_update) {
   222         $this->custom_updates_setting->set(
'db_version_custom', (
string) $a_version);
   223         $this->custom_updates_current_version = $a_version;
   240         reset($a_file_content);
   243         foreach ($a_file_content as $row) {
   244             if (preg_match(
"/^<#([0-9]+)>/", $row, $regs)) {
   254         if ($this->custom_updates_info_read && !$a_force) {
   258         $this->custom_updates_setting = 
new ilSetting();
   259         $custom_updates_file = $this->PATH . 
'setup/sql/dbupdate_custom.php';
   260         if (is_file($custom_updates_file)) {
   261             $this->custom_updates_content = @file($custom_updates_file);
   262             $this->custom_updates_current_version = (
int) $this->custom_updates_setting->get(
'db_version_custom', 
'0');
   265         $this->custom_updates_info_read = 
true;
   270         $ilCtrlStructureReader = null;
   279         $this->updateMsg = 
'no_changes';
   280         if ($current_version < $file_version) {
   282             for ($i = ($current_version + 1); $i <= $file_version; $i++) {
   288                     $this->updateMsg = implode(
"\n", $msg);
   294                     'msg' => 
'custom_update_applied',
   299             $this->updateMsg = implode(
"\n", $msg);
 readCustomUpdatesFileVersion(array $a_file_content)
 
getCustomUpdatesFileVersion()
 
__construct(ilDBInterface $a_db_handler, ilIniFile $client_ini=null)
 
Class ilCtrlStructureCidGenerator. 
 
ilSetting $custom_updates_setting
 
setCurrentVersion(?int $a_version)
 
array $custom_updates_content
 
Class ilCtrlStructureReader is responsible for reading ilCtrl's control structure. 
 
applyUpdateNr(int $nr, bool $custom_update=false)
Apply a custom database update or a plugin update. 
 
readCustomUpdatesInfo(bool $a_force=false)
 
int $custom_updates_file_version
 
Iterator $ctrl_structure_iterator
 
int $custom_updates_current_version
 
execQuery(ilDBInterface $db, string $str)
 
bool $custom_updates_info_read
 
query(string $query)
Run a (read-only) Query on the database. 
 
Class ilCtrlArrayIterator. 
 
initGlobalsRequiredForUpdateSteps(?ilCtrlStructureReader &$ilCtrlStructureReader, ?ilDBInterface &$ilDB)
 
setCustomUpdatesCurrentVersion(?int $a_version)
 
getCustomUpdatesCurrentVersion()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...