19declare(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));
97 $files =
new RecursiveIteratorIterator(
98 new RecursiveDirectoryIterator(
$path, FilesystemIterator::SKIP_DOTS),
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());
achieve(Environment $environment)
Objectives can be achieved.They might add resources to the environment when they have been achieved....
deleteDirRecursive(string $path)
isNotable()
Get to know if this is an interesting objective for a human.
isApplicable(Environment $environment)
@inheritDoc
__construct(protected string $target, protected MysqlDumper $dumper)
getPreconditions(Environment $environment)
Objectives might depend on other objectives.Objective[]
getHash()
Get a hash for this objective.The hash of two objectives must be the same, if they are the same objec...
getLabel()
Get a label that describes this objective.
An environment holds resources to be used in the setup process.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.