ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
DelegatingFilesystemFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 
38 {
40 
44  public function __construct(private FilenameSanitizer $sanitizer)
45  {
46  /*
47  * ---------- ABSTRACTION SWITCH -------------
48  * Change the factory to switch to another filesystem abstraction!
49  * current: FlySystem from the php league
50  * -------------------------------------------
51  */
52  $this->implementation = new FlySystemFilesystemFactory();
53  }
54 
58  public function getLocal(LocalConfig $config, bool $read_only = false): Filesystem
59  {
60  if ($read_only) {
61  return new ReadOnlyDecorator(
62  new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer)
63  );
64  }
65  return new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer);
66  }
67 }
The filesystem ready only decorator provides read only access and will throw an Exception whenever co...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
The filesystem white list decorator rewrites forbidden file endings and delegates the rest of the ope...
__construct(private FilenameSanitizer $sanitizer)
DelegatingFilesystemFactory constructor.
The delegating filesystem factory delegates the instance creation to the factory of the concrete impl...
getLocal(LocalConfig $config, bool $read_only=false)
The filename sanitizer verifies and fixes file name endings.
This class is used to configure the local filesystem adapter.
Definition: LocalConfig.php:29