- Add notice in admin if setting value change failed
- Add notice in console if setting value change failed
* @var $storagebackend \Friendica\Model\Storage\IStorage
*/
$storagebackend = Strings::escapeTags(trim(defaults($_POST, 'storagebackend', '')));
- StorageManager::setBackend($storagebackend);
+ if (!StorageManager::setBackend($storagebackend)) {
+ info(L10n::t('Invalid storage backend setting value.'));
+ }
// save storage backend form
if (!is_null($storagebackend) && $storagebackend != "") {
return -1;
}
- StorageManager::setBackend($class);
+ if (!StorageManager::setBackend($class)) {
+ $this->out($class . ' is not a valid backend storage class.');
+ return -1;
+ }
+
return 0;
}
* @brief Set current storage backend class
*
* @param string $class Backend class name
+ * @return bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function setBackend($class)
{
- /// @todo Check that $class implements IStorage
+ if (!in_array('Friendica\Model\Storage\IStorage', class_implements($class))) {
+ return false;
+ }
+
Config::set('storage', 'class', $class);
+
+ return true;
}
/**