]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #10446 from MrPetovan/bug/10439-addon-settings-forms
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 29 Jun 2021 17:13:13 +0000 (19:13 +0200)
committerGitHub <noreply@github.com>
Tue, 29 Jun 2021 17:13:13 +0000 (19:13 +0200)
Use correct DBA method in mod/settings addon form post

src/Core/StorageManager.php
src/Model/Contact.php
src/Model/Item.php
src/Model/Photo.php
src/Model/Profile.php
src/Model/Storage/ExternalResource.php
src/Module/Photo.php
src/Object/Api/Mastodon/Account.php
tests/src/Core/StorageManagerTest.php

index b8cde14bd0c1397a1d96391605adae401912545b..64e53c10b9f1f62883fa28c23919809774c8947e 100644 (file)
@@ -25,6 +25,7 @@ use Exception;
 use Friendica\Core\Config\IConfig;
 use Friendica\Database\Database;
 use Friendica\Model\Storage;
+use Friendica\Network\IHTTPRequest;
 use Psr\Log\LoggerInterface;
 
 
@@ -60,6 +61,8 @@ class StorageManager
        private $logger;
        /** @var L10n */
        private $l10n;
+       /** @var IHTTPRequest */
+       private $httpRequest;
 
        /** @var Storage\IStorage */
        private $currentBackend;
@@ -70,12 +73,13 @@ class StorageManager
         * @param LoggerInterface $logger
         * @param L10n            $l10n
         */
