1<?
php declare(strict_types=1);
37 $this->ilias_path = dirname(__FILE__, 5);
38 $this->delos_path =
"$this->ilias_path/templates/default/";
41 $this->delos_responsive_logo_hash = $this->
getFileHash($this->delos_path . self::RESPONSIVE_LOGO_PATH);
42 $this->delos_common_logo_hash = $this->
getFileHash($this->delos_path . self::COMMON_LOGO_PATH);
50 return hash(
"sha256", self::class);
58 return 'Replacing responsive logos where necessary.';
83 if (
null === $this->delos_common_logo_hash ||
null === $this->delos_responsive_logo_hash) {
87 $skin_directory =
"$this->ilias_path/Customizing/global/skin/";
90 if (!file_exists($skin_directory) || !is_dir($skin_directory)) {
94 foreach (
new DirectoryIterator($skin_directory) as $skin_name) {
95 if (
'.' === $skin_name ||
'..' === $skin_name) {
114 if ($this->
getFileHash($common_logo) !== $this->delos_common_logo_hash &&
115 $this->
getFileHash($responsive_logo) === $this->delos_responsive_logo_hash
117 copy($common_logo, $responsive_logo);
124 protected function getFileHash(
string $absolute_file_path) : ?string
126 if (!file_exists($absolute_file_path)) {
130 if (
false !== ($hash = sha1_file($absolute_file_path))) {
An exception for terminatinating execution or to throw for unit testing.
achieve(Environment $environment)
@inheritDoc
const RESPONSIVE_LOGO_PATH
getPreconditions(Environment $environment)
@inheritDoc
$delos_responsive_logo_hash
getFileHash(string $absolute_file_path)
Returns the sha1-sum of the given file if it exists.
maybeReplaceResponsiveIcon(string $skin_path)
Replaces the responsive header-icon with the common header-icon, if the common icon is different from...
An environment holds resources to be used in the setup process.
An objective is a desired state of the system that is supposed to be created by the setup.