ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFSStorageGroup 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 ilFSStorageGroup:
+ Collaboration diagram for ilFSStorageGroup:

Public Member Functions

 __construct (int $a_container_id=0)
 
 initMemberExportDirectory ()
 Init export directory and create it if it does not exist. More...
 
 getMemberExportDirectory ()
 Get path of export directory. More...
 
 addMemberExportFile (string $a_data, string $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 ()
 

Protected Member Functions

 getPathPostfix ()
 
 getPathPrefix ()
 
- 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 ()
 

Protected Attributes

const MEMBER_EXPORT_DIR = 'memberExport'
 
- Protected Attributes inherited from ilFileSystemAbstractionStorage
string $path = null
 
ILIAS Filesystem Filesystems $file_system_service
 

Private Attributes

ilLogger $logger
 

Additional Inherited Members

- 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 inherited from ilFileSystemAbstractionStorage
const STORAGE_WEB = 1
 
const STORAGE_DATA = 2
 
const STORAGE_SECURED = 3
 

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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilFSStorageGroup::__construct ( int  $a_container_id = 0)

Definition at line 35 of file class.ilFSStorageGroup.php.

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

36  {
37  global $DIC;
38 
39  $this->logger = $DIC->logger()->grp();
41  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addMemberExportFile()

ilFSStorageGroup::addMemberExportFile ( string  $a_data,
string  $a_rel_name 
)

Definition at line 59 of file class.ilFSStorageGroup.php.

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

59  : bool
60  {
62  if (!$this->writeToFile($a_data, $this->getMemberExportDirectory() . '/' . $a_rel_name)) {
63  $this->logger->warning('Cannot write to file: ' . $this->getMemberExportDirectory() . '/' . $a_rel_name);
64  return false;
65  }
66  return true;
67  }
getMemberExportDirectory()
Get path of export directory.
initMemberExportDirectory()
Init export directory and create it if it does not exist.
+ Here is the call graph for this function:

◆ deleteMemberExportFile()

ilFSStorageGroup::deleteMemberExportFile ( string  $a_export_name)

Definition at line 111 of file class.ilFSStorageGroup.php.

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

111  : bool
112  {
113  return $this->deleteFile($this->getMemberExportDirectory() . '/' . $a_export_name);
114  }
getMemberExportDirectory()
Get path of export directory.
+ Here is the call graph for this function:

◆ getMemberExportDirectory()

ilFSStorageGroup::getMemberExportDirectory ( )

Get path of export directory.

Definition at line 54 of file class.ilFSStorageGroup.php.

References ilFileSystemAbstractionStorage\getAbsolutePath().

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

54  : string
55  {
56  return $this->getAbsolutePath() . '/' . self::MEMBER_EXPORT_DIR;
57  }
getAbsolutePath()
Calculates the full path on the filesystem.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMemberExportFile()

ilFSStorageGroup::getMemberExportFile ( string  $a_name)

Definition at line 102 of file class.ilFSStorageGroup.php.

References getMemberExportDirectory().

102  : string
103  {
104  $file_name = $this->getMemberExportDirectory() . '/' . $a_name;
105  if (file_exists($file_name)) {
106  return file_get_contents($file_name);
107  }
108  return '';
109  }
getMemberExportDirectory()
Get path of export directory.
+ Here is the call graph for this function:

◆ getMemberExportFiles()

ilFSStorageGroup::getMemberExportFiles ( )
Returns
array<int, array{name: string, timest: string, type: string, id: string, size: int}>

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

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

72  : array
73  {
74  if (!is_dir($this->getMemberExportDirectory())) {
75  return [];
76  }
77 
78  $dp = opendir($this->getMemberExportDirectory());
79  $files = [];
80  while ($file = readdir($dp)) {
81  if (is_dir($file)) {
82  continue;
83  }
84 
85  if (
86  preg_match("/^([0-9]{10})_[a-zA-Z]*_export_([a-z]+)_([0-9]+)\.[a-z]+$/", $file, $matches) &&
87  $matches[3] == $this->getContainerId()) {
88  $timest = $matches[1];
89  $file_info['name'] = $matches[0];
90  $file_info['timest'] = $matches[1];
91  $file_info['type'] = $matches[2];
92  $file_info['id'] = $matches[3];
93  $file_info['size'] = filesize($this->getMemberExportDirectory() . '/' . $file);
94 
95  $files[$timest] = $file_info;
96  }
97  }
98  closedir($dp);
99  return $files;
100  }
getMemberExportDirectory()
Get path of export directory.
+ Here is the call graph for this function:

◆ getPathPostfix()

ilFSStorageGroup::getPathPostfix ( )
protected

Definition at line 124 of file class.ilFSStorageGroup.php.

124  : string
125  {
126  return 'grp';
127  }

◆ getPathPrefix()

ilFSStorageGroup::getPathPrefix ( )
protected

Definition at line 132 of file class.ilFSStorageGroup.php.

132  : string
133  {
134  return 'ilGroup';
135  }

◆ hasMemberExportFile()

ilFSStorageGroup::hasMemberExportFile ( string  $a_export_name)

Definition at line 116 of file class.ilFSStorageGroup.php.

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

116  : bool
117  {
118  return $this->fileExists($this->getMemberExportDirectory() . '/' . $a_export_name);
119  }
getMemberExportDirectory()
Get path of export directory.
+ Here is the call graph for this function:

◆ initMemberExportDirectory()

ilFSStorageGroup::initMemberExportDirectory ( )

Init export directory and create it if it does not exist.

Definition at line 46 of file class.ilFSStorageGroup.php.

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

Referenced by addMemberExportFile().

46  : void
47  {
49  }
getMemberExportDirectory()
Get path of export directory.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $logger

ilLogger ilFSStorageGroup::$logger
private

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

◆ MEMBER_EXPORT_DIR

const ilFSStorageGroup::MEMBER_EXPORT_DIR = 'memberExport'
protected

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


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