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.";
94 $scan_result = scandir(self::PATH_DEFAULT_ICON_DIR);
95 $default_icon_filenames = preg_grep(
"/^icon_file_/", $scan_result);
96 foreach ($default_icon_filenames as $default_icon_filename) {
97 $icon_file_prefix =
"icon_file_";
98 $icon_file_suffix =
".svg";
99 $suffix = str_replace($icon_file_prefix,
"", $default_icon_filename);
100 $suffix = str_replace($icon_file_suffix,
"", $suffix);
107 $statement =
$db->queryF(
112 $num_matches =
$db->numRows($statement);
115 if ($num_matches > 0) {
119 $path_default_file_icon = self::PATH_DEFAULT_ICON_DIR . $default_icon_filename;
122 $resource_identification = $helper->movePathToStorage(
123 $path_default_file_icon,
130 if ($resource_identification === null) {
133 $rid = $resource_identification->serialize();
166 if ($this->reset_all) {
188 $statement =
$db->query($query);
190 while ($row =
$db->fetchAssoc($statement)) {
206 $statement =
$db->query($query);
208 while ($row =
$db->fetchAssoc($statement)) {
222 if (!empty($suffixes)) {
230 $statement =
$db->query($query);
232 while ($row =
$db->fetchAssoc($statement)) {
260 $scan_result = scandir(self::PATH_DEFAULT_ICON_DIR);
261 $num_default_icons_in_dir = is_countable(preg_grep(
"/^icon_file_/", $scan_result)) ? count(
262 preg_grep(
"/^icon_file_/", $scan_result)
266 $statement =
$db->query($query);
267 $num_default_icons_in_db =
$db->numRows($statement);
269 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()