1
0
Fork 0

Merge remote-tracking branch 'upstream/2021.06-rc' into proxy2

This commit is contained in:
Michael 2021-06-28 10:11:41 +00:00
commit 8ac9b37176
10 changed files with 1094 additions and 1085 deletions

View 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 = [

View file

@ -23,6 +23,7 @@ namespace Friendica\Model\Storage;
use BadMethodCallException;
use Friendica\Util\HTTPSignature;
use Friendica\Network\IHTTPRequest;
/**
* External resource storage class
@ -34,6 +35,14 @@ class ExternalResource implements IStorage
{
const NAME = 'ExternalResource';
/** @var IHTTPRequest */
private $httpRequest;
public function __construct(IHTTPRequest $httpRequest)
{
$this->httpRequest = $httpRequest;
}
/**
* @inheritDoc
*/

View file

@ -23,6 +23,8 @@ namespace Friendica\Model\Storage;
/**
* Interface for storage backends
*
* @todo Split this interface into "IStorage" for get() operations (including Resource fetching) and "IUserStorage" for real user backends including put/delete/options
*/
interface IStorage
{

View 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);
}

File diff suppressed because it is too large Load diff

View file

@ -324,8 +324,6 @@ $a->strings["\n\t\t\tDear %1\$s,\n\t\t\t\tYour password has been changed as requ
$a->strings["\n\t\t\tYour login details are as follows:\n\n\t\t\tSite Location:\t%1\$s\n\t\t\tLogin Name:\t%2\$s\n\t\t\tPassword:\t%3\$s\n\n\t\t\tYou may change that password from your account settings page after logging in.\n\t\t"] = "\nDie Anmeldedaten sind die folgenden:\n\nAdresse der Seite: %1\$s\nLogin Name: %2\$s\nPasswort: %3\$s\n\nDas Passwort kann und sollte in den Kontoeinstellungen nach der Anmeldung geändert werden.";
$a->strings["Your password has been changed at %s"] = "Auf %s wurde dein Passwort geändert";
$a->strings["No keywords to match. Please add keywords to your profile."] = "Keine Schlüsselwörter zum Abgleichen gefunden. Bitte füge einige Schlüsselwörter zu deinem Profil hinzu.";
$a->strings["first"] = "erste";
$a->strings["next"] = "nächste";
$a->strings["No matches"] = "Keine Übereinstimmungen";
$a->strings["Profile Match"] = "Profilübereinstimmungen";
$a->strings["New Message"] = "Neue Nachricht";
@ -790,7 +788,9 @@ $a->strings["Navigation"] = "Navigation";
$a->strings["Site map"] = "Sitemap";
$a->strings["Embedding disabled"] = "Einbettungen deaktiviert";
$a->strings["Embedded content"] = "Eingebetteter Inhalt";
$a->strings["first"] = "erste";
$a->strings["prev"] = "vorige";
$a->strings["next"] = "nächste";
$a->strings["last"] = "letzte";
$a->strings["Image/photo"] = "Bild/Foto";
$a->strings["<a href=\"%1\$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2\$s</a> %3\$s"] = "<a href=\"%1\$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2\$s</a>%3\$s";
@ -1300,6 +1300,9 @@ $a->strings["Auto Discovered Contact Directory"] = "Automatisch ein Kontaktverze
$a->strings["Performance"] = "Performance";
$a->strings["Worker"] = "Worker";
$a->strings["Message Relay"] = "Nachrichten-Relais";
$a->strings["Use the command \"console relay\" in the command line to add or remove relays."] = "Verwende den Befehl \"console relay\" auf der Kommandozeile um weitere Relays hinzu zu fügen oder zu entfernen.";
$a->strings["The system is not subscribed to any relays at the moment."] = "Das System hat derzeit keinerlei Relays abonniert.";
$a->strings["The system is currently subscribed to the following relays:"] = "Das System hat derzeit Abonnements bei folgenden Releays:";
$a->strings["Relocate Instance"] = "Instanz Umziehen";
$a->strings["<strong>Warning!</strong> Advanced function. Could make this server unreachable."] = "<strong>Achtung</strong> Funktionen für Fortgeschrittene. Könnte diesen Server unerreichbar machen.";
$a->strings["Site name"] = "Seitenname";
@ -1455,10 +1458,6 @@ $a->strings["Maximum number of parallel workers"] = "Maximale Anzahl parallel la
$a->strings["On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d."] = "Wenn dein Knoten bei einem Shared Hoster ist, setze diesen Wert auf %d. Auf größeren Systemen funktioniert ein Wert von %d recht gut. Standardeinstellung sind %d.";
$a->strings["Enable fastlane"] = "Aktiviere Fastlane";
$a->strings["When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority."] = "Wenn aktiviert, wird der Fastlane-Mechanismus einen weiteren Worker-Prozeß starten, wenn Prozesse mit höherer Priorität von Prozessen mit niedrigerer Priorität blockiert werden.";
$a->strings["Use relay servers"] = "Verwende Relais-Server";
$a->strings["Enables the receiving of public posts from relay servers. They will be included in the search, subscribed tags and on the global community page."] = "Aktiviert den Empfang von öffentlichen Beiträgen vom Relais-Server. Diese Beiträge werden in der Suche, den abonnierten Hashtags sowie der globalen Gemeinschaftsseite verfügbar sein.";
$a->strings["\"Social Relay\" server"] = "\"Social Relais\" Server";
$a->strings["Address of the \"Social Relay\" server where public posts should be send to. For example %s. ActivityRelay servers are administrated via the \"console relay\" command line command."] = "Adresse des \"Social Relais\" Servers, an den die öffentlichen Beiträge gesendet werden sollen.- Zum Beispiel %s. ActivityRelais Server werden mit dem Kommandozeilen Befehl \"console relay\" administriert.";
$a->strings["Direct relay transfer"] = "Direkte Relais-Übertragung";
$a->strings["Enables the direct transfer to other servers without using the relay servers"] = "Aktiviert das direkte Verteilen an andere Server, ohne dass ein Relais-Server verwendet wird.";
$a->strings["Relay scope"] = "Geltungsbereich des Relais";
@ -1979,6 +1978,7 @@ $a->strings["Show unread"] = "Ungelesene anzeigen";
$a->strings["Show all"] = "Alle anzeigen";
$a->strings["Unsupported or missing response type"] = "Der Typ der Antwort fehlt oder wird nicht unterstützt";
$a->strings["Incomplete request data"] = "Daten der Anfrage sind nicht vollständig";
$a->strings["Please copy the following authentication code into your application and close this window: %s"] = "Bitte kopiere den folgenden Authentifizierungscode in deine App und schließe dieses Fenster: %s";
$a->strings["Unsupported or missing grant type"] = "Der Grant-Typ fehlt oder wird nicht unterstützt";
$a->strings["Wrong type \"%s\", expected one of: %s"] = "Falscher Typ \"%s\", hatte einen der Folgenden erwartet: %s";
$a->strings["Model not found"] = "Model nicht gefunden";

File diff suppressed because it is too large Load diff

View file

@ -324,8 +324,6 @@ $a->strings["\n\t\t\tDear %1\$s,\n\t\t\t\tYour password has been changed as requ
$a->strings["\n\t\t\tYour login details are as follows:\n\n\t\t\tSite Location:\t%1\$s\n\t\t\tLogin Name:\t%2\$s\n\t\t\tPassword:\t%3\$s\n\n\t\t\tYou may change that password from your account settings page after logging in.\n\t\t"] = "\n\t\t\tA bejelentkezés részletei a következők:\n\n\t\t\tOldal címe:\t%1\$s\n\t\t\tBejelentkezési név:\t%2\$s\n\t\t\tJelszó:\t%3\$s\n\n\t\t\tMegváltoztathatja a jelszót a fiókbeállítások oldalon, miután bejelentkezett.\n\t\t";
$a->strings["Your password has been changed at %s"] = "A jelszava meg lett változtatva itt: %s";
$a->strings["No keywords to match. Please add keywords to your profile."] = "Nincs illesztendő kulcsszó. Adjon kulcsszavakat a profiljához.";
$a->strings["first"] = "első";
$a->strings["next"] = "következő";
$a->strings["No matches"] = "Nincs találat";
$a->strings["Profile Match"] = "Profilegyezés";
$a->strings["New Message"] = "Új üzenet";
@ -790,7 +788,9 @@ $a->strings["Navigation"] = "Navigáció";
$a->strings["Site map"] = "Oldaltérkép";
$a->strings["Embedding disabled"] = "A beágyazás letiltva";
$a->strings["Embedded content"] = "Beágyazott tartalom";
$a->strings["first"] = "első";
$a->strings["prev"] = "előző";
$a->strings["next"] = "következő";
$a->strings["last"] = "utolsó";
$a->strings["Image/photo"] = "Kép vagy fénykép";
$a->strings["<a href=\"%1\$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2\$s</a> %3\$s"] = "<a href=\"%1\$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2\$s</a> %3\$s";
@ -1300,6 +1300,9 @@ $a->strings["Auto Discovered Contact Directory"] = "Automatikusan felfedezett pa
$a->strings["Performance"] = "Teljesítmény";
$a->strings["Worker"] = "Feldolgozó";
$a->strings["Message Relay"] = "Üzenettovábbítás";
$a->strings["Use the command \"console relay\" in the command line to add or remove relays."] = "Használja a „console relay” parancsot a parancssorban a továbbítók hozzáadásához vagy eltávolításához.";
$a->strings["The system is not subscribed to any relays at the moment."] = "A rendszer jelenleg nincs feliratkozva semmilyen továbbítóra sem.";
$a->strings["The system is currently subscribed to the following relays:"] = "A rendszer jelenleg a következő továbbítókra van feliratkozva:";
$a->strings["Relocate Instance"] = "Példány áthelyezése";
$a->strings["<strong>Warning!</strong> Advanced function. Could make this server unreachable."] = "<strong>Figyelmeztetés!</strong> Speciális funkció. Elérhetetlenné teheti a kiszolgálót.";
$a->strings["Site name"] = "Oldal neve";
@ -1455,10 +1458,6 @@ $a->strings["Maximum number of parallel workers"] = "Párhuzamos feldolgozók le
$a->strings["On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d."] = "Osztott tárhelyszolgáltatóknál állítsa ezt %d értékre. Nagyobb rendszereknél érdemes a számot %d értékre állítani. Az alapértelmezett érték %d.";
$a->strings["Enable fastlane"] = "Prioritásos sor engedélyezése";
$a->strings["When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority."] = "Ha engedélyezve van, akkor a prioritásos sor mechanizmus további feldolgozót indít, ha a magasabb prioritással rendelkező folyamatokat blokkolják az alacsonyabb prioritású folyamatok.";
$a->strings["Use relay servers"] = "Továbbító kiszolgálók használata";
$a->strings["Enables the receiving of public posts from relay servers. They will be included in the search, subscribed tags and on the global community page."] = "Engedélyezi a továbbító kiszolgálókról érkező nyilvános bejegyzések fogadását. Ezek fel lesznek véve a keresésbe, a feliratkozott címkékbe és a globális közösségi oldalra.";
$a->strings["\"Social Relay\" server"] = "„Közösségi továbbító” kiszolgáló";
$a->strings["Address of the \"Social Relay\" server where public posts should be send to. For example %s. ActivityRelay servers are administrated via the \"console relay\" command line command."] = "Annak a „közösségi továbbító” kiszolgálónak a címe, ahová a nyilvános bejegyzéseket küldeni kell. Például %s. A tevékenység-továbbító kiszolgálók a „console relay” parancssori parancson keresztül vannak adminisztrálva.";
$a->strings["Direct relay transfer"] = "Közvetlen továbbító-átvitel";
$a->strings["Enables the direct transfer to other servers without using the relay servers"] = "Engedélyezi a más kiszolgálókra való közvetlen átvitelt a továbbító kiszolgálók használata nélkül.";
$a->strings["Relay scope"] = "Továbbítás hatóköre";
@ -1979,6 +1978,7 @@ $a->strings["Show unread"] = "Olvasatlanok megjelenítése";
$a->strings["Show all"] = "Összes megjelenítése";
$a->strings["Unsupported or missing response type"] = "Nem támogatott vagy hiányzó választípus";
$a->strings["Incomplete request data"] = "Befejezetlen kérésadat";
$a->strings["Please copy the following authentication code into your application and close this window: %s"] = "Másolja be a következő hitelesítési kódot az alkalmazásába, és zárja be ezt az ablakot: %s";
$a->strings["Unsupported or missing grant type"] = "Nem támogatott vagy hiányzó felhatalmazástípus";
$a->strings["Wrong type \"%s\", expected one of: %s"] = "Hibás típus: „%s”, a következők egyike várt: %s";
$a->strings["Model not found"] = "A modell nem található";

File diff suppressed because it is too large Load diff

View file

@ -283,8 +283,6 @@ $a->strings["\n\t\t\tDear %1\$s,\n\t\t\t\tYour password has been changed as requ
$a->strings["\n\t\t\tYour login details are as follows:\n\n\t\t\tSite Location:\t%1\$s\n\t\t\tLogin Name:\t%2\$s\n\t\t\tPassword:\t%3\$s\n\n\t\t\tYou may change that password from your account settings page after logging in.\n\t\t"] = "\n\t\t\tログインの詳細は次のとおりです:\n\n\t\t\tサイトの場所:\t%1\$s\n\t\t\tログイン名:\t%2\$s\n\t\t\tパスワード:\t%3\$s\n\n\t\t\tログイン後にアカウント設定ページからパスワードを変更できます。\n\t\t";
$a->strings["Your password has been changed at %s"] = "パスワードは%s変更されました";
$a->strings["No keywords to match. Please add keywords to your profile."] = "合致するキーワードが有りません。あなたのプロフィールにキーワードを追加してください。";
$a->strings["first"] = "最初";
$a->strings["next"] = "";
$a->strings["No matches"] = "一致する項目がありません";
$a->strings["Profile Match"] = "一致するプロフィール";
$a->strings["New Message"] = "新しいメッセージ";
@ -728,7 +726,9 @@ $a->strings["Navigation"] = "ナビゲーション";
$a->strings["Site map"] = "サイトマップ";
$a->strings["Embedding disabled"] = "埋め込みが無効です";
$a->strings["Embedded content"] = "埋め込みコンテンツ";
$a->strings["first"] = "最初";
$a->strings["prev"] = "前の";
$a->strings["next"] = "";
$a->strings["last"] = "最終";
$a->strings["Image/photo"] = "画像/写真";
$a->strings["Click to open/close"] = "クリックして開閉";
@ -1306,8 +1306,6 @@ $a->strings["Maximum number of parallel workers"] = "並列ワーカーの最大
$a->strings["On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d."] = "共有ホスティング事業者では、これを%dに設定します。大規模なシステムでは、 %dの値は素晴らしいでしょう。既定の値は%dです。";
$a->strings["Enable fastlane"] = "fastlaneを有効にする";
$a->strings["When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority."] = "有効にすると、優先度の高いプロセスが優先度の低いプロセスによってブロックされた場合、fastlaneメカニズムは追加のワーカーを開始します。";
$a->strings["Use relay servers"] = "中継サーバーを使用する";
$a->strings["Enables the receiving of public posts from relay servers. They will be included in the search, subscribed tags and on the global community page."] = "中継サーバーからの公開投稿の受信を有効にします。それらは、検索や購読しているタグ、グローバルコミュニティのページに掲載されます。";
$a->strings["Direct relay transfer"] = "直接中継転送";
$a->strings["Enables the direct transfer to other servers without using the relay servers"] = "中継サーバーを使用せずに他のサーバーに直接転送できるようにします";
$a->strings["Relay scope"] = "中継スコープ";