ILIAS  release_8 Revision v8.23
DelegatingFilesystemFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
13 
14 /******************************************************************************
15  *
16  * This file is part of ILIAS, a powerful learning management system.
17  *
18  * ILIAS is licensed with the GPL-3.0, you should have received a copy
19  * of said license along with the source code.
20  *
21  * If this is not the case or you just want to try ILIAS, you'll find
22  * us at:
23  * https://www.ilias.de
24  * https://github.com/ILIAS-eLearning
25  *
26  *****************************************************************************/
38 {
41 
42 
48  public function __construct(FilenameSanitizer $sanitizer)
49  {
50 
51  /*
52  * ---------- ABSTRACTION SWITCH -------------
53  * Change the factory to switch to another filesystem abstraction!
54  * current: FlySystem from the php league
55  * -------------------------------------------
56  */
57  $this->implementation = new FlySystemFilesystemFactory();
58 
59  $this->sanitizer = $sanitizer;
60  }
61 
62 
66  public function getLocal(LocalConfig $config, bool $read_only = false): Filesystem
67  {
68  if ($read_only) {
69  return new ReadOnlyDecorator(new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer));
70  } else {
71  return new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer);
72  }
73  }
74 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
__construct(FilenameSanitizer $sanitizer)
DelegatingFilesystemFactory constructor.
getLocal(LocalConfig $config, bool $read_only=false)
Class FlySystemFileAccessTest disabled disabled disabled.