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