19 declare(strict_types=1);
35 private bool $reset_default =
false,
36 private bool $reset_all =
false 56 return "Creation of the default icons for file objects.";
89 $scan_result = scandir(self::PATH_DEFAULT_ICON_DIR);
90 $default_icon_filenames = preg_grep(
"/^icon_file_/", $scan_result);
91 foreach ($default_icon_filenames as $default_icon_filename) {
92 $icon_file_prefix =
"icon_file_";
93 $icon_file_suffix =
".svg";
94 $suffix = str_replace($icon_file_prefix,
"", $default_icon_filename);
95 $suffix = str_replace($icon_file_suffix,
"", $suffix);
102 $statement =
$db->queryF(
107 $num_matches =
$db->numRows($statement);
110 if ($num_matches > 0) {
114 $path_default_file_icon = self::PATH_DEFAULT_ICON_DIR . $default_icon_filename;
117 $resource_identification = $helper->movePathToStorage(
118 $path_default_file_icon,
125 if ($resource_identification === null) {
128 $rid = $resource_identification->serialize();
161 if ($this->reset_all) {
183 $statement =
$db->query($query);
185 while ($row =
$db->fetchAssoc($statement)) {
201 $statement =
$db->query($query);
203 while ($row =
$db->fetchAssoc($statement)) {
217 if (!empty($suffixes)) {
225 $statement =
$db->query($query);
227 while ($row =
$db->fetchAssoc($statement)) {
255 $scan_result = scandir(self::PATH_DEFAULT_ICON_DIR);
256 $num_default_icons_in_dir = is_countable(preg_grep(
"/^icon_file_/", $scan_result)) ? count(
257 preg_grep(
"/^icon_file_/", $scan_result)
261 $statement =
$db->query($query);
262 $num_default_icons_in_db =
$db->numRows($statement);
264 if ($num_default_icons_in_db < $num_default_icons_in_dir) {
An objective is a desired state of the system that is supposed to be created by the setup...
isApplicable(Environment $environment)
Get to know whether the objective is applicable.
const PATH_DEFAULT_ICON_DIR
const ICON_RESOURCE_IDENTIFICATION
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
achieve(Environment $environment)
Objectives can be achieved.
getPreconditions(Environment $environment)
An environment holds resources to be used in the setup process.
__construct(private bool $reset_default=false, private bool $reset_all=false)
static getPreconditions()