-       public function __construct(Database $dba, IConfig $config, LoggerInterface $logger, L10n $l10n)
+       public function __construct(Database $dba, IConfig $config, LoggerInterface $logger, L10n $l10n, IHTTPRequest $httpRequest)
        {
-               $this->dba      = $dba;
-               $this->config   = $config;
-               $this->logger   = $logger;
-               $this->l10n     = $l10n;
+               $this->dba         = $dba;
+               $this->config      = $config;
+               $this->logger      = $logger;
+               $this->l10n        = $l10n;
+               $this->httpRequest = $httpRequest;
                $this->backends = $config->get('storage', 'backends', self::DEFAULT_BACKENDS);
 
                $currentName = $this->config->get('storage', 'name', '');
@@ -127,7 +131,7 @@ class StorageManager
                                                $this->backendInstances[$name] = new Storage\SystemResource();
                                                break;
                                        case Storage\ExternalResource::getName():
-                                               $this->backendInstances[$name] = new Storage\ExternalResource();
+                                               $this->backendInstances[$name] = new Storage\ExternalResource($this->httpRequest);
                                                break;
                                        default:
                                                $data = [
index 86f848da39d4008f17343aa12dee8c8620c27635..60213cacb51751f232c9b3067ef5b16b5317baa1 100644 (file)
@@ -1502,18 +1502,22 @@ class Contact
                if (!empty($contact)) {
                        $contact = self::checkAvatarCacheByArray($contact, $no_update);
                        if (!empty($contact[$field])) {
-                               $avatar = $contact[$field];
+                               return $contact[$field];
+                       } elseif (!empty($contact['id'])) {
+                               return self::getAvatarUrlForId($contact['id'], $size, $contact['updated'] ?? '');
+                       } elseif (!empty($contact['avatar'])) {
+                               $avatar = $contact['avatar'];
                        }
                }
 
-               if ($no_update && empty($avatar) && !empty($contact['avatar'])) {
-                       $avatar = $contact['avatar'];
+               if (empty($avatar)) {
+                       $avatar = self::getDefaultAvatar([], $size);
                }
 
-               if (!empty($avatar) && Proxy::isLocalImage($avatar)) {
+               if (Proxy::isLocalImage($avatar)) {
                        return $avatar;
                } else {
-                       return self::getAvatarUrlForId($contact['id'], $size);
+                       return Proxy::proxifyUrl($avatar, false, $size);
                }
        }
 
@@ -1661,12 +1665,20 @@ class Contact
        /**
         * Get avatar link for given contact id
         *
-        * @param integer $cid  contact id
-        * @param string  $size One of the ProxyUtils::SIZE_* constants
+        * @param integer $cid     contact id
+        * @param string  $size    One of the ProxyUtils::SIZE_* constants
+        * @param string  $updated Contact update date
         * @return string avatar link
         */
-       public static function getAvatarUrlForId(int $cid, string $size = ''):string
+       public static function getAvatarUrlForId(int $cid, string $size = '', string $updated = ''):string
        {
+               // We have to fetch the "updated" variable when it wasn't provided
+               // The parameter can be provided to improve performance
+               if (empty($updated)) {
+                       $contact = self::getById($cid, ['updated']);
+                       $updated = $contact['updated'] ?? '';
+               }
+
                $url = DI::baseUrl() . '/photo/contact/';
                switch ($size) {
                        case Proxy::SIZE_MICRO:
@@ -1685,7 +1697,7 @@ class Contact
                                $url .= Proxy::PIXEL_LARGE . '/';
                                break;
                }
-               return $url . $cid;
+               return $url . $cid . ($updated ? '?ts=' . strtotime($updated) : '');
        }
 
        /**
@@ -1700,19 +1712,47 @@ class Contact
        {
                $condition = ["`nurl` = ? AND ((`uid` = ? AND `network` IN (?, ?)) OR `uid` = ?)",
                        Strings::normaliseLink($url), $uid, Protocol::FEED, Protocol::MAIL, 0];
-               $contact = self::selectFirst(['id'], $condition);
-               return self::getAvatarUrlForId($contact['id'] ?? 0, $size);
+               $contact = self::selectFirst(['id', 'updated'], $condition);
+               return self::getAvatarUrlForId($contact['id'] ?? 0, $size, $contact['updated']);
        }
 
        /**
         * Get header link for given contact id
         *
-        * @param integer $cid contact id
+        * @param integer $cid     contact id
+        * @param string  $size    One of the ProxyUtils::SIZE_* constants
+        * @param string  $updated Contact update date
         * @return string header link
         */
-       public static function getHeaderUrlForId(int $cid):string
+       public static function getHeaderUrlForId(int $cid, string $size = '', string $updated = ''):string
        {
-               return DI::baseUrl() . '/photo/header/' . $cid;
+               // We have to fetch the "updated" variable when it wasn't provided
+               // The parameter can be provided to improve performance
+               if (empty($updated)) {
+                       $contact = self::getById($cid, ['updated']);
+                       $updated = $contact['updated'] ?? '';
+               }
+
+               $url = DI::baseUrl() . '/photo/header/';
+               switch ($size) {
+                       case Proxy::SIZE_MICRO:
+                               $url .= Proxy::PIXEL_MICRO . '/';
+                               break;
+                       case Proxy::SIZE_THUMB:
+                               $url .= Proxy::PIXEL_THUMB . '/';
+                               break;
+                       case Proxy::SIZE_SMALL:
+                               $url .= Proxy::PIXEL_SMALL . '/';
+                               break;
+                       case Proxy::SIZE_MEDIUM:
+                               $url .= Proxy::PIXEL_MEDIUM . '/';
+                               break;
+                       case Proxy::SIZE_LARGE:
+                               $url .= Proxy::PIXEL_LARGE . '/';
+                               break;
+               }
+
+               return $url . $cid . ($updated ? '?ts=' . strtotime($updated) : '');
        }
 
        /**
index 78e0321b47001d2fc90a8e20a0ab224ccb8eb005..fb88da8a28a37ffd1ccc59977b327ac623851e20 100644 (file)
@@ -2742,6 +2742,23 @@ class Item
                }
 
                $body = $item['body'] ?? '';
+               $shared = BBCode::fetchShareAttributes($body);
+               if (!empty($shared['guid'])) {
+                       $shared_item = Post::selectFirst(['uri-id', 'plink'], ['guid' => $shared['guid']]);
+                       $shared_uri_id = $shared_item['uri-id'] ?? 0;
+                       $shared_links = [strtolower($shared_item['plink'] ?? '')];
+                       $shared_attachments = Post\Media::splitAttachments($shared_uri_id, $shared['guid']);
+                       $shared_links = array_merge($shared_links, array_column($shared_attachments['visual'], 'url'));
+                       $shared_links = array_merge($shared_links, array_column($shared_attachments['link'], 'url'));
+                       $shared_links = array_merge($shared_links, array_column($shared_attachments['additional'], 'url'));
+                       $item['body'] = self::replaceVisualAttachments($shared_attachments, $item['body']);
+               } else {
+                       $shared_uri_id = 0;
+                       $shared_links = [];
+               }
+               $attachments = Post\Media::splitAttachments($item['uri-id'], $item['guid'] ?? '', $shared_links);
+               $item['body'] = self::replaceVisualAttachments($attachments, $item['body'] ?? '');
+
                $item['body'] = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", "\n", $item['body']);
                self::putInCache($item);
                $item['body'] = $body;
@@ -2764,25 +2781,13 @@ class Item
                        return $s;
                }
 
-               $shared = BBCode::fetchShareAttributes($item['body']);
-               if (!empty($shared['guid'])) {
-                       $shared_item = Post::selectFirst(['uri-id', 'plink'], ['guid' => $shared['guid']]);
-                       $shared_uri_id = $shared_item['uri-id'] ?? 0;
-                       $shared_links = [strtolower($shared_item['plink'] ?? '')];
-                       $attachments = Post\Media::splitAttachments($shared_uri_id, $shared['guid']);
-                       $s = self::addVisualAttachments($attachments, $item, $s, true);
-                       $s = self::addLinkAttachment($attachments, $body, $s, true, []);
-                       $s = self::addNonVisualAttachments($attachments, $item, $s, true);
-                       $shared_links = array_merge($shared_links, array_column($attachments['visual'], 'url'));
-                       $shared_links = array_merge($shared_links, array_column($attachments['link'], 'url'));
-                       $shared_links = array_merge($shared_links, array_column($attachments['additional'], 'url'));
+               if (!empty($shared_attachments)) {
+                       $s = self::addVisualAttachments($shared_attachments, $item, $s, true);
+                       $s = self::addLinkAttachment($shared_attachments, $body, $s, true, []);
+                       $s = self::addNonVisualAttachments($shared_attachments, $item, $s, true);
                        $body = preg_replace("/\s*\[share .*?\].*?\[\/share\]\s*/ism", '', $body);
-               } else {
-                       $shared_uri_id = 0;
-                       $shared_links = [];
                }
 
-               $attachments = Post\Media::splitAttachments($item['uri-id'], $item['guid'] ?? '', $shared_links);
                $s = self::addVisualAttachments($attachments, $item, $s, false);
                $s = self::addLinkAttachment($attachments, $body, $s, false, $shared_links);
                $s = self::addNonVisualAttachments($attachments, $item, $s, false);
@@ -2843,6 +2848,28 @@ class Item
                return false;
        }
 
+       /**
+        * Replace visual attachments in the body
+        *
+        * @param array $attachments
+        * @param string $body
+        * @return string modified body
+        */
+       private static function replaceVisualAttachments(array $attachments, string $body)
+       {
+               $stamp1 = microtime(true);
+
+               foreach ($attachments['visual'] as $attachment) {
+                       if (!empty($attachment['preview'])) {
+                               $body = str_replace($attachment['preview'], Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_LARGE), $body);
+                       } elseif ($attachment['filetype'] == 'image') {
+                               $body = str_replace($attachment['url'], Post\Media::getUrlForId($attachment['id']), $body);
+                       }
+               }
+               DI::profiler()->saveTimestamp($stamp1, 'rendering');
+               return $body;
+       }
+
        /**
         * Add visual attachments to the content
         *
@@ -2864,7 +2891,7 @@ class Item
                        }
 
                        if (!empty($attachment['preview'])) {
-                               $preview_url = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_LARGE); 
+                               $preview_url = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_LARGE);
                        } else {
                                $preview_url = '';
                        }
@@ -2901,7 +2928,7 @@ class Item
                                }
                        } elseif ($attachment['filetype'] == 'image') {
                                $media = Renderer::replaceMacros(Renderer::getMarkupTemplate('content/image.tpl'), [
-                                       '$image' => [ 
+                                       '$image' => [
                                                'src'        => Post\Media::getUrlForId($attachment['id']),
                                                'preview'    => Post\Media::getPreviewUrlForId($attachment['id'], ($attachment['width'] > $attachment['height']) ? Proxy::SIZE_MEDIUM : Proxy::SIZE_LARGE),
                                                'attachment' => $attachment,
@@ -2984,7 +3011,7 @@ class Item
 
                        if ($preview && !empty($attachment['preview'])) {
                                if ($attachment['preview-width'] >= 500) {
-                                       $data['image'] = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_MEDIUM); 
+                                       $data['image'] = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_MEDIUM);
                                } else {
                                        $data['preview'] = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_MEDIUM);
                                }
index acc6b0d19731a80b6d724fbae5d466ec8c588772..fe416c360f54e55d1c19c16e99867dd4a65e9ebf 100644 (file)
@@ -268,21 +268,22 @@ class Photo
         * Construct a photo array for an external resource image
         *
         * @param string $url      Image URL
+        * @param int    $uid      User ID of the requesting person
         * @param string $mimetype Image mime type. Defaults to "image/jpeg"
         *
         * @return array
         * @throws \Exception
         */
