namespace Friendica\Core;
use Friendica\Database\DBA;
-use Friendica\Core\Config;
-use Friendica\Core\Logger;
-
+use Friendica\Model\Storage\IStorage;
/**
/**
* @brief Return current storage backend class
* @return string
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getBackend()
{
/**
* @brief Set current storage backend class
*
- * @param string $class Backend class name
+ * @param string $class Backend class name
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function setBackend($class)
{
}
-
/**
* @brief Register a storage backend class
*
- * @param string $name User readable backend name
- * @param string $class Backend class name
+ * @param string $name User readable backend name
+ * @param string $class Backend class name
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function register($name, $class)
{
/**
* @brief Unregister a storage backend class
*
- * @param string $name User readable backend name
+ * @param string $name User readable backend name
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function unregister($name)
{
* @param string $dest Destination storage class name
* @param array $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach']
*
- * @retur int Number of moved resources
+ * @throws \Exception
+ * @return int Number of moved resources
*/
public static function move($dest, $tables = null)
{
if (is_null($dest) || empty($dest)) {
- throw Exception('Can\'t move to NULL storage backend');
+ throw new \Exception('Can\'t move to NULL storage backend');
}
if (is_null($tables)) {
while($r = DBA::fetch($rr)) {
$id = $r['id'];
$data = $r['data'];
+ /** @var IStorage $backendClass */
$backendClass = $r['backend-class'];
$backendRef = $r['backend-ref'];
if (!is_null($backendClass) && $backendClass !== '') {
}
Logger::log("save data to new backend " . $dest);
+ /** @var IStorage $dest */
$ref = $dest::put($data);
Logger::log("saved data as " . $ref);