ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWebServicesConfigStoredObjective.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
3/* Copyright (c) 2020 Daniel Weise <daniel.weise@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
6
11{
15 protected $config;
16
18 {
19 $this->config = $config;
20 }
21
22 public function getHash() : string
23 {
24 return hash("sha256", self::class);
25 }
26
27 public function getLabel() : string
28 {
29 return "Store information about web services in the settings";
30 }
31
32 public function isNotable() : bool
33 {
34 return true;
35 }
36
37 public function getPreconditions(Setup\Environment $environment) : array
38 {
39 $common_config = $environment->getConfigFor("common");
40 return [
41 new \ilIniFilesPopulatedObjective($common_config),
42 new \ilSettingsFactoryExistsObjective()
43 ];
44 }
45
46 public function achieve(Setup\Environment $environment) : Setup\Environment
47 {
48 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
49 $settings = $factory->settingsFor("common");
50 $settings->set(
51 "soap_user_administration",
52 $this->bool2string($this->config->isSOAPUserAdministration())
53 );
54 $settings->set("soap_wsdl_path", $this->config->getSOAPWsdlPath());
55 $settings->set("soap_connect_timeout", (string) $this->config->getSOAPConnectTimeout());
56 $settings->set("soap_response_timeout", (string) $this->config->getSoapResponseTimeout());
57 $settings->set("rpc_server_host", $this->config->getRPCServerHost());
58 $settings->set("rpc_server_port", $this->config->getRPCServerPort());
59
60 return $environment;
61 }
62
66 public function isApplicable(Setup\Environment $environment) : bool
67 {
68 return true;
69 }
70
71 protected function bool2string(bool $value) : string
72 {
73 if ($value) {
74 return "1";
75 }
76 return "0";
77 }
78}
An exception for terminatinating execution or to throw for unit testing.
isApplicable(Setup\Environment $environment)
@inheritDoc
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
$factory
Definition: metadata.php:58
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...