2 require_once(
'./Services/Database/classes/class.ilDBWrapperFactory.php');
3 require_once(
'./Services/Database/classes/class.ilDBConstants.php');
24 }
catch (PDOException
$e) {
25 $connect = ($e->getCode() == 1049);
29 if ($keep_connection && $connect) {
34 $this->client->setError(
'Database can\'t be reached. Please check the credentials and if database exists');
81 if (empty(self::$instances[$client->getId()])) {
82 self::$instances[$client->getId()] =
new self(
$client);
85 return self::$instances[$client->getId()];
108 require_once(
'./setup/classes/class.ilClient.php');
109 require_once(
'./Services/Init/classes/class.ilIniFile.php');
110 require_once(
'./setup/classes/class.ilDBConnections.php');
112 $ilClient =
new ilClient($client_name,
new ilDBConnections());
114 $ilClient->setDbHost($host);
115 $ilClient->setDbName($dbname);
116 $ilClient->setDbUser($username);
118 $ilClient->setDbType(
$type);
119 $ilClient->writeIni();
121 return self::getInstanceForClient($ilClient);
139 $clientIniFile = $this->client->ini;
141 if (!$this->
ilDBInterface->createDatabase($clientIniFile->readVariable(
"db",
"name"),
'utf8', $a_collation)) {
159 if ($DIC->offsetExists(
'ilDB')) {
160 $DIC->offsetUnset(
'ilDB');
172 $this->client->db = null;
186 if ($tmp == $delim) {
206 $line = trim($this->
getline($fp,
"\n"));
208 if ($line !=
"" && substr($line, 0, 1) !=
"#" && substr($line, 0, 1) !=
"-") {
209 if (substr($line, -1) ==
";") {
211 $q .=
" " . substr($line, 0, -1);
238 $lines = explode(
';', $sql);
239 foreach ($lines as $line) {
240 if (strlen($line) > 0) {
286 include_once(
"./setup/sql/ilDBTemplate.php");
287 setupILIASDatabase();
337 $target = array(
'usr_data',
'object_data',
'object_reference' );
339 return count(array_intersect($this->
ilDBInterface->listTables(), $target)) == count($target);
351 return ($connectable && !$installed);
readDump()
legacy version of readdump
static getNewInstanceForClient(\ilClient $client)
static getInstanceForClient(\ilClient $client)
static getWrapper($a_type)
Class ilDatabaseException.
const TYPE_PDO_MYSQL_INNODB
const TYPE_PDO_MYSQL_MYISAM
createDatabase($a_collation)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
isConnectable($keep_connection=false)
readDumpSmall()
legacy version of readdump
static getInstanceForNewClient($client_name, $dbname, $host='localhost', $username='root', $password='', $type=ilDBConstants::TYPE_PDO_MYSQL_INNODB)
__construct(\ilClient $client)
ilDbSetup constructor.
setSqlDumpFile($sql_dump_file)
setIlDBInterface($ilDBInterface)