ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (private int $storage_type, private bool $path_conversion, private int $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
 
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 28 of file class.ilFSStorageGroup.php.

Constructor & Destructor Documentation

◆ __construct()

ilFSStorageGroup::__construct ( int  $a_container_id = 0)

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

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

35  {
36  global $DIC;
37 
38  $this->logger = $DIC->logger()->grp();
40  }
global $DIC
Definition: shib_login.php:22
__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 58 of file class.ilFSStorageGroup.php.

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

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

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

110  : bool
111  {
112  return $this->deleteFile($this->getMemberExportDirectory() . '/' . $a_export_name);
113  }
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 53 of file class.ilFSStorageGroup.php.

References ilFileSystemAbstractionStorage\getAbsolutePath().

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

53  : string
54  {
55  return $this->getAbsolutePath() . '/' . self::MEMBER_EXPORT_DIR;
56  }
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 101 of file class.ilFSStorageGroup.php.

References getMemberExportDirectory().

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

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

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

◆ getPathPostfix()

ilFSStorageGroup::getPathPostfix ( )
protected

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

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

◆ getPathPrefix()

ilFSStorageGroup::getPathPrefix ( )
protected

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

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

◆ hasMemberExportFile()

ilFSStorageGroup::hasMemberExportFile ( string  $a_export_name)

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

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

115  : bool
116  {
117  return $this->fileExists($this->getMemberExportDirectory() . '/' . $a_export_name);
118  }
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 45 of file class.ilFSStorageGroup.php.

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

Referenced by addMemberExportFile().

45  : void
46  {
48  }
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 32 of file class.ilFSStorageGroup.php.

◆ MEMBER_EXPORT_DIR

const ilFSStorageGroup::MEMBER_EXPORT_DIR = 'memberExport'
protected

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


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