19 declare(strict_types=1);
35 return hash(
"sha256", self::class . $this->target);
70 if (file_exists($this->target)) {
73 mkdir($this->target, 0755);
75 $client_ini = $environment->
getResource(Environment::RESOURCE_CLIENT_INI);
76 $host = $client_ini->readVariable(
"db",
"host");
77 $user = $client_ini->readVariable(
"db",
"user");
78 $password = $client_ini->readVariable(
"db",
"pass");
79 $name = $client_ini->readVariable(
"db",
"name");
80 $port = $client_ini->readVariable(
"db",
"port");
82 $this->dumper->createDump($host, $user, $password, $name, $port, $this->target);
92 return is_writable(pathinfo($this->target, PATHINFO_DIRNAME));
99 RecursiveIteratorIterator::CHILD_FIRST
102 foreach ($files as $file_info) {
103 if ($file_info->isDir()) {
104 rmdir($file_info->getRealPath());
107 unlink($file_info->getRealPath());
An objective is a desired state of the system that is supposed to be created by the setup...
getLabel()
Get a label that describes this objective.
getHash()
Get a hash for this objective.The hash of two objectives must be the same, if they are the same objec...
__construct(protected string $target, protected MysqlDumper $dumper)
isApplicable(Environment $environment)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
isNotable()
Get to know if this is an interesting objective for a human.
achieve(Environment $environment)
Objectives can be achieved.They might add resources to the environment when they have been achieved...
An environment holds resources to be used in the setup process.
getPreconditions(Environment $environment)
Objectives might depend on other objectives.if the objective is not achievableObjective[] ...
deleteDirRecursive(string $path)