ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilFileObjectSettingsUpdatedObjective.php
Go to the documentation of this file.
1<?php
2
21
23{
24 public function getHash(): string
25 {
26 return hash(
27 "sha256",
28 static::class
29 );
30 }
31
32 public function getLabel(): string
33 {
34 return "File Object Settings have been updated.";
35 }
36
37 public function isNotable(): bool
38 {
39 return false;
40 }
41
42 public function getPreconditions(Environment $environment): array
43 {
44 return [
47 ];
48 }
49
50 public function achieve(Environment $environment): Environment
51 {
56 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
57 $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
58
59 $use_ascii_characters_only = $client_ini->readVariable(
60 'file_access',
61 'disable_ascii'
62 ) !== '1';
63
64 $db->manipulateF(
65 "INSERT IGNORE settings (module, keyword, value) VALUES (%s, %s, %s)",
66 ['text', 'text', 'text'],
67 ['file_access', 'download_ascii_filename', $use_ascii_characters_only ? '1' : '0']
68 );
69
70 $db->manipulate(
71 "UPDATE settings SET module = 'file_access' WHERE keyword = 'bgtask_download'"
72 );
73
74 $client_ini->removeGroup('file_access');
75 $client_ini->write();
76
77 return $environment;
78 }
79
80 public function isApplicable(Environment $environment): bool
81 {
85 $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
86
87 return $client_ini->groupExists("file_access");
88 }
89}
getPreconditions(Environment $environment)
Objectives might depend on other objectives.
isNotable()
Get to know if this is an interesting objective for a human.
getLabel()
Get a label that describes this objective.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
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.
Definition: Objective.php:31
isApplicable(Environment $environment)
Get to know whether the objective is applicable.
achieve(Environment $environment)
Objectives can be achieved.