]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/StorageManager.php
Check that provided class implements IStorage in StorageManager::setBackend
[friendica.git] / src / Core / StorageManager.php
index ef6cef480a355c28f2f3dace16914a163ec18c45..3bb1cc4511161960dcbc47aec33634eba7c8895f 100644 (file)
@@ -23,7 +23,7 @@ class StorageManager
 
        private static function setup()
        {
-               if (count(self::$backends)==0) {
+               if (count(self::$backends) == 0) {
                        self::$backends = Config::get('storage', 'backends', self::$default_backends);
                }
        }
@@ -54,12 +54,18 @@ class StorageManager
         * @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;
        }
 
        /**