/** * check client db status * @param object client * @return boolean */ function checkClientDatabase(&$client) { if (!($arr["status"] = $client->db_exists)) { $arr["comment"] = $this->lng->txt("no_database"); return $arr; } if (!($arr["status"] = $client->db_installed)) { $arr["comment"] = $this->lng->txt("db_not_installed"); return $arr; } // TODO: move this to client class!! $client->setup_ok = (bool) $client->getSetting("setup_ok"); //$this->lng->setDbHandler($client->db); include_once "./Services/Database/classes/class.ilDBUpdate.php"; $ilDB = $client->db; $this->lng->setDbHandler($client->db); $dbupdate = new ilDBUpdate($client->db); if (!($arr["status"] = $dbupdate->getDBVersionStatus())) { $arr["comment"] = $this->lng->txt("db_needs_update"); $arr["update"] = true; return $arr; } else { if ($dbupdate->hotfixAvailable()) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("hotfix_available"); $arr["update"] = true; return $arr; } else { if ($dbupdate->customUpdatesAvailable()) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("custom_updates_available"); $arr["update"] = true; return $arr; } } } // check control information $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls"); $crec = $ilDB->fetchAssoc($cset); if ($crec["cnt"] == 0) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("db_control_structure_missing"); $arr["update"] = true; return $arr; } //$arr["comment"] = "version ".$dbupdate->getCurrentVersion(); return $arr; }
/** * Update database */ function showUpdateSteps($a_hotfix = false) { global $ilCtrlStructureReader; $this->checkDisplayMode("setup_database"); //$this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_db.html", "setup"); // database is intalled if ($this->setup->getClient()->db_installed) { $ilDB = $this->setup->getClient()->db; $this->lng->setDbHandler($ilDB); $dbupdate = new ilDBUpdate($ilDB); $db_status = $dbupdate->getDBVersionStatus(); $hotfix_available = $dbupdate->hotfixAvailable(); $custom_updates_available = $dbupdate->customUpdatesAvailable(); // $this->initClientDbForm(false, $dbupdate, $db_status, $hotfix_available, $custom_updates_available); // $this->getClientDbFormValues($dbupdate); $ntpl = new ilTemplate("tpl.setup_steps.html", true, true, "setup"); if ($a_hotfix) { $ntpl->setVariable("CONTENT", $dbupdate->getHotfixSteps()); } else { $ntpl->setVariable("CONTENT", $dbupdate->getUpdateSteps($_POST["update_break"])); } $ntpl->setVariable("BACK", $this->lng->txt("back")); $ntpl->setVariable("HREF_BACK", "./setup.php?client_id=&cmd=db"); $this->tpl->setVariable("SETUP_CONTENT", $ntpl->get()); } }