ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilFSStorageGroup Class Reference
+ 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

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

\

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

Constructor & Destructor Documentation

◆ __construct()

ilFSStorageGroup::__construct ( int  $a_container_id = 0)

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

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

32  {
33  global $DIC;
34 
35  $this->logger = $DIC->logger()->grp();
37  }
global $DIC
Definition: shib_login.php:25
__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 55 of file class.ilFSStorageGroup.php.

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

55  : bool
56  {
58  if (!$this->writeToFile($a_data, $this->getMemberExportDirectory() . '/' . $a_rel_name)) {
59  $this->logger->warning('Cannot write to file: ' . $this->getMemberExportDirectory() . '/' . $a_rel_name);
60  return false;
61  }
62  return true;
63  }
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 107 of file class.ilFSStorageGroup.php.

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

107  : bool
108  {
109  return $this->deleteFile($this->getMemberExportDirectory() . '/' . $a_export_name);
110  }
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 50 of file class.ilFSStorageGroup.php.

References ilFileSystemAbstractionStorage\getAbsolutePath().

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

50  : string
51  {
52  return $this->getAbsolutePath() . '/' . self::MEMBER_EXPORT_DIR;
53  }
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 98 of file class.ilFSStorageGroup.php.

References getMemberExportDirectory().

98  : string
99  {
100  $file_name = $this->getMemberExportDirectory() . '/' . $a_name;
101  if (file_exists($file_name)) {
102  return file_get_contents($file_name);
103  }
104  return '';
105  }
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 68 of file class.ilFSStorageGroup.php.

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

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

◆ getPathPostfix()

ilFSStorageGroup::getPathPostfix ( )
protected

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

120  : string
121  {
122  return 'grp';
123  }

◆ getPathPrefix()

ilFSStorageGroup::getPathPrefix ( )
protected

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

128  : string
129  {
130  return 'ilGroup';
131  }

◆ hasMemberExportFile()

ilFSStorageGroup::hasMemberExportFile ( string  $a_export_name)

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

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

112  : bool
113  {
114  return $this->fileExists($this->getMemberExportDirectory() . '/' . $a_export_name);
115  }
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 42 of file class.ilFSStorageGroup.php.

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

Referenced by addMemberExportFile().

42  : void
43  {
45  }
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 29 of file class.ilFSStorageGroup.php.

◆ MEMBER_EXPORT_DIR

const ilFSStorageGroup::MEMBER_EXPORT_DIR = 'memberExport'
protected

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


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