◆ achieve()
ilDatabasePopulatedObjective::achieve |
( |
Setup\Environment |
$environment | ) |
|
Definition at line 41 of file class.ilDatabasePopulatedObjective.php.
41 : Setup\Environment
42 {
43 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
44
46 return $environment;
47 }
48
49 $path_to_db_dump = $this->config->getPathToDBDump();
50 if (!is_file(realpath($path_to_db_dump)) ||
51 !is_readable(realpath($path_to_db_dump))) {
52 throw new Setup\UnachievableException(
53 "Cannot read database dump file: $path_to_db_dump"
54 );
55 }
56
57 $sql = file_get_contents(realpath($path_to_db_dump));
58 $statement = $db->prepareManip($sql);
59 $db->execute($statement);
60
61 return $environment;
62 }
isDatabasePopulated(\ilDBInterface $db)
References ILIAS\Setup\Environment\getResource(), and isDatabasePopulated().
◆ 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 }
◆ isDatabasePopulated()
ilDatabasePopulatedObjective::isDatabasePopulated |
( |
\ilDBInterface |
$db | ) |
|
|
protected |
Definition at line 64 of file class.ilDatabasePopulatedObjective.php.
65 {
66 $probe_tables = ['usr_data', 'object_data', 'object_reference'];
67 $number_of_probe_tables = count($probe_tables);
68 $tables = $db->listTables();
69 $number_of_tables = count($tables);
70
71 return
72 $number_of_tables > self::MIN_NUMBER_OF_ILIAS_TABLES
73 && count(array_intersect($tables, $probe_tables)) == $number_of_probe_tables;
74 }
References ilDBInterface\listTables().
Referenced by achieve().
◆ isNotable()
ilDatabasePopulatedObjective::isNotable |
( |
| ) |
|
◆ MIN_NUMBER_OF_ILIAS_TABLES
const ilDatabasePopulatedObjective::MIN_NUMBER_OF_ILIAS_TABLES = 200 |
The documentation for this class was generated from the following file: