]> git.mxchange.org Git - friendica.git/blob - src/Model/Storage/SystemResource.php
Add IStorage interface
[friendica.git] / src / Model / Storage / SystemResource.php
1 <?php
2 /**
3  * @file src/Model/Storage/SystemStorage.php
4  * @brief Storage backend system
5  */
6
7 namespace Friendica\Model\Storage;
8
9 /**
10  * @brief System resource storage class
11  *
12  * This class is used to load system resources, like images.
13  * Is not itended to be selectable by admins as default storage class.
14  */
15 class SystemResource implements IStorage
16 {
17         // Valid folders to look for resources
18         const VALID_FOLDERS = [ "images" ];
19
20         public static function get($filename)
21         {
22                 $folder = dirname($filename);
23                 if (!in_array($folder, self::VALID_FOLDERS)) return "";
24                 if (!file_exists($filename)) return "";
25                 return file_get_contents($filename);
26         }
27
28
29         public static function put($data, $filename=null)
30         {
31                 throw new \BadMethodCallException();
32         }
33
34         public static function delete($filename)
35         {
36                 throw new \BadMethodCallException();
37         }
38
39 }
40