ILIAS  release_8 Revision v8.23
class.ilSecurePathDefinitionProcessor.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 {
23  protected \ilDBInterface $db;
24  protected ?string $component = null;
25 
26  public function __construct(\ilDBInterface $db)
27  {
28  $this->db = $db;
29  }
30 
31  public function purge(): void
32  {
33  }
34 
35  public function beginComponent(string $component, string $type): void
36  {
37  $this->component = $type . "/" . $component;
38  }
39 
40  public function endComponent(string $component, string $type): void
41  {
42  }
43 
44  public function beginTag(string $name, array $attributes): void
45  {
46  if ($name !== "secure_path") {
47  return;
48  }
49 
50  try {
51  $ilWACSecurePath = ilWACSecurePath::findOrFail($attributes["path"]);
52  } catch (arException $e) {
53  $ilWACSecurePath = new ilWACSecurePath();
54  $ilWACSecurePath->setPath($attributes["path"]);
55  $ilWACSecurePath->create();
56  }
57  $ilWACSecurePath->setCheckingClass($attributes["checking-class"]);
58  $ilWACSecurePath->setInSecFolder((bool) ($attributes["in-sec-folder"] ?? null));
59  $ilWACSecurePath->setComponentDirectory(realpath(__DIR__ . "/../../../../" . $this->component));
60  $ilWACSecurePath->update();
61  }
62 
63  public function endTag(string $name): void
64  {
65  }
66 }
$attributes
Definition: metadata.php:248
beginComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component starts.
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i.e.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($format !==null) $name
Definition: metadata.php:247
beginTag(string $name, array $attributes)
This is called when a tag starts in the context of the given component.
static findOrFail($primary_key, array $add_constructor_args=array())
Tries to find the object and throws an Exception if object is not found, instead of returning null...
endComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component ends. ...
purge()
This methods is supposed to purge existing data in the provider of the component, so new components c...
Class arException.
endTag(string $name)
This is called when a tag ends in the context of the given component.