friendica_2021-01/src/Model/Storage/SystemResource.php

45 lines
853 B
PHP
Raw Normal View History

<?php
/**
* @file src/Model/Storage/SystemStorage.php
* @brief Storage backend system
*/
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.
*/
class SystemResource implements IStorage
{
// Valid folders to look for resources
2018-11-21 15:10:47 +01:00
const VALID_FOLDERS = ["images"];
public static function get($filename)
{
$folder = dirname($filename);
2018-11-21 15:10:47 +01:00
if (!in_array($folder, self::VALID_FOLDERS)) {
return "";
}
if (!file_exists($filename)) {
return "";
}
return file_get_contents($filename);
}
2018-11-21 15:10:47 +01:00
public static function put($data, $filename="")
{
throw new \BadMethodCallException();
}
public static function delete($filename)
{
throw new \BadMethodCallException();
}
}