ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilFSStorageCourse Class Reference
+ 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 (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 ()
 

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 protected. More...
 
 getPathPrefix ()
 Implementation of abstract method 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
 
Filesystems $file_system_service
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilFSStorageCourse::__construct ( int  $a_container_id = 0)

PhpUndefinedMethodInspection

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

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

33  {
34  global $DIC;
35 
37  $this->logger = $DIC->logger()->crs();
39  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ 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 41 of file class.ilFSStorageCourse.php.

References ilFileSystemAbstractionStorage\_copyDirectory().

41  : bool
42  {
43  $source = new ilFSStorageCourse($a_source_id);
44  $target = new ilFSStorageCourse($a_target_id);
45  $target->create();
46  ilFileSystemAbstractionStorage::_copyDirectory($source->getAbsolutePath(), $target->getAbsolutePath());
47 
48  // Delete member export files
49  $target->deleteDirectory($target->getMemberExportDirectory());
50 
51  unset($source);
52  unset($target);
53  return true;
54  }
static _copyDirectory(string $a_sdir, string $a_tdir)
+ Here is the call graph for this function:

◆ addMemberExportFile()

ilFSStorageCourse::addMemberExportFile (   $a_data,
  $a_rel_name 
)

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

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

76  : bool
77  {
79  if (!$this->writeToFile($a_data, $this->getMemberExportDirectory() . '/' . $a_rel_name)) {
80  $this->logger->write('Cannot write to file: ' . $this->getMemberExportDirectory() . '/' . $a_rel_name);
81  return false;
82  }
83 
84  return true;
85  }
+ Here is the call graph for this function:

◆ deleteMemberExportFile()

ilFSStorageCourse::deleteMemberExportFile ( string  $a_export_name)

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

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

129  : bool
130  {
131  return $this->deleteFile($this->getMemberExportDirectory() . '/' . $a_export_name);
132  }
+ Here is the call graph for this function:

◆ getInfoDirectory()

ilFSStorageCourse::getInfoDirectory ( )

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

References ilFileSystemAbstractionStorage\getAbsolutePath().

Referenced by initInfoDirectory().

61  : string
62  {
63  return $this->getAbsolutePath() . '/' . self::INFO_DIR;
64  }
getAbsolutePath()
Calculates the full path on the filesystem.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMemberExportDirectory()

ilFSStorageCourse::getMemberExportDirectory ( )

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

References ilFileSystemAbstractionStorage\getAbsolutePath().

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

71  : string
72  {
73  return $this->getAbsolutePath() . '/' . self::MEMBER_EXPORT_DIR;
74  }
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()

ilFSStorageCourse::getMemberExportFile ( string  $a_name)

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

References getMemberExportDirectory().

119  : string
120  {
121  $file_name = $this->getMemberExportDirectory() . '/' . $a_name;
122 
123  if (file_exists($file_name)) {
124  return file_get_contents($file_name);
125  }
126  return '';
127  }
+ Here is the call graph for this function:

◆ getMemberExportFiles()

ilFSStorageCourse::getMemberExportFiles ( )

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

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

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

◆ getPathPostfix()

ilFSStorageCourse::getPathPostfix ( )
protected

Implementation of abstract method protected.

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

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

◆ getPathPrefix()

ilFSStorageCourse::getPathPrefix ( )
protected

Implementation of abstract method protected.

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

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

◆ hasMemberExportFile()

ilFSStorageCourse::hasMemberExportFile ( string  $a_export_name)

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

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

134  : bool
135  {
136  return $this->fileExists($this->getMemberExportDirectory() . '/' . $a_export_name);
137  }
+ Here is the call graph for this function:

◆ initInfoDirectory()

ilFSStorageCourse::initInfoDirectory ( )

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

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

56  : void
57  {
59  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:

◆ initMemberExportDirectory()

ilFSStorageCourse::initMemberExportDirectory ( )

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

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

Referenced by addMemberExportFile().

66  : void
67  {
69  }
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 ilFSStorageCourse::$logger
private

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

◆ ARCHIVE_DIR

const ilFSStorageCourse::ARCHIVE_DIR = 'archives'

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

◆ INFO_DIR

const ilFSStorageCourse::INFO_DIR = 'info'

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

◆ MEMBER_EXPORT_DIR

const ilFSStorageCourse::MEMBER_EXPORT_DIR = 'memberExport'

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


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