ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilFileSystemComponentDataDirectoryCreatedObjective Class Reference
+ Inheritance diagram for ilFileSystemComponentDataDirectoryCreatedObjective:
+ Collaboration diagram for ilFileSystemComponentDataDirectoryCreatedObjective:

Public Member Functions

 __construct (string $component_dir, int $base_location=self::DATADIR, int $permissions=self::DEFAULT_DIRECTORY_PERMISSIONS)
 
 getHash ()
 @inheritdocs More...
 
 getLabel ()
 @inheritdocs More...
 
 isNotable ()
 @inheritdocs More...
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 

Data Fields

const DATADIR = 1
 
const WEBDIR = 2
 
const DEFAULT_DIRECTORY_PERMISSIONS = 0755
 

Protected Member Functions

 buildPath (Setup\Environment $environment)
 

Protected Attributes

 $component_dir
 
 $base_location
 
 $permissions
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFileSystemComponentDataDirectoryCreatedObjective::__construct ( string  $component_dir,
int  $base_location = self::DATADIR,
int  $permissions = self::DEFAULT_DIRECTORY_PERMISSIONS 
)

Member Function Documentation

◆ achieve()

ilFileSystemComponentDataDirectoryCreatedObjective::achieve ( Setup\Environment  $environment)

Definition at line 79 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

79 : Setup\Environment
80 {
81 $path = $this->buildPath($environment);
82
83 if (!file_exists($path)) {
84 mkdir($path, $this->permissions);
85 }
86 if (!is_dir($path)) {
87 throw new UnachievableException(
88 "Could not create directory '{$path}'"
89 );
90 }
91 return $environment;
92 }
Signals that some goal won't be achievable by actions of the system ever.

References buildPath().

+ Here is the call graph for this function:

◆ buildPath()

ilFileSystemComponentDataDirectoryCreatedObjective::buildPath ( Setup\Environment  $environment)
protected

Definition at line 94 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

94 : string
95 {
96 $common_config = $environment->getConfigFor("common");
97 $fs_config = $environment->getConfigFor("filesystem");
98
99 if ($this->base_location === self::DATADIR) {
100 $data_dir = $fs_config->getDataDir();
101 }
102
103 if ($this->base_location === self::WEBDIR) {
104 $data_dir = $fs_config->getWebDir();
105 }
106
107 $client_data_dir = $data_dir . '/' . $common_config->getClientId();
108 $new_dir = $client_data_dir . '/' . $this->component_dir;
109
110 return $new_dir;
111 }

References $component_dir.

Referenced by achieve().

+ Here is the caller graph for this function:

◆ getHash()

ilFileSystemComponentDataDirectoryCreatedObjective::getHash ( )

@inheritdocs

Definition at line 42 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

42 : string
43 {
44 return hash("sha256", self::class . "::" . $this->component_dir . (string) $this->base_location);
45 }

◆ getLabel()

ilFileSystemComponentDataDirectoryCreatedObjective::getLabel ( )

@inheritdocs

Definition at line 50 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

50 : string
51 {
52 $dir = '';
53 if ($this->base_location === self::DATADIR) {
54 $dir = 'data';
55 }
56 if ($this->base_location === self::WEBDIR) {
57 $dir = 'web';
58 }
59
60 return "Create $dir directory in component directory $this->component_dir";
61 }

◆ getPreconditions()

ilFileSystemComponentDataDirectoryCreatedObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 71 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

71 : array
72 {
73 $config = $environment->getConfigFor("filesystem");
74 return [
76 ];
77 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68

References $config.

◆ isNotable()

ilFileSystemComponentDataDirectoryCreatedObjective::isNotable ( )

@inheritdocs

Definition at line 66 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

66 : bool
67 {
68 return true;
69 }

Field Documentation

◆ $base_location

ilFileSystemComponentDataDirectoryCreatedObjective::$base_location
protected

◆ $component_dir

ilFileSystemComponentDataDirectoryCreatedObjective::$component_dir
protected

◆ $permissions

ilFileSystemComponentDataDirectoryCreatedObjective::$permissions
protected

◆ DATADIR

const ilFileSystemComponentDataDirectoryCreatedObjective::DATADIR = 1

◆ DEFAULT_DIRECTORY_PERMISSIONS

const ilFileSystemComponentDataDirectoryCreatedObjective::DEFAULT_DIRECTORY_PERMISSIONS = 0755

◆ WEBDIR


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