-       public static function createPhotoForExternalResource($url, $mimetype = "image/jpeg")
+       public static function createPhotoForExternalResource($url, $uid = 0, $mimetype = "image/jpeg")
        {
                $fields = self::getFields();
                $values = array_fill(0, count($fields), "");
 
                $photo                  = array_combine($fields, $values);
                $photo['backend-class'] = ExternalResource::NAME;
-               $photo['backend-ref']   = $url;
+               $photo['backend-ref']   = json_encode(['url' => $url, 'uid' => $uid]);
                $photo['type']          = $mimetype;
-               $photo['cacheable']     = false;
+               $photo['cacheable']     = true;
 
                return $photo;
        }
index b8a5bc822393a06028b92e847caa1a0ff55895a0..4aacc9f9b6341c37692e216447919d005d005974 100644 (file)
@@ -507,9 +507,9 @@ class Profile
                        $p['address'] = BBCode::convert($p['address']);
                }
 
-               $p['photo'] = Contact::getAvatarUrlForId($cid);
+               $p['photo'] = Contact::getAvatarUrlForId($cid, ProxyUtils::SIZE_SMALL);
 
-               $p['url'] = Contact::magicLink($profile_url);
+               $p['url'] = Contact::magicLinkById($cid);
 
                $tpl = Renderer::getMarkupTemplate('profile/vcard.tpl');
                $o .= Renderer::replaceMacros($tpl, [
index 8d1aded1516bbe7834a423933fafe4c659e55c29..5c78e6d546360c2fe035cd78266b8a8ee99c81af 100644 (file)
@@ -22,6 +22,7 @@
 namespace Friendica\Model\Storage;
 
 use BadMethodCallException;
+use Friendica\Util\HTTPSignature;
 use Friendica\Network\IHTTPRequest;
 
 /**
@@ -45,16 +46,21 @@ class ExternalResource implements IStorage
        /**
         * @inheritDoc
         */
-       public function get(string $filename)
+       public function get(string $reference)
        {
-               $parts = parse_url($filename);
+               $data = json_decode($reference);
+               if (empty($data->url)) {
+                       return "";
+               }
+
+               $parts = parse_url($data->url);
                if (empty($parts['scheme']) || empty($parts['host'])) {
                        return "";
                }
 
-               $curlResult = $this->httpRequest->get($filename);
-               if ($curlResult->isSuccess()) {
-                       return $curlResult->getBody();
+               $fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid);
+               if ($fetchResult->isSuccess()) {
+                       return $fetchResult->getBody();
                } else {
                        return "";
                }
@@ -63,12 +69,12 @@ class ExternalResource implements IStorage
        /**
         * @inheritDoc
         */
-       public function put(string $data, string $filename = '')
+       public function put(string $data, string $reference = '')
        {
                throw new BadMethodCallException();
        }
 
-       public function delete(string $filename)
+       public function delete(string $reference)
        {
                throw new BadMethodCallException();
        }
index 9fdda1a8d0efb1b479ce79ed6a19dfcc6f6dbdf9..05ddd1bf50369aa707af25034885d50550d890e0 100644 (file)
@@ -63,6 +63,7 @@ class Photo extends BaseModule
                }
 
                $customsize = 0;
+               $square_resize = true;
                $photo = false;
                $scale = null;
                $stamp = microtime(true);
@@ -70,6 +71,7 @@ class Photo extends BaseModule
                        $customsize = intval($parameters['customsize']);
                        $uid = MPhoto::stripExtension($parameters['name']);
                        $photo = self::getAvatar($uid, $parameters['type'], $customsize);
+                       $square_resize = !in_array($parameters['type'], ['media', 'preview']);
                } elseif (!empty($parameters['type'])) {
                        $uid = MPhoto::stripExtension($parameters['name']);
                        $photo = self::getAvatar($uid, $parameters['type'], Proxy::PIXEL_SMALL);
@@ -105,10 +107,14 @@ class Photo extends BaseModule
                }
 
                // if customsize is set and image is not a gif, resize it
-               if ($photo['type'] !== "image/gif" && $customsize > 0 && $customsize < 501) {
+               if ($photo['type'] !== "image/gif" && $customsize > 0 && $customsize <= Proxy::PIXEL_THUMB && $square_resize) {
                        $img = new Image($imgdata, $photo['type']);
                        $img->scaleToSquare($customsize);
                        $imgdata = $img->asString();
+               } elseif ($photo['type'] !== "image/gif" && $customsize > 0) {
+                       $img = new Image($imgdata, $photo['type']);
+                       $img->scaleDown($customsize);
+                       $imgdata = $img->asString();
                }
 
                if (function_exists("header_remove")) {
@@ -168,20 +174,14 @@ class Photo extends BaseModule
                                        return false;
                                }
 
-                               $author = Contact::selectFirst([], ["`id` IN (SELECT `author-id` FROM `post` WHERE `uri-id` = ?)", $media['uri-id']]);
-                               $url = Contact::magicLinkByContact($author, $url);
-
-                               return MPhoto::createPhotoForExternalResource($url);
+                               return MPhoto::createPhotoForExternalResource($url, (int)local_user());
                        case "media":
-                               $media = DBA::selectFirst('post-media', ['url'], ['id' => $uid, 'type' => Post\Media::IMAGE]);
-                               if (empty($media['url'])) {
+                               $media = DBA::selectFirst('post-media', ['url', 'uri-id'], ['id' => $uid, 'type' => Post\Media::IMAGE]);
+                               if (empty($media)) {
                                        return false;
                                }
 
-                               $author = Contact::selectFirst([], ["`id` IN (SELECT `author-id` FROM `post` WHERE `uri-id` = ?)", $media['uri-id']]);
-                               $url = Contact::magicLinkByContact($author, $media['url']);
-
-                               return MPhoto::createPhotoForExternalResource($url);
+                               return MPhoto::createPhotoForExternalResource($media['url'], (int)local_user());
                        case "contact":
                                $contact = Contact::getById($uid, ['uid', 'url', 'avatar', 'photo', 'xmpp', 'addr']);
                                if (empty($contact)) {
index 2ea9da70482358bd4b232e66e4618c2f9bd5095f..d2053647a5a9a074c7608dff8e5e9a3906a331db 100644 (file)
@@ -28,6 +28,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Proxy;
 
 /**
  * Class Account
@@ -112,9 +113,9 @@ class Account extends BaseDataTransferObject
 
                $this->note            = BBCode::convert($publicContact['about'], false);
                $this->url             = $publicContact['url'];
-               $this->avatar          = $userContact['photo'] ?? '' ?: $publicContact['photo'] ?: Contact::getAvatarUrlForId($userContact['id'] ?? 0 ?: $publicContact['id']);
+               $this->avatar          = Contact::getAvatarUrlForId($userContact['id'] ?? 0 ?: $publicContact['id'], Proxy::SIZE_SMALL, $userContact['updated'] ?? '' ?: $publicContact['updated']);
                $this->avatar_static   = $this->avatar;
-               $this->header          = Contact::getHeaderUrlForId($userContact['id'] ?? 0 ?: $publicContact['id']);
+               $this->header          = Contact::getHeaderUrlForId($userContact['id'] ?? 0 ?: $publicContact['id'], '', $userContact['updated'] ?? '' ?: $publicContact['updated']);
                $this->header_static   = $this->header;
                $this->followers_count = $apcontact['followers_count'] ?? 0;
                $this->following_count = $apcontact['following_count'] ?? 0;
index d2078c7e2a085c94cd08ee883df71ce33b2e56d0..618b5e33c4b753c81fd971597522065c637012f9 100644 (file)
@@ -35,6 +35,7 @@ use Friendica\Model\Config\Config;
 use Friendica\Model\Storage;
 use Friendica\Core\Session;
 use Friendica\Model\Storage\StorageException;
+use Friendica\Network\HTTPRequest;
 use Friendica\Test\DatabaseTest;
 use Friendica\Test\Util\Database\StaticDatabase;
 use Friendica\Test\Util\VFSTrait;
@@ -54,6 +55,8 @@ class StorageManagerTest extends DatabaseTest
        private $logger;
        /** @var L10n */
        private $l10n;
+       /** @var HTTPRequest */
+       private $httpRequest;
 
        use VFSTrait;
 
@@ -79,6 +82,8 @@ class StorageManagerTest extends DatabaseTest
                $this->config = new PreloadConfig($configCache, $configModel);
 
                $this->l10n = \Mockery::mock(L10n::class);
+
+               $this->httpRequest = \Mockery::mock(HTTPRequest::class);
        }
 
        /**
@@ -86,7 +91,7 @@ class StorageManagerTest extends DatabaseTest
         */
        public function testInstance()
        {
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                self::assertInstanceOf(StorageManager::class, $storageManager);
        }
@@ -168,7 +173,7 @@ class StorageManagerTest extends DatabaseTest
         */
        public function testGetByName($name, $assert, $assertName, $userBackend)
        {
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                $storage = $storageManager->getByName($name, $userBackend);
 
@@ -188,7 +193,7 @@ class StorageManagerTest extends DatabaseTest
         */
        public function testIsValidBackend($name, $assert, $assertName, $userBackend)
        {
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                // true in every of the backends
                self::assertEquals(!empty($assertName), $storageManager->isValidBackend($name));
@@ -202,7 +207,7 @@ class StorageManagerTest extends DatabaseTest
         */
        public function testListBackends()
        {
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                self::assertEquals(StorageManager::DEFAULT_BACKENDS, $storageManager->listBackends());
        }
@@ -214,7 +219,7 @@ class StorageManagerTest extends DatabaseTest
         */
        public function testGetBackend($name, $assert, $assertName, $userBackend)
        {
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                self::assertNull($storageManager->getBackend());
 
@@ -235,7 +240,7 @@ class StorageManagerTest extends DatabaseTest
        {
                $this->config->set('storage', 'name', $name);
 
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                if ($userBackend) {
                        self::assertInstanceOf($assert, $storageManager->getBackend());
@@ -260,7 +265,7 @@ class StorageManagerTest extends DatabaseTest
                        ->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true, 'call' => null]);
                DI::init($dice);
 
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
 
                self::assertTrue($storageManager->register(SampleStorageBackend::class));
 
@@ -301,7 +306,7 @@ class StorageManagerTest extends DatabaseTest
 
                $this->loadFixture(__DIR__ . '/../../datasets/storage/database.fixture.php', $this->dba);
 
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
                $storage = $storageManager->getByName($name);
                $storageManager->move($storage);
 
@@ -326,7 +331,7 @@ class StorageManagerTest extends DatabaseTest
                $this->expectExceptionMessage("Can't move to storage backend 'SystemResource'");
                $this->expectException(StorageException::class);
 
-               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n, $this->httpRequest);
                $storage = $storageManager->getByName(Storage\SystemResource::getName());
                $storageManager->move($storage);
        }