ILIAS  release_7 Revision v7.30-3-g800a261c036
ilInstallationInformationStoredObjective Class Reference

Store information about the installation, like title, description and contact information in the according fields in the ini or database. More...

+ Inheritance diagram for ilInstallationInformationStoredObjective:
+ Collaboration diagram for ilInstallationInformationStoredObjective:

Public Member Functions

 __construct (\ilSystemFolderSetupConfig $config)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 @inheritDoc More...
 

Protected Attributes

 $config
 

Detailed Description

Store information about the installation, like title, description and contact information in the according fields in the ini or database.

Definition at line 11 of file class.ilInstallationInformationStoredObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilInstallationInformationStoredObjective::__construct ( \ilSystemFolderSetupConfig  $config)

Member Function Documentation

◆ achieve()

ilInstallationInformationStoredObjective::achieve ( Setup\Environment  $environment)

Definition at line 47 of file class.ilInstallationInformationStoredObjective.php.

47 : Setup\Environment
48 {
49 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
50 $common_config = $environment->getConfigFor("common");
51
52 $settings = $factory->settingsFor("common");
53 $ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
54
55 $settings->set("inst_name", $this->config->getClientName());
56 $ini->setVariable("client", "name", $this->config->getClientName() ?? $common_config->getClientId());
57 $ini->setVariable("client", "description", $this->config->getClientDescription());
58 $settings->set("inst_institution", $this->config->getClientInstitution());
59 $settings->set("admin_firstname", $this->config->getContactFirstname());
60 $settings->set("admin_lastname", $this->config->getContactLastname());
61 $settings->set("admin_title", $this->config->getContactTitle());
62 $settings->set("admin_position", $this->config->getContactPosition());
63 $settings->set("admin_institution", $this->config->getContactInstitution());
64 $settings->set("admin_street", $this->config->getContactStreet());
65 $settings->set("admin_zipcode", $this->config->getContactZipcode());
66 $settings->set("admin_city", $this->config->getContactCity());
67 $settings->set("admin_country", $this->config->getContactCountry());
68 $settings->set("admin_phone", $this->config->getContactPhone());
69 $settings->set("admin_email", $this->config->getContactEMail());
70
71 if (!$ini->write()) {
72 throw new Setup\UnachievableException("Could not write client.ini.php");
73 }
74
75 return $environment;
76 }
$factory
Definition: metadata.php:58
$ini
Definition: raiseError.php:4

References $factory, and $ini.

◆ getHash()

ilInstallationInformationStoredObjective::getHash ( )

Definition at line 24 of file class.ilInstallationInformationStoredObjective.php.

24 : string
25 {
26 return hash("sha256", self::class);
27 }

◆ getLabel()

ilInstallationInformationStoredObjective::getLabel ( )

Definition at line 29 of file class.ilInstallationInformationStoredObjective.php.

29 : string
30 {
31 return "Store information about installation and contact in the settings";
32 }

◆ getPreconditions()

ilInstallationInformationStoredObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 39 of file class.ilInstallationInformationStoredObjective.php.

39 : array
40 {
41 return [
42 new \ilIniFilesLoadedObjective(),
43 new \ilSettingsFactoryExistsObjective()
44 ];
45 }

◆ isApplicable()

ilInstallationInformationStoredObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 81 of file class.ilInstallationInformationStoredObjective.php.

81 : bool
82 {
83 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
84 $common_config = $environment->getConfigFor("common");
85
86 $settings = $factory->settingsFor("common");
87 $ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
88
89 $client_name = $this->config->getClientName() ?? $common_config->getClientId();
90
91 return
92 $settings->get("inst_name") !== $this->config->getClientName() ||
93 $ini->readVariable("client", "name") !== $client_name ||
94 $ini->readVariable("client", "description") !== $this->config->getClientDescription() ||
95 $settings->get("inst_institution") !== $this->config->getClientInstitution() ||
96 $settings->get("admin_firstname") !== $this->config->getContactFirstname() ||
97 $settings->get("admin_lastname") !== $this->config->getContactLastname() ||
98 $settings->get("admin_title") !== $this->config->getContactTitle() ||
99 $settings->get("admin_position") !== $this->config->getContactPosition() ||
100 $settings->get("admin_institution") !== $this->config->getContactInstitution() ||
101 $settings->get("admin_street") !== $this->config->getContactStreet() ||
102 $settings->get("admin_zipcode") !== $this->config->getContactZipcode() ||
103 $settings->get("admin_city") !== $this->config->getContactCity() ||
104 $settings->get("admin_country") !== $this->config->getContactCountry() ||
105 $settings->get("admin_phone") !== $this->config->getContactPhone() ||
106 $settings->get("admin_email") !== $this->config->getContactEMail()
107 ;
108 }

References $factory, and $ini.

◆ isNotable()

ilInstallationInformationStoredObjective::isNotable ( )

Definition at line 34 of file class.ilInstallationInformationStoredObjective.php.

34 : bool
35 {
36 return true;
37 }

Field Documentation

◆ $config

ilInstallationInformationStoredObjective::$config
protected

Definition at line 16 of file class.ilInstallationInformationStoredObjective.php.

Referenced by __construct().


The documentation for this class was generated from the following file: