ILIAS  release_8 Revision v8.24
ilFSStorageCourse Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilFSStorageCourse:
+ Collaboration diagram for ilFSStorageCourse:

Public Member Functions

 __construct (int $a_container_id=0)
 
 initInfoDirectory ()
 
 getInfoDirectory ()
 
 initMemberExportDirectory ()
 
 getMemberExportDirectory ()
 
 addMemberExportFile ($a_data, $a_rel_name)
 
 getMemberExportFiles ()
 
 getMemberExportFile (string $a_name)
 
 deleteMemberExportFile (string $a_export_name)
 
 hasMemberExportFile (string $a_export_name)
 
- Public Member Functions inherited from ilFileSystemAbstractionStorage
 __construct (int $a_storage_type, bool $a_path_conversion, int $a_container_id)
 Constructor. More...
 
 fileExists (string $a_absolute_path)
 
 getContainerId ()
 
 writeToFile (string $a_data, $a_absolute_path)
 
 copyFile (string $a_from, string $a_to)
 
 create ()
 
 getAbsolutePath ()
 Calculates the full path on the filesystem. More...
 
 delete ()
 
 deleteDirectory (string $a_abs_name)
 
 deleteFile (string $a_abs_name)
 
 appendToPath (string $a_appendix)
 
 getStorageType ()
 
 getPath ()
 

Static Public Member Functions

static _clone (int $a_source_id, int $a_target_id)
 
- Static Public Member Functions inherited from ilFileSystemAbstractionStorage
static createPathFromId (int $a_container_id, string $a_name)
 
static _copyDirectory (string $a_sdir, string $a_tdir)
 

Data Fields

const MEMBER_EXPORT_DIR = 'memberExport'
 
const INFO_DIR = 'info'
 
const ARCHIVE_DIR = 'archives'
 
- Data Fields inherited from ilFileSystemAbstractionStorage
const STORAGE_WEB = 1
 
const STORAGE_DATA = 2
 
const STORAGE_SECURED = 3
 

Protected Member Functions

 getPathPostfix ()
 Implementation of abstract method @access protected. More...
 
 getPathPrefix ()
 Implementation of abstract method @access protected. More...
 
- Protected Member Functions inherited from ilFileSystemAbstractionStorage
 getLegacyFullAbsolutePath (string $relative_path)
 
 getFileSystemService ()
 
 getPathPrefix ()
 Get path prefix. More...
 
 getPathPostfix ()
 Get directory name. More...
 
 getLegacyAbsolutePath ()
 Calculates the absolute filesystem storage location. More...
 
 init ()
 

Private Attributes

ilLogger $logger
 

Additional Inherited Members

- Protected Attributes inherited from ilFileSystemAbstractionStorage
string $path = null
 
ILIAS Filesystem Filesystems $file_system_service
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 25 of file class.ilFSStorageCourse.php.

Constructor & Destructor Documentation

◆ __construct()

ilFSStorageCourse::__construct ( int  $a_container_id = 0)

@noinspection PhpUndefinedMethodInspection

Definition at line 33 of file class.ilFSStorageCourse.php.

34 {
35 global $DIC;
36
38 $this->logger = $DIC->logger()->crs();
40 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\logger(), and ilFileSystemAbstractionStorage\STORAGE_DATA.

+ Here is the call graph for this function:

Member Function Documentation

◆ _clone()

static ilFSStorageCourse::_clone ( int  $a_source_id,
int  $a_target_id 
)
static

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

42 : bool
43 {
44 $source = new ilFSStorageCourse($a_source_id);
45 $target = new ilFSStorageCourse($a_target_id);
46 $target->create();
47 ilFileSystemAbstractionStorage::_copyDirectory($source->getAbsolutePath(), $target->getAbsolutePath());
48
49 // Delete member export files
50 $target->deleteDirectory($target->getMemberExportDirectory());
51
52 unset($source);
53 unset($target);
54 return true;
55 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _copyDirectory(string $a_sdir, string $a_tdir)
$source
Definition: metadata.php:93

References $source, and ilFileSystemAbstractionStorage\_copyDirectory().

+ Here is the call graph for this function:

◆ addMemberExportFile()

ilFSStorageCourse::addMemberExportFile (   $a_data,
  $a_rel_name 
)

Definition at line 77 of file class.ilFSStorageCourse.php.

77 : bool
78 {
80 if (!$this->writeToFile($a_data, $this->getMemberExportDirectory() . '/' . $a_rel_name)) {
81 $this->logger->write('Cannot write to file: ' . $this->getMemberExportDirectory() . '/' . $a_rel_name);
82 return false;
83 }
84
85 return true;
86 }

References getMemberExportDirectory(), initMemberExportDirectory(), ILIAS\Repository\logger(), and ilFileSystemAbstractionStorage\writeToFile().

+ Here is the call graph for this function:

◆ deleteMemberExportFile()

ilFSStorageCourse::deleteMemberExportFile ( string  $a_export_name)

Definition at line 130 of file class.ilFSStorageCourse.php.

130 : bool
131 {
132 return $this->deleteFile($this->getMemberExportDirectory() . '/' . $a_export_name);
133 }

References ilFileSystemAbstractionStorage\deleteFile(), and getMemberExportDirectory().

+ Here is the call graph for this function:

◆ getInfoDirectory()

ilFSStorageCourse::getInfoDirectory ( )

Definition at line 62 of file class.ilFSStorageCourse.php.

62 : string
63 {
64 return $this->getAbsolutePath() . '/' . self::INFO_DIR;
65 }
getAbsolutePath()
Calculates the full path on the filesystem.

References ilFileSystemAbstractionStorage\getAbsolutePath(), and INFO_DIR.

Referenced by initInfoDirectory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMemberExportDirectory()

ilFSStorageCourse::getMemberExportDirectory ( )

Definition at line 72 of file class.ilFSStorageCourse.php.

72 : string
73 {
74 return $this->getAbsolutePath() . '/' . self::MEMBER_EXPORT_DIR;
75 }

References ilFileSystemAbstractionStorage\getAbsolutePath(), and MEMBER_EXPORT_DIR.

Referenced by addMemberExportFile(), deleteMemberExportFile(), getMemberExportFile(), getMemberExportFiles(), hasMemberExportFile(), and initMemberExportDirectory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMemberExportFile()

ilFSStorageCourse::getMemberExportFile ( string  $a_name)

Definition at line 120 of file class.ilFSStorageCourse.php.

120 : string
121 {
122 $file_name = $this->getMemberExportDirectory() . '/' . $a_name;
123
124 if (file_exists($file_name)) {
125 return file_get_contents($file_name);
126 }
127 return '';
128 }

References getMemberExportDirectory().

+ Here is the call graph for this function:

◆ getMemberExportFiles()

ilFSStorageCourse::getMemberExportFiles ( )

Definition at line 88 of file class.ilFSStorageCourse.php.

88 : array
89 {
90 if (!is_dir($this->getMemberExportDirectory())) {
91 return array();
92 }
93 $dp = opendir($this->getMemberExportDirectory());
94
95 $files = [];
96 while ($file = readdir($dp)) {
97 if (is_dir($file)) {
98 continue;
99 }
100
101 if (preg_match(
102 "/^([0-9]{10})_[a-zA-Z]*_export_([a-z]+)_([0-9]+)\.[a-z]+$/",
103 $file,
104 $matches
105 ) && $matches[3] == $this->getContainerId()) {
106 $timest = $matches[1];
107 $file_info['name'] = $matches[0];
108 $file_info['timest'] = $matches[1];
109 $file_info['type'] = $matches[2];
110 $file_info['id'] = $matches[3];
111 $file_info['size'] = filesize($this->getMemberExportDirectory() . '/' . $file);
112
113 $files[$timest] = $file_info;
114 }
115 }
116 closedir($dp);
117 return $files;
118 }

References ilFileSystemAbstractionStorage\getContainerId(), and getMemberExportDirectory().

+ Here is the call graph for this function:

◆ getPathPostfix()

ilFSStorageCourse::getPathPostfix ( )
protected

Implementation of abstract method @access protected.

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 144 of file class.ilFSStorageCourse.php.

144 : string
145 {
146 return 'crs';
147 }

◆ getPathPrefix()

ilFSStorageCourse::getPathPrefix ( )
protected

Implementation of abstract method @access protected.

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 153 of file class.ilFSStorageCourse.php.

153 : string
154 {
155 return 'ilCourse';
156 }

◆ hasMemberExportFile()

ilFSStorageCourse::hasMemberExportFile ( string  $a_export_name)

Definition at line 135 of file class.ilFSStorageCourse.php.

135 : bool
136 {
137 return $this->fileExists($this->getMemberExportDirectory() . '/' . $a_export_name);
138 }

References ilFileSystemAbstractionStorage\fileExists(), and getMemberExportDirectory().

+ Here is the call graph for this function:

◆ initInfoDirectory()

ilFSStorageCourse::initInfoDirectory ( )

Definition at line 57 of file class.ilFSStorageCourse.php.

57 : void
58 {
60 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

References getInfoDirectory(), and ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ initMemberExportDirectory()

ilFSStorageCourse::initMemberExportDirectory ( )

Definition at line 67 of file class.ilFSStorageCourse.php.

67 : void
68 {
70 }

References getMemberExportDirectory(), and ilFileUtils\makeDirParents().

Referenced by addMemberExportFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $logger

ilLogger ilFSStorageCourse::$logger
private

Definition at line 31 of file class.ilFSStorageCourse.php.

◆ ARCHIVE_DIR

const ilFSStorageCourse::ARCHIVE_DIR = 'archives'

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

◆ INFO_DIR

const ilFSStorageCourse::INFO_DIR = 'info'

Definition at line 28 of file class.ilFSStorageCourse.php.

Referenced by getInfoDirectory().

◆ MEMBER_EXPORT_DIR

const ilFSStorageCourse::MEMBER_EXPORT_DIR = 'memberExport'

Definition at line 27 of file class.ilFSStorageCourse.php.

Referenced by getMemberExportDirectory().


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