ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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)
 

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 25 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 61 of file class.ilInstallationInformationStoredObjective.php.

References $ini, and ILIAS\Setup\Environment\getResource().

61  : Setup\Environment
62  {
63  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
64  $common_config = $environment->getConfigFor("common");
65 
66  $settings = $factory->settingsFor("common");
67  $ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
68 
69  $settings->set("inst_name", (string) $this->config->getClientName());
70  $ini->setVariable("client", "name", $this->config->getClientName() ?? (string) $common_config->getClientId());
71  $ini->setVariable("client", "description", (string) $this->config->getClientDescription());
72  $settings->set("inst_institution", (string) $this->config->getClientInstitution());
73  $settings->set("admin_firstname", (string) $this->config->getContactFirstname());
74  $settings->set("admin_lastname", (string) $this->config->getContactLastname());
75  $settings->set("admin_title", (string) $this->config->getContactTitle());
76  $settings->set("admin_position", (string) $this->config->getContactPosition());
77  $settings->set("admin_institution", (string) $this->config->getContactInstitution());
78  $settings->set("admin_street", (string) $this->config->getContactStreet());
79  $settings->set("admin_zipcode", (string) $this->config->getContactZipcode());
80  $settings->set("admin_city", (string) $this->config->getContactCity());
81  $settings->set("admin_country", (string) $this->config->getContactCountry());
82  $settings->set("admin_phone", (string) $this->config->getContactPhone());
83  $settings->set("admin_email", (string) $this->config->getContactEMail());
84 
85  if (!$ini->write()) {
86  throw new Setup\UnachievableException("Could not write client.ini.php");
87  }
88 
89  return $environment;
90  }
$ini
Definition: raiseError.php:20
+ Here is the call graph for this function:

◆ getHash()

ilInstallationInformationStoredObjective::getHash ( )

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

38  : string
39  {
40  return hash("sha256", self::class);
41  }

◆ getLabel()

ilInstallationInformationStoredObjective::getLabel ( )

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

43  : string
44  {
45  return "Store information about installation and contact in the settings";
46  }

◆ getPreconditions()

ilInstallationInformationStoredObjective::getPreconditions ( Setup\Environment  $environment)

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

53  : array
54  {
55  return [
56  new \ilIniFilesLoadedObjective(),
57  new \ilSettingsFactoryExistsObjective()
58  ];
59  }

◆ isApplicable()

ilInstallationInformationStoredObjective::isApplicable ( Setup\Environment  $environment)

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

References $ini.

95  : bool
96  {
97  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
98  $common_config = $environment->getConfigFor("common");
99 
100  $settings = $factory->settingsFor("common");
101  $ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
102 
103  $client_name = $this->config->getClientName() ?? (string) $common_config->getClientId();
104 
105  return
106  $settings->get("inst_name") !== $this->config->getClientName() ||
107  $ini->readVariable("client", "name") !== $client_name ||
108  $ini->readVariable("client", "description") !== $this->config->getClientDescription() ||
109  $settings->get("inst_institution") !== $this->config->getClientInstitution() ||
110  $settings->get("admin_firstname") !== $this->config->getContactFirstname() ||
111  $settings->get("admin_lastname") !== $this->config->getContactLastname() ||
112  $settings->get("admin_title") !== $this->config->getContactTitle() ||
113  $settings->get("admin_position") !== $this->config->getContactPosition() ||
114  $settings->get("admin_institution") !== $this->config->getContactInstitution() ||
115  $settings->get("admin_street") !== $this->config->getContactStreet() ||
116  $settings->get("admin_zipcode") !== $this->config->getContactZipcode() ||
117  $settings->get("admin_city") !== $this->config->getContactCity() ||
118  $settings->get("admin_country") !== $this->config->getContactCountry() ||
119  $settings->get("admin_phone") !== $this->config->getContactPhone() ||
120  $settings->get("admin_email") !== $this->config->getContactEMail()
121  ;
122  }
$ini
Definition: raiseError.php:20

◆ isNotable()

ilInstallationInformationStoredObjective::isNotable ( )

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

48  : bool
49  {
50  return true;
51  }

Field Documentation

◆ $config

ilInstallationInformationStoredObjective::$config
protected

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

Referenced by __construct().


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