2018-11-20 23:15:03 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file src/Model/Storage/SystemStorage.php
|
2018-11-21 09:36:31 +01:00
|
|
|
* @brief Storage backend system
|
2018-11-20 23:15:03 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Friendica\Model\Storage;
|
|
|
|
|
2019-02-19 01:56:41 +01:00
|
|
|
use \BadMethodCallException;
|
|
|
|
|
2018-11-20 23:15:03 +01:00
|
|
|
/**
|
|
|
|
* @brief System resource storage class
|
|
|
|
*
|
|
|
|
* This class is used to load system resources, like images.
|
2018-12-14 05:47:22 +01:00
|
|
|
* Is not intended to be selectable by admins as default storage class.
|
2018-11-20 23:15:03 +01:00
|
|
|
*/
|
2018-11-21 09:36:31 +01:00
|
|
|
class SystemResource implements IStorage
|
2018-11-20 23:15:03 +01:00
|
|
|
{
|
|
|
|
// Valid folders to look for resources
|
2018-11-21 15:10:47 +01:00
|
|
|
const VALID_FOLDERS = ["images"];
|
2018-11-20 23:15:03 +01:00
|
|
|
|
2018-11-21 09:36:31 +01:00
|
|
|
public static function get($filename)
|
2018-11-20 23:15:03 +01:00
|
|
|
{
|
|
|
|
$folder = dirname($filename);
|
2018-11-21 15:10:47 +01:00
|
|
|
if (!in_array($folder, self::VALID_FOLDERS)) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
if (!file_exists($filename)) {
|
|
|
|
return "";
|
|
|
|
}
|
2018-11-20 23:15:03 +01:00
|
|
|
return file_get_contents($filename);
|
|
|
|
}
|
|
|
|
|
2018-11-21 09:36:31 +01:00
|
|
|
|
2018-11-21 16:36:29 +01:00
|
|
|
public static function put($data, $filename = "")
|
2018-11-21 09:36:31 +01:00
|
|
|
{
|
2019-02-19 01:56:41 +01:00
|
|
|
throw new BadMethodCallException();
|
2018-11-21 09:36:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function delete($filename)
|
2018-11-20 23:15:03 +01:00
|
|
|
{
|
2019-02-19 01:56:41 +01:00
|
|
|
throw new BadMethodCallException();
|
2018-11-20 23:15:03 +01:00
|
|
|
}
|
2018-11-21 09:36:31 +01:00
|
|
|
|
2018-12-14 05:47:22 +01:00
|
|
|
public static function getOptions()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function saveOptions($data)
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
2018-11-20 23:15:03 +01:00
|
|
|
}
|
|
|
|
|