ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DelegatingFilesystemFactory.php
Go to the documentation of this file.
1<?php
2
19declare(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 white list decorator rewrites forbidden file endings and delegates the rest of the ope...
The filesystem ready only decorator provides read only access and will throw an Exception whenever co...
This class is used to configure the local filesystem adapter.
Definition: LocalConfig.php:30
The delegating filesystem factory delegates the instance creation to the factory of the concrete impl...
getLocal(LocalConfig $config, bool $read_only=false)
@inheritDoc
__construct(private FilenameSanitizer $sanitizer)
DelegatingFilesystemFactory constructor.
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37
The filename sanitizer verifies and fixes file name endings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...