ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilFSStoragePRG Class Reference

store prg-files More...

+ Inheritance diagram for ilFSStoragePRG:
+ Collaboration diagram for ilFSStoragePRG:

Public Member Functions

 __construct (int $a_container_id=0)
 
 getMemberExportDirectory ()
 
 initMemberExportDirectory ()
 
 getMemberExportFiles ()
 
 getMemberExportFile (string $filename)
 
 addMemberExportFile ($a_data, $a_rel_name)
 
 deleteMemberExportFile (string $filename)
 
 hasMemberExportFile (string $filename)
 
- 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 = 'assingmentsExport'
 
- Protected Attributes inherited from ilFileSystemAbstractionStorage
string $path = null
 
Filesystems $file_system_service
 

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

store prg-files

Definition at line 24 of file ilFSStoragePRG.php.

Constructor & Destructor Documentation

◆ __construct()

ilFSStoragePRG::__construct ( int  $a_container_id = 0)

Definition at line 28 of file ilFSStoragePRG.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilFileSystemAbstractionStorage\STORAGE_DATA.

+ Here is the call graph for this function:

Member Function Documentation

◆ addMemberExportFile()

ilFSStoragePRG::addMemberExportFile (   $a_data,
  $a_rel_name 
)

Definition at line 105 of file ilFSStoragePRG.php.

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

105  : bool
106  {
107  $this->initMemberExportDirectory();
108  if (!$this->writeToFile($a_data, $this->getMemberExportDirectory() . '/' . $a_rel_name)) {
109  $this->logger->write('Cannot write to file: ' . $this->getMemberExportDirectory() . '/' . $a_rel_name);
110  return false;
111  }
112 
113  return true;
114  }
+ Here is the call graph for this function:

◆ deleteMemberExportFile()

ilFSStoragePRG::deleteMemberExportFile ( string  $filename)

Definition at line 116 of file ilFSStoragePRG.php.

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

116  : bool
117  {
118  return $this->deleteFile($this->getMemberExportDirectory() . '/' . $filename);
119  }
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ getMemberExportDirectory()

ilFSStoragePRG::getMemberExportDirectory ( )

Definition at line 49 of file ilFSStoragePRG.php.

References ilFileSystemAbstractionStorage\getAbsolutePath().

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

49  : string
50  {
51  return $this->getAbsolutePath() . '/' . self::MEMBER_EXPORT_DIR;
52  }
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()

ilFSStoragePRG::getMemberExportFile ( string  $filename)

Definition at line 93 of file ilFSStoragePRG.php.

References $filename, and getMemberExportDirectory().

93  : string
94  {
95  $file_name = $this->getMemberExportDirectory() . '/' . $filename;
96 
97  if (file_exists($file_name)) {
98  return file_get_contents($file_name);
99  } else {
100  throw new \Exception('file not found:' . $filename);
101  }
102  return '';
103  }
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ getMemberExportFiles()

ilFSStoragePRG::getMemberExportFiles ( )

Definition at line 59 of file ilFSStoragePRG.php.

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

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

◆ getPathPostfix()

ilFSStoragePRG::getPathPostfix ( )
protected

Definition at line 36 of file ilFSStoragePRG.php.

36  : string
37  {
38  return 'prg';
39  }

◆ getPathPrefix()

ilFSStoragePRG::getPathPrefix ( )
protected

Definition at line 44 of file ilFSStoragePRG.php.

44  : string
45  {
46  return 'StudyProgramme';
47  }

◆ hasMemberExportFile()

ilFSStoragePRG::hasMemberExportFile ( string  $filename)

Definition at line 121 of file ilFSStoragePRG.php.

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

121  : bool
122  {
123  return $this->fileExists($this->getMemberExportDirectory() . '/' . $filename);
124  }
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ initMemberExportDirectory()

ilFSStoragePRG::initMemberExportDirectory ( )

Definition at line 54 of file ilFSStoragePRG.php.

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

Referenced by addMemberExportFile().

54  : void
55  {
57  }
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

◆ MEMBER_EXPORT_DIR

const ilFSStoragePRG::MEMBER_EXPORT_DIR = 'assingmentsExport'
protected

Definition at line 26 of file ilFSStoragePRG.php.


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