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                 if ($this->cdata === 
'') {
   220                 $this->file->setFilename($this->cdata);
   221                 $this->file->setTitle($this->cdata);
   225                 $this->file->setTitle(trim($this->cdata));
   228                 $this->file->setDescription(trim($this->cdata));
   231                 $this->file->setRating((
bool) $this->cdata);
   235                 if ($a_name === 
"Version" && $this->version === null) {
   242                     $this->tmpFilename = $this->
getImportDirectory() . 
"/" . self::normalizeRelativePath($this->cdata);
   246                     $this->tmpFilename = $storage->getStoredFilePath(self::normalizeRelativePath($this->cdata));
   250                     $this->tmpFilename = $baseDecodedFilename;
   257                         if (!$this->
fastGunzip($baseDecodedFilename, $this->tmpFilename)) {
   259                                 "Deflating with fastzunzip failed",
   263                         unlink($baseDecodedFilename);
   265                         if (!$this->
fastGunzip($baseDecodedFilename, $this->tmpFilename)) {
   267                                 "Deflating with fastDecompress failed",
   271                         unlink($baseDecodedFilename);
   273                         $this->tmpFilename = $baseDecodedFilename;
   280                 if ($this->version == $this->file->getVersion()) {
   281                     if (is_file($this->tmpFilename)) {
   282                         $this->file->setFileSize(filesize($this->tmpFilename)); 
   286                     if (!$this->file->getFileType()) {
   288                         $this->file->setFileType(MimeType::getMimeType($this->tmpFilename));
   292                 $this->versions[] = [
   300                 $this->version = null;
   302                 $this->usr_id = null;
   317         if ($a_data != 
"\n") {
   322                 $this->cdata .= $a_data;
   324                 $this->cdata .= $a_data;
   339         foreach ($this->versions as $version) {
   340             if (!file_exists($version[
"tmpFilename"])) {
   341                 if (!isset($version[
"tmpFilename"])) {
   345                 $files = scandir(dirname($version[
"tmpFilename"]));
   346                 $version[
"tmpFilename"] = rtrim(
   347                     dirname($version[
"tmpFilename"]),
   350                 if (!file_exists($version[
"tmpFilename"])) {
   352                         __METHOD__ . 
' "' . ($version[
"tmpFilename"]) . 
'" file not found.'   359             if (filesize($version[
"tmpFilename"]) == 0) {
   364             $import_file_version_path = $version[
"tmpFilename"];
   366             $stream = Streams::ofResource(fopen($import_file_version_path, 
'rb'));
   367             $this->file->appendStream($stream, $this->file->getTitle());
   392         return $this->result > 0;
   407         $path = str_replace(
'\\', 
'/', $path);
   409         while (preg_match(
'#\p{C}+|^\./#u', $path)) {
   410             $path = preg_replace(
'#\p{C}+|^\./#u', 
'', $path);
   414         foreach (explode(
'/', $path) as $part) {
   428         return implode(
'/', 
$parts);
   433         $fh = fopen($filein, 
'rb');
   434         $fh2 = fopen($fileout, 
'wb');
   435         stream_filter_append($fh2, 
'convert.base64-decode');
   439             if ($chunk === 
false) {
   442             fwrite($fh2, $chunk);
   452         if (!file_exists($in)) {
   455         if (!is_readable($in)) {
   458         if (!file_exists($out) && !is_writable(dirname($out))) {
   461         if (file_exists($out) && !is_writable($out)) {
   464         $in_file = gzopen($in, 
"rb");
   465         $out_file = fopen($out, 
"wb");
   467         while (!gzeof($in_file)) {
   468             $buffer = gzread($in_file, 4096);
   469             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. 
 
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...