◆ getDefaultEngine()
ilDatabasePopulatedObjective::getDefaultEngine |
( |
ilDBInterface |
$db | ) |
|
|
private |
◆ getHash()
ilDatabasePopulatedObjective::getHash |
( |
| ) |
|
Definition at line 11 of file class.ilDatabasePopulatedObjective.php.
11 : string
12 {
13 return hash("sha256", implode("-", [
14 self::class,
15 $this->config->getHost(),
16 $this->config->getPort(),
17 $this->config->getDatabase()
18 ]));
19 }
◆ getLabel()
ilDatabasePopulatedObjective::getLabel |
( |
| ) |
|
◆ getPreconditions()
ilDatabasePopulatedObjective::getPreconditions |
( |
Setup\Environment |
$environment | ) |
|
Definition at line 31 of file class.ilDatabasePopulatedObjective.php.
31 : array
32 {
33 if ($environment->getResource(Setup\Environment::RESOURCE_DATABASE)) {
34 return [];
35 }
36 return [
37 new \ilDatabaseExistsObjective($this->config)
38 ];
39 }
◆ isApplicable()
ilDatabasePopulatedObjective::isApplicable |
( |
Setup\Environment |
$environment | ) |
|
◆ isDatabasePopulated()
ilDatabasePopulatedObjective::isDatabasePopulated |
( |
ilDBInterface |
$db | ) |
|
|
protected |
Definition at line 81 of file class.ilDatabasePopulatedObjective.php.
81 : bool
82 {
83 $probe_tables = ['usr_data', 'object_data', 'object_reference'];
84 $number_of_probe_tables = count($probe_tables);
86 $number_of_tables = count($tables);
87
88 return
89 $number_of_tables > self::MIN_NUMBER_OF_ILIAS_TABLES
90 && count(array_intersect($tables, $probe_tables)) == $number_of_probe_tables;
91 }
References ilDBInterface\listTables().
Referenced by isApplicable().
◆ isNotable()
ilDatabasePopulatedObjective::isNotable |
( |
| ) |
|
◆ queryReader()
ilDatabasePopulatedObjective::queryReader |
( |
string |
$path_to_db_dump | ) |
|
|
private |
Definition at line 119 of file class.ilDatabasePopulatedObjective.php.
119 : Generator
120 {
121 $stack = '';
122 $handle = fopen($path_to_db_dump, "r");
123 while (($line = fgets($handle)) !== false) {
124 if (preg_match('/^--/', $line)) {
125 continue;
126 }
127 if (preg_match('/^\/\*/', $line)) {
128 yield $line;
129 $stack = '';
130 continue;
131 }
132 if (!preg_match('/;$/', trim($line))) {
133 $stack .= $line;
134 } else {
135 $stack .= $line;
136 yield $stack;
137 $stack = '';
138 }
139 }
140
141 fclose($handle);
142 }
Referenced by readDumpFile().
◆ readDumpFile()
- Parameters
-
- Exceptions
-
Definition at line 97 of file class.ilDatabasePopulatedObjective.php.
97 : void
98 {
99 $path_to_db_dump = $this->config->getPathToDBDump();
100 if (!is_file(realpath($path_to_db_dump)) ||
101 !is_readable(realpath($path_to_db_dump))) {
102 throw new Setup\UnachievableException(
103 "Cannot read database dump file: $path_to_db_dump"
104 );
105 }
107 try {
110 }
catch (Throwable
$e) {
111 throw new Setup\UnachievableException(
112 "Cannot populate database with dump file: $path_to_db_dump. Query failed: $query wih message " .
$e->getMessage(
113 )
114 );
115 }
116 }
117 }
queryReader(string $path_to_db_dump)
execute($stmt, $data=array())
prepareManip($a_query, $a_types=null)
References Vendor\Package\$e, $query, ilDBInterface\execute(), ilDBInterface\prepareManip(), and queryReader().
◆ setDefaultEngine()
ilDatabasePopulatedObjective::setDefaultEngine |
( |
ilDBInterface |
$db | ) |
|
|
private |
◆ MIN_NUMBER_OF_ILIAS_TABLES
const ilDatabasePopulatedObjective::MIN_NUMBER_OF_ILIAS_TABLES = 200 |
The documentation for this class was generated from the following file: