71         public int $obj_id = -1,
    88         $this->import_directory = $a_val;
   110         xml_set_object($a_xml_parser, $this);
   111         xml_set_element_handler($a_xml_parser, 
'handlerBeginTag', 
'handlerEndTag');
   112         xml_set_character_data_handler($a_xml_parser, 
'handlerCharacterData');
   125     public function handlerBeginTag($a_xml_parser, 
string $a_name, array $a_attribs): void
   133                 if (isset($a_attribs[
"obj_id"])) {
   135                     if ($this->obj_id != -1 && (
int) $read_obj_id != -1 && $this->obj_id != (
int) $read_obj_id) {
   137                             "Object IDs (xml $read_obj_id and argument " . $this->obj_id . 
") do not match!",
   146                 if ($a_name === 
"Version" && !isset($a_attribs[
"mode"])) {
   148                     $this->version = null;
   149                     if ($this->date === null) {
   151                         $this->date = $a_attribs[
"date"];
   152                         $this->usr_id = (
int) $a_attribs[
"usr_id"];
   160                 #echo $a_attribs["mode"];   161                 if (isset($a_attribs[
"mode"])) {
   162                     if ($a_attribs[
"mode"] == 
"GZIP") {
   163                         if (!function_exists(
"gzread")) {
   165                                 "Deflating with gzip is not supported",
   171                     } elseif ($a_attribs[
"mode"] == 
"ZLIB") {
   172                         if (!function_exists(
"gzuncompress")) {
   174                                 "Deflating with zlib (compress/uncompress) is not supported",
   180                     } elseif ($a_attribs[
"mode"] == 
"COPY") {
   183                     elseif ($a_attribs[
'mode'] == 
'REST') {
   189                 if ($a_name === 
"Version") {
   190                     $this->version = (
int) $a_attribs[
"version"];
   191                     $this->max_version = (
int) $a_attribs[
"max_version"];
   192                     $this->date = (
int) $a_attribs[
"date"];
   193                     $this->usr_id = (
int) $a_attribs[
"usr_id"];
   194                     $this->action = (string) $a_attribs[
"action"];
   207         $this->cdata = trim($this->cdata ?? 
'');
   209         $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': ' . $this->cdata);
   213                 $this->result = 
true;
   216                 $this->file->setFilename($this->cdata ?? 
'unkown');
   217                 $this->file->setTitle($this->cdata ?? 
'unkown');
   221                 $this->file->setTitle(trim($this->cdata));
   224                 $this->file->setDescription(trim($this->cdata));
   227                 $this->file->setRating((
bool) $this->cdata);
   231                 if ($a_name === 
"Version" && $this->version === null) {
   238                     $this->tmpFilename = $this->
getImportDirectory() . 
"/" . self::normalizeRelativePath($this->cdata);
   242                     $this->tmpFilename = $storage->getStoredFilePath(self::normalizeRelativePath($this->cdata));
   246                     $this->tmpFilename = $baseDecodedFilename;
   253                         if (!$this->
fastGunzip($baseDecodedFilename, $this->tmpFilename)) {
   255                                 "Deflating with fastzunzip failed",
   259                         unlink($baseDecodedFilename);
   261                         if (!$this->
fastGunzip($baseDecodedFilename, $this->tmpFilename)) {
   263                                 "Deflating with fastDecompress failed",
   267                         unlink($baseDecodedFilename);
   269                         $this->tmpFilename = $baseDecodedFilename;
   276                 if ($this->version == $this->file->getVersion()) {
   277                     if (is_file($this->tmpFilename)) {
   278                         $this->file->setFileSize(filesize($this->tmpFilename)); 
   282                     if (!$this->file->getFileType()) {
   284                         $this->file->setFileType(MimeType::getMimeType($this->tmpFilename));
   288                 $this->versions[] = [
   296                 $this->version = null;
   298                 $this->usr_id = null;
   313         if ($a_data != 
"\n") {
   318                 $this->cdata .= $a_data;
   320                 $this->cdata .= $a_data;
   335         foreach ($this->versions as $version) {
   336             if (!file_exists($version[
"tmpFilename"])) {
   337                 if (!isset($version[
"tmpFilename"])) {
   341                 $files = scandir(dirname($version[
"tmpFilename"]));
   342                 $version[
"tmpFilename"] = rtrim(
   343                     dirname($version[
"tmpFilename"]),
   346                 if (!file_exists($version[
"tmpFilename"])) {
   348                         __METHOD__ . 
' "' . ($version[
"tmpFilename"]) . 
'" file not found.'   355             if (filesize($version[
"tmpFilename"]) == 0) {
   360             $import_file_version_path = $version[
"tmpFilename"];
   362             $stream = Streams::ofResource(fopen($import_file_version_path, 
'rb'));
   363             $this->file->appendStream($stream, $this->file->getTitle());
   388         return $this->result > 0;
   403         $path = str_replace(
'\\', 
'/', $path);
   405         while (preg_match(
'#\p{C}+|^\./#u', $path)) {
   406             $path = preg_replace(
'#\p{C}+|^\./#u', 
'', $path);
   410         foreach (explode(
'/', $path) as $part) {
   424         return implode(
'/', 
$parts);
   429         $fh = fopen($filein, 
'rb');
   430         $fh2 = fopen($fileout, 
'wb');
   431         stream_filter_append($fh2, 
'convert.base64-decode');
   435             if ($chunk === 
false) {
   438             fwrite($fh2, $chunk);
   448         if (!file_exists($in)) {
   451         if (!is_readable($in)) {
   454         if (!file_exists($out) && !is_writable(dirname($out))) {
   457         if (file_exists($out) && !is_writable($out)) {
   460         $in_file = gzopen($in, 
"rb");
   461         $out_file = fopen($out, 
"wb");
   463         while (!gzeof($in_file)) {
   464             $buffer = gzread($in_file, 4096);
   465             fwrite($out_file, $buffer, 4096);
 
fastGunzip(string $in, string $out)
 
handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs)
handler for begin of element 
 
static getLogger(string $a_component_id)
Get component logger. 
 
startParsing()
stores xml data in array 
 
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
 
fastBase64Decode(string $filein, string $fileout)
 
handlerEndTag($a_xml_parser, string $a_name)
handler for end of element 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
start()
starts parsing an changes object by side effect. 
 
static int $DECOMPRESSION_FAILED
 
__construct(public ilObjFile $file, string $a_xml_data, public int $obj_id=-1, public int $mode=0)
Constructor. 
 
static _removeEntriesForObject(int $a_obj_id)
remove all history entries for an object 
 
string $tmpFilename
file of temporary file where we store the file content instead of in memory 
 
static int $CONTENT_GZ_COMPRESSED
 
handlerCharacterData($a_xml_parser, string $a_data)
handler for character data 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static int $CONTENT_NOT_COMPRESSED
 
static normalizeRelativePath(string $path)
Normalize relative directories in a path. 
 
static int $CONTENT_ZLIB_COMPRESSED
 
setHandlers($a_xml_parser)
set event handlers 
 
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory. 
 
setImportDirectory(?string $a_val)
Set import directory. 
 
updateFileContents()
update file according to filename and version and create history entry has to be called after (!) fil...
 
static int $ID_DEFLATE_METHOD_MISMATCH
 
static __extractId(string $ilias_id, int $inst_id)
extract ref id from role title, e.g. 
 
__construct(Container $dic, ilPlugin $plugin)
 
getImportDirectory()
Get import directory. 
 
bool $result
result of parsing and updating 
 
setXMLContent(string $a_xml_content)
 
setFileContents()
update file according to filename and version, does not update history has to be called after (!) fil...