ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilAssQuestionProcessLockFileStorage Class Reference
+ Inheritance diagram for ilAssQuestionProcessLockFileStorage:
+ Collaboration diagram for ilAssQuestionProcessLockFileStorage:

Public Member Functions

 __construct (int $question_id, int $user_id)
 
 getAbsolutePath ()
 Calculates the full path on the filesystem. More...
 
 getPath ()
 
 create ()
 
- 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

 getPathPrefix ()
 Get path prefix. More...
 
 getPathPostfix ()
 Get directory name. 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 Member Functions

 initSubPath (int $user_id)
 

Private Attributes

string $sub_path
 

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
 
- Protected Attributes inherited from ilFileSystemAbstractionStorage
string $path = null
 
Filesystems $file_system_service
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionProcessLockFileStorage::__construct ( int  $question_id,
int  $user_id 
)

Member Function Documentation

◆ create()

ilAssQuestionProcessLockFileStorage::create ( )

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 74 of file class.ilAssQuestionProcessLockFileStorage.php.

74 : void
75 {
76 set_error_handler(function ($severity, $message, $file, $line): void {
77 throw new ErrorException($message, $severity, 0, $file, $line);
78 });
79
80 try {
81 if (!$this->getFileSystemService()->has($this->getPath())) {
82 $this->getFileSystemService()->createDir($this->getPath());
83 }
84 restore_error_handler();
85 } catch (Exception $e) {
86 restore_error_handler();
87 }
88
89 if (!$this->getFileSystemService()->has($this->path)) {
90 throw new ErrorException(sprintf('Could not find directory: %s', $this->getPath()));
91 }
92 }
has(string $class_name)

References Vendor\Package\$e, ilFileSystemAbstractionStorage\getFileSystemService(), getPath(), and ILIAS\GlobalScreen\has().

+ Here is the call graph for this function:

◆ getAbsolutePath()

ilAssQuestionProcessLockFileStorage::getAbsolutePath ( )

Calculates the full path on the filesystem.

This method is filesystem aware and will create the absolute path if it's not already existing.

Returns
string Absolute filesystem path.
Exceptions
IOExceptionThrown if the absolute path could not be created.

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 63 of file class.ilAssQuestionProcessLockFileStorage.php.

63 : string
64 {
65 return rtrim($this->getLegacyAbsolutePath(), '/') . '/' . $this->sub_path;
66 }
getLegacyAbsolutePath()
Calculates the absolute filesystem storage location.

References $sub_path, and ilFileSystemAbstractionStorage\getLegacyAbsolutePath().

+ Here is the call graph for this function:

◆ getPath()

ilAssQuestionProcessLockFileStorage::getPath ( )

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 69 of file class.ilAssQuestionProcessLockFileStorage.php.

69 : string
70 {
71 return parent::getPath() . '/' . $this->sub_path;
72 }

References $sub_path.

Referenced by create().

+ Here is the caller graph for this function:

◆ getPathPostfix()

ilAssQuestionProcessLockFileStorage::getPathPostfix ( )
protected

Get directory name.

E.g for files => file Only relative path, no trailing slash '_<obj_id>' will be appended automatically

@access protected

Returns
string directory name

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 58 of file class.ilAssQuestionProcessLockFileStorage.php.

58 : string
59 {
60 return 'question';
61 }

◆ getPathPrefix()

ilAssQuestionProcessLockFileStorage::getPathPrefix ( )
protected

Get path prefix.

Prefix that will be prepended to the path No trailing slash. E.g ilFiles for files

@access protected

Returns
string path prefix e.g files

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 44 of file class.ilAssQuestionProcessLockFileStorage.php.

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

◆ initSubPath()

ilAssQuestionProcessLockFileStorage::initSubPath ( int  $user_id)
private

Definition at line 94 of file class.ilAssQuestionProcessLockFileStorage.php.

94 : void
95 {
96 $user_id = (string) $user_id;
97
98 $path = [];
99
100 for ($i = 0, $max = strlen($user_id); $i < $max; $i++) {
101 $path[] = substr($user_id, $i, 1);
102 }
103
104 $this->sub_path = implode('/', $path);
105 }

References ilFileSystemAbstractionStorage\$path, and $user_id.

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $sub_path

string ilAssQuestionProcessLockFileStorage::$sub_path
private

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

Referenced by getAbsolutePath(), and getPath().


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