diff options
author | Samuel <faust64@gmail.com> | 2021-02-11 12:06:16 +0100 |
---|---|---|
committer | Samuel <faust64@gmail.com> | 2021-02-11 12:06:16 +0100 |
commit | 957e287b797b33dfac9e34ad9e7b66e6aa28cd73 (patch) | |
tree | 80fdb200b4c753919b03241323352b6dcab3e3e7 /lib | |
parent | 75fbc66f9b959a67a36fe768bec6bfd9e839fa70 (diff) | |
parent | d5dea10517bbceaf141f56b6dde0efb55fc6f4b5 (diff) | |
download | nextcloud-server-957e287b797b33dfac9e34ad9e7b66e6aa28cd73.tar.gz nextcloud-server-957e287b797b33dfac9e34ad9e7b66e6aa28cd73.zip |
Merge remote-tracking branch 'upstream/master' into feat-federatedfilesharing-logging
Diffstat (limited to 'lib')
66 files changed, 735 insertions, 197 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 49b138714a7..c0728ce9f8e 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -584,10 +584,16 @@ return array( 'OC\\AllConfig' => $baseDir . '/lib/private/AllConfig.php', 'OC\\AppConfig' => $baseDir . '/lib/private/AppConfig.php', 'OC\\AppFramework\\App' => $baseDir . '/lib/private/AppFramework/App.php', + 'OC\\AppFramework\\Bootstrap\\ARegistration' => $baseDir . '/lib/private/AppFramework/Bootstrap/ARegistration.php', 'OC\\AppFramework\\Bootstrap\\BootContext' => $baseDir . '/lib/private/AppFramework/Bootstrap/BootContext.php', 'OC\\AppFramework\\Bootstrap\\Coordinator' => $baseDir . '/lib/private/AppFramework/Bootstrap/Coordinator.php', + 'OC\\AppFramework\\Bootstrap\\EventListenerRegistration' => $baseDir . '/lib/private/AppFramework/Bootstrap/EventListenerRegistration.php', 'OC\\AppFramework\\Bootstrap\\FunctionInjector' => $baseDir . '/lib/private/AppFramework/Bootstrap/FunctionInjector.php', + 'OC\\AppFramework\\Bootstrap\\ParameterRegistration' => $baseDir . '/lib/private/AppFramework/Bootstrap/ParameterRegistration.php', 'OC\\AppFramework\\Bootstrap\\RegistrationContext' => $baseDir . '/lib/private/AppFramework/Bootstrap/RegistrationContext.php', + 'OC\\AppFramework\\Bootstrap\\ServiceAliasRegistration' => $baseDir . '/lib/private/AppFramework/Bootstrap/ServiceAliasRegistration.php', + 'OC\\AppFramework\\Bootstrap\\ServiceFactoryRegistration' => $baseDir . '/lib/private/AppFramework/Bootstrap/ServiceFactoryRegistration.php', + 'OC\\AppFramework\\Bootstrap\\ServiceRegistration' => $baseDir . '/lib/private/AppFramework/Bootstrap/ServiceRegistration.php', 'OC\\AppFramework\\DependencyInjection\\DIContainer' => $baseDir . '/lib/private/AppFramework/DependencyInjection/DIContainer.php', 'OC\\AppFramework\\Http' => $baseDir . '/lib/private/AppFramework/Http.php', 'OC\\AppFramework\\Http\\Dispatcher' => $baseDir . '/lib/private/AppFramework/Http/Dispatcher.php', @@ -992,7 +998,6 @@ return array( 'OC\\DB\\QueryBuilder\\QueryBuilder' => $baseDir . '/lib/private/DB/QueryBuilder/QueryBuilder.php', 'OC\\DB\\QueryBuilder\\QueryFunction' => $baseDir . '/lib/private/DB/QueryBuilder/QueryFunction.php', 'OC\\DB\\QueryBuilder\\QuoteHelper' => $baseDir . '/lib/private/DB/QueryBuilder/QuoteHelper.php', - 'OC\\DB\\ReconnectWrapper' => $baseDir . '/lib/private/DB/ReconnectWrapper.php', 'OC\\DB\\ResultAdapter' => $baseDir . '/lib/private/DB/ResultAdapter.php', 'OC\\DB\\SQLiteMigrator' => $baseDir . '/lib/private/DB/SQLiteMigrator.php', 'OC\\DB\\SQLiteSessionInit' => $baseDir . '/lib/private/DB/SQLiteSessionInit.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 373db9144bd..f55941501b9 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -613,10 +613,16 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\AllConfig' => __DIR__ . '/../../..' . '/lib/private/AllConfig.php', 'OC\\AppConfig' => __DIR__ . '/../../..' . '/lib/private/AppConfig.php', 'OC\\AppFramework\\App' => __DIR__ . '/../../..' . '/lib/private/AppFramework/App.php', + 'OC\\AppFramework\\Bootstrap\\ARegistration' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/ARegistration.php', 'OC\\AppFramework\\Bootstrap\\BootContext' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/BootContext.php', 'OC\\AppFramework\\Bootstrap\\Coordinator' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/Coordinator.php', + 'OC\\AppFramework\\Bootstrap\\EventListenerRegistration' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/EventListenerRegistration.php', 'OC\\AppFramework\\Bootstrap\\FunctionInjector' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/FunctionInjector.php', + 'OC\\AppFramework\\Bootstrap\\ParameterRegistration' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/ParameterRegistration.php', 'OC\\AppFramework\\Bootstrap\\RegistrationContext' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/RegistrationContext.php', + 'OC\\AppFramework\\Bootstrap\\ServiceAliasRegistration' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/ServiceAliasRegistration.php', + 'OC\\AppFramework\\Bootstrap\\ServiceFactoryRegistration' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/ServiceFactoryRegistration.php', + 'OC\\AppFramework\\Bootstrap\\ServiceRegistration' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Bootstrap/ServiceRegistration.php', 'OC\\AppFramework\\DependencyInjection\\DIContainer' => __DIR__ . '/../../..' . '/lib/private/AppFramework/DependencyInjection/DIContainer.php', 'OC\\AppFramework\\Http' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Http.php', 'OC\\AppFramework\\Http\\Dispatcher' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Http/Dispatcher.php', @@ -1021,7 +1027,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\DB\\QueryBuilder\\QueryBuilder' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/QueryBuilder.php', 'OC\\DB\\QueryBuilder\\QueryFunction' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/QueryFunction.php', 'OC\\DB\\QueryBuilder\\QuoteHelper' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/QuoteHelper.php', - 'OC\\DB\\ReconnectWrapper' => __DIR__ . '/../../..' . '/lib/private/DB/ReconnectWrapper.php', 'OC\\DB\\ResultAdapter' => __DIR__ . '/../../..' . '/lib/private/DB/ResultAdapter.php', 'OC\\DB\\SQLiteMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/SQLiteMigrator.php', 'OC\\DB\\SQLiteSessionInit' => __DIR__ . '/../../..' . '/lib/private/DB/SQLiteSessionInit.php', diff --git a/lib/l10n/cs.js b/lib/l10n/cs.js index 126b50acb96..e1906178bed 100644 --- a/lib/l10n/cs.js +++ b/lib/l10n/cs.js @@ -71,6 +71,9 @@ OC.L10N.register( "seconds ago" : "před pár sekundami", "Empty file" : "Prázdný soubor", "Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator." : "Modul s identifikátorem: %s neexistuje. Povolte ho v nastavení aplikací, nebo se obraťte na správce.", + "File already exists" : "Soubor už existuje", + "Failed to create file from template" : "Vytvoření souboru ze šablony selhalo", + "Templates" : "Šablony", "File name is a reserved word" : "Název souboru je rezervované slovo", "File name contains at least one invalid character" : "Název souboru obsahuje nejméně jeden neplatný znak", "File name is too long" : "Název souboru je příliš dlouhý", @@ -117,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Soubory nelze sdílet s oprávněními k vytváření", "Expiration date is in the past" : "Datum skončení platnosti je v minulosti", "Can’t set expiration date more than %s days in the future" : "Nelze nastavit datum skončení platnosti více než %s dní v budoucnu", + "Sharing is only allowed with group members" : "Je povoleno pouze sdílení s členy skupiny", "%1$s shared »%2$s« with you" : "%1$s s vámi sdílí „%2$s“", "%1$s shared »%2$s« with you." : "%1$s vám nasdílel(a) „%2$s“.", "Click the button below to open it." : "Pro otevření klikněte na tlačítko níže.", diff --git a/lib/l10n/cs.json b/lib/l10n/cs.json index 83ded4b1f4b..5e7d24e8384 100644 --- a/lib/l10n/cs.json +++ b/lib/l10n/cs.json @@ -69,6 +69,9 @@ "seconds ago" : "před pár sekundami", "Empty file" : "Prázdný soubor", "Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator." : "Modul s identifikátorem: %s neexistuje. Povolte ho v nastavení aplikací, nebo se obraťte na správce.", + "File already exists" : "Soubor už existuje", + "Failed to create file from template" : "Vytvoření souboru ze šablony selhalo", + "Templates" : "Šablony", "File name is a reserved word" : "Název souboru je rezervované slovo", "File name contains at least one invalid character" : "Název souboru obsahuje nejméně jeden neplatný znak", "File name is too long" : "Název souboru je příliš dlouhý", @@ -115,6 +118,7 @@ "Files can’t be shared with create permissions" : "Soubory nelze sdílet s oprávněními k vytváření", "Expiration date is in the past" : "Datum skončení platnosti je v minulosti", "Can’t set expiration date more than %s days in the future" : "Nelze nastavit datum skončení platnosti více než %s dní v budoucnu", + "Sharing is only allowed with group members" : "Je povoleno pouze sdílení s členy skupiny", "%1$s shared »%2$s« with you" : "%1$s s vámi sdílí „%2$s“", "%1$s shared »%2$s« with you." : "%1$s vám nasdílel(a) „%2$s“.", "Click the button below to open it." : "Pro otevření klikněte na tlačítko níže.", diff --git a/lib/l10n/de.js b/lib/l10n/de.js index 23fd7d086cf..91a18afb564 100644 --- a/lib/l10n/de.js +++ b/lib/l10n/de.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Dateien mit Erstell-Berechtigungen können nicht geteilt werden", "Expiration date is in the past" : "Das Ablaufdatum liegt in der Vergangenheit.", "Can’t set expiration date more than %s days in the future" : "Das Ablaufdatum kann nicht mehr als %s Tage in der Zukunft liegen", + "Sharing is only allowed with group members" : "Teilen ist nur mit Gruppenmitgliedern erlaubt", "%1$s shared »%2$s« with you" : "%1$s hat »%2$s« mit Dir geteilt", "%1$s shared »%2$s« with you." : "%1$s hat »%2$s« mit Dir geteilt.", "Click the button below to open it." : "Klicke zum Öffnen auf die untere Schaltfläche.", diff --git a/lib/l10n/de.json b/lib/l10n/de.json index 15c988cd180..0c88be9c936 100644 --- a/lib/l10n/de.json +++ b/lib/l10n/de.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Dateien mit Erstell-Berechtigungen können nicht geteilt werden", "Expiration date is in the past" : "Das Ablaufdatum liegt in der Vergangenheit.", "Can’t set expiration date more than %s days in the future" : "Das Ablaufdatum kann nicht mehr als %s Tage in der Zukunft liegen", + "Sharing is only allowed with group members" : "Teilen ist nur mit Gruppenmitgliedern erlaubt", "%1$s shared »%2$s« with you" : "%1$s hat »%2$s« mit Dir geteilt", "%1$s shared »%2$s« with you." : "%1$s hat »%2$s« mit Dir geteilt.", "Click the button below to open it." : "Klicke zum Öffnen auf die untere Schaltfläche.", diff --git a/lib/l10n/de_DE.js b/lib/l10n/de_DE.js index b9fc77624bf..a8f9362fdb7 100644 --- a/lib/l10n/de_DE.js +++ b/lib/l10n/de_DE.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Dateien mit Erstell-Berechtigungen können nicht geteilt werden", "Expiration date is in the past" : "Das Ablaufdatum liegt in der Vergangenheit.", "Can’t set expiration date more than %s days in the future" : "Das Ablaufdatum kann nicht mehr als %s Tage in der Zukunft liegen", + "Sharing is only allowed with group members" : "Teilen ist nur mit Gruppenmitgliedern erlaubt", "%1$s shared »%2$s« with you" : "%1$s hat »%2$s« mit Ihnen geteilt", "%1$s shared »%2$s« with you." : "%1$s hat »%2$s« mit Ihnen geteilt.", "Click the button below to open it." : "Klicken Sie zum Öffnen auf die untere Schaltfläche.", diff --git a/lib/l10n/de_DE.json b/lib/l10n/de_DE.json index e1475ce4bfb..484e3df8668 100644 --- a/lib/l10n/de_DE.json +++ b/lib/l10n/de_DE.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Dateien mit Erstell-Berechtigungen können nicht geteilt werden", "Expiration date is in the past" : "Das Ablaufdatum liegt in der Vergangenheit.", "Can’t set expiration date more than %s days in the future" : "Das Ablaufdatum kann nicht mehr als %s Tage in der Zukunft liegen", + "Sharing is only allowed with group members" : "Teilen ist nur mit Gruppenmitgliedern erlaubt", "%1$s shared »%2$s« with you" : "%1$s hat »%2$s« mit Ihnen geteilt", "%1$s shared »%2$s« with you." : "%1$s hat »%2$s« mit Ihnen geteilt.", "Click the button below to open it." : "Klicken Sie zum Öffnen auf die untere Schaltfläche.", diff --git a/lib/l10n/el.js b/lib/l10n/el.js index 34b198d8b03..333b3a89cb6 100644 --- a/lib/l10n/el.js +++ b/lib/l10n/el.js @@ -64,7 +64,7 @@ OC.L10N.register( "_in %n year_::_in %n years_" : ["σε %n χρόνο","σε %n χρόνια"], "_%n year ago_::_%n years ago_" : ["%n χρόνο πριν","%n χρόνια πριν"], "_in %n hour_::_in %n hours_" : ["σε %n ώρα","σε %n ώρες"], - "_%n hour ago_::_%n hours ago_" : ["%nώρα πριν","%nώρες πριν"], + "_%n hour ago_::_%n hours ago_" : ["%n ώρα πριν","%n ώρες πριν"], "_in %n minute_::_in %n minutes_" : ["σε %n λεπτό","σε %n λεπτά"], "_%n minute ago_::_%n minutes ago_" : ["%nλεπτό πριν","%nλεπτά πριν"], "in a few seconds" : "σε λίγα δευτερόλεπτα", diff --git a/lib/l10n/el.json b/lib/l10n/el.json index 701eadd1bb5..efa2d0089ba 100644 --- a/lib/l10n/el.json +++ b/lib/l10n/el.json @@ -62,7 +62,7 @@ "_in %n year_::_in %n years_" : ["σε %n χρόνο","σε %n χρόνια"], "_%n year ago_::_%n years ago_" : ["%n χρόνο πριν","%n χρόνια πριν"], "_in %n hour_::_in %n hours_" : ["σε %n ώρα","σε %n ώρες"], - "_%n hour ago_::_%n hours ago_" : ["%nώρα πριν","%nώρες πριν"], + "_%n hour ago_::_%n hours ago_" : ["%n ώρα πριν","%n ώρες πριν"], "_in %n minute_::_in %n minutes_" : ["σε %n λεπτό","σε %n λεπτά"], "_%n minute ago_::_%n minutes ago_" : ["%nλεπτό πριν","%nλεπτά πριν"], "in a few seconds" : "σε λίγα δευτερόλεπτα", diff --git a/lib/l10n/es.js b/lib/l10n/es.js index a258a225479..36f89452ce3 100644 --- a/lib/l10n/es.js +++ b/lib/l10n/es.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Los archivos no se pueden compartir con permisos de creación", "Expiration date is in the past" : "Ha pasado la fecha de caducidad", "Can’t set expiration date more than %s days in the future" : "No se puede establecer la fecha de expiración a más de %s días en el futuro", + "Sharing is only allowed with group members" : "Sólo está permitido compartir a los integrantes del grupo", "%1$s shared »%2$s« with you" : "%1$s ha compartido «%2$s» contigo", "%1$s shared »%2$s« with you." : "%1$s ha compartido «%2$s» contigo.", "Click the button below to open it." : "Haz clic en el botón de abajo para abrirlo.", diff --git a/lib/l10n/es.json b/lib/l10n/es.json index 47db4376940..d9593e08a6c 100644 --- a/lib/l10n/es.json +++ b/lib/l10n/es.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Los archivos no se pueden compartir con permisos de creación", "Expiration date is in the past" : "Ha pasado la fecha de caducidad", "Can’t set expiration date more than %s days in the future" : "No se puede establecer la fecha de expiración a más de %s días en el futuro", + "Sharing is only allowed with group members" : "Sólo está permitido compartir a los integrantes del grupo", "%1$s shared »%2$s« with you" : "%1$s ha compartido «%2$s» contigo", "%1$s shared »%2$s« with you." : "%1$s ha compartido «%2$s» contigo.", "Click the button below to open it." : "Haz clic en el botón de abajo para abrirlo.", diff --git a/lib/l10n/gl.js b/lib/l10n/gl.js index 48952984600..ac01b37634d 100644 --- a/lib/l10n/gl.js +++ b/lib/l10n/gl.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Non é posíbel compartir ficheiros con permisos de creación", "Expiration date is in the past" : "Xa pasou a data de caducidade", "Can’t set expiration date more than %s days in the future" : "Non é posíbel estabelecer a data de caducidade máis alo de %s días no futuro", + "Sharing is only allowed with group members" : "Só se permite compartir cos membros do grupo", "%1$s shared »%2$s« with you" : "%1$s compartiu «%2$s» con vostede", "%1$s shared »%2$s« with you." : "%1$s compartiu «%2$s» con vostede.", "Click the button below to open it." : "Prema no botón de embaixo para abrilo.", diff --git a/lib/l10n/gl.json b/lib/l10n/gl.json index 6180840f716..4a939684e9d 100644 --- a/lib/l10n/gl.json +++ b/lib/l10n/gl.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Non é posíbel compartir ficheiros con permisos de creación", "Expiration date is in the past" : "Xa pasou a data de caducidade", "Can’t set expiration date more than %s days in the future" : "Non é posíbel estabelecer a data de caducidade máis alo de %s días no futuro", + "Sharing is only allowed with group members" : "Só se permite compartir cos membros do grupo", "%1$s shared »%2$s« with you" : "%1$s compartiu «%2$s» con vostede", "%1$s shared »%2$s« with you." : "%1$s compartiu «%2$s» con vostede.", "Click the button below to open it." : "Prema no botón de embaixo para abrilo.", diff --git a/lib/l10n/it.js b/lib/l10n/it.js index c4e27ed9ba4..c339ae1b773 100644 --- a/lib/l10n/it.js +++ b/lib/l10n/it.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "I file non possono essere condivisi con permessi di creazione", "Expiration date is in the past" : "La data di scadenza è nel passato", "Can’t set expiration date more than %s days in the future" : "Impossibile impostare la data di scadenza a più di %s giorni nel futuro", + "Sharing is only allowed with group members" : "La condivisione è consentita solo con i membri del gruppo", "%1$s shared »%2$s« with you" : "%1$s ha condiviso «%2$s» con te", "%1$s shared »%2$s« with you." : "%1$s ha condiviso «%2$s» con te.", "Click the button below to open it." : "Fai clic sul pulsante sotto per aprirlo.", diff --git a/lib/l10n/it.json b/lib/l10n/it.json index 49194e50a0e..730f78dfe32 100644 --- a/lib/l10n/it.json +++ b/lib/l10n/it.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "I file non possono essere condivisi con permessi di creazione", "Expiration date is in the past" : "La data di scadenza è nel passato", "Can’t set expiration date more than %s days in the future" : "Impossibile impostare la data di scadenza a più di %s giorni nel futuro", + "Sharing is only allowed with group members" : "La condivisione è consentita solo con i membri del gruppo", "%1$s shared »%2$s« with you" : "%1$s ha condiviso «%2$s» con te", "%1$s shared »%2$s« with you." : "%1$s ha condiviso «%2$s» con te.", "Click the button below to open it." : "Fai clic sul pulsante sotto per aprirlo.", diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js index 16ed9415488..f3916e5cdbc 100644 --- a/lib/l10n/nl.js +++ b/lib/l10n/nl.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Bestanden kunnen niet worden gedeeld met 'creëer' permissies", "Expiration date is in the past" : "De vervaldatum ligt in het verleden", "Can’t set expiration date more than %s days in the future" : "Kan de vervaldatum niet meer dan %s dagen in de toekomst instellen", + "Sharing is only allowed with group members" : "Delen kan alleen met groepsleden", "%1$s shared »%2$s« with you" : "%1$s deelde \"%2$s\" met jou", "%1$s shared »%2$s« with you." : "%1$s deelde \"%2$s\" met jou.", "Click the button below to open it." : "Klik de onderstaande button om te openen.", diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json index e98a8028684..ed98ae2f073 100644 --- a/lib/l10n/nl.json +++ b/lib/l10n/nl.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Bestanden kunnen niet worden gedeeld met 'creëer' permissies", "Expiration date is in the past" : "De vervaldatum ligt in het verleden", "Can’t set expiration date more than %s days in the future" : "Kan de vervaldatum niet meer dan %s dagen in de toekomst instellen", + "Sharing is only allowed with group members" : "Delen kan alleen met groepsleden", "%1$s shared »%2$s« with you" : "%1$s deelde \"%2$s\" met jou", "%1$s shared »%2$s« with you." : "%1$s deelde \"%2$s\" met jou.", "Click the button below to open it." : "Klik de onderstaande button om te openen.", diff --git a/lib/l10n/pl.js b/lib/l10n/pl.js index c5e9323258e..55463f2d2e7 100644 --- a/lib/l10n/pl.js +++ b/lib/l10n/pl.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Pliki nie mogą zostać udostępnione z prawem do tworzenia", "Expiration date is in the past" : "Data ważności już minęła", "Can’t set expiration date more than %s days in the future" : "Nie można ustawić daty ważności na dłuższą niż %s dni", + "Sharing is only allowed with group members" : "Udostępnianie jest dozwolone tylko członkom grupy", "%1$s shared »%2$s« with you" : "%1$s udostępnił Tobie »%2$s«", "%1$s shared »%2$s« with you." : "%1$s udostępnił Tobie »%2$s«.", "Click the button below to open it." : "Kliknij przycisk poniżej, aby otworzyć.", diff --git a/lib/l10n/pl.json b/lib/l10n/pl.json index 34bc2557dcc..3dfa15bac1a 100644 --- a/lib/l10n/pl.json +++ b/lib/l10n/pl.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Pliki nie mogą zostać udostępnione z prawem do tworzenia", "Expiration date is in the past" : "Data ważności już minęła", "Can’t set expiration date more than %s days in the future" : "Nie można ustawić daty ważności na dłuższą niż %s dni", + "Sharing is only allowed with group members" : "Udostępnianie jest dozwolone tylko członkom grupy", "%1$s shared »%2$s« with you" : "%1$s udostępnił Tobie »%2$s«", "%1$s shared »%2$s« with you." : "%1$s udostępnił Tobie »%2$s«.", "Click the button below to open it." : "Kliknij przycisk poniżej, aby otworzyć.", diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js index 84cb9a1ff5d..1de1cdeaf85 100644 --- a/lib/l10n/pt_BR.js +++ b/lib/l10n/pt_BR.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Os arquivos não podem ser compartilhados com permissões de criação", "Expiration date is in the past" : "Data de expiração está no passado", "Can’t set expiration date more than %s days in the future" : "Não é possível definir a expiração mais do que %s dias no futuro", + "Sharing is only allowed with group members" : "O compartilhamento só é permitido com membros do grupo ", "%1$s shared »%2$s« with you" : "%1$s compartilhou »%2$s« com você", "%1$s shared »%2$s« with you." : "%1$s compartilhou »%2$s« com você.", "Click the button below to open it." : "Clique no botão abaixo para abri-lo.", diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json index 0f02642ec3f..13ea3dc3323 100644 --- a/lib/l10n/pt_BR.json +++ b/lib/l10n/pt_BR.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Os arquivos não podem ser compartilhados com permissões de criação", "Expiration date is in the past" : "Data de expiração está no passado", "Can’t set expiration date more than %s days in the future" : "Não é possível definir a expiração mais do que %s dias no futuro", + "Sharing is only allowed with group members" : "O compartilhamento só é permitido com membros do grupo ", "%1$s shared »%2$s« with you" : "%1$s compartilhou »%2$s« com você", "%1$s shared »%2$s« with you." : "%1$s compartilhou »%2$s« com você.", "Click the button below to open it." : "Clique no botão abaixo para abri-lo.", diff --git a/lib/l10n/ru.js b/lib/l10n/ru.js index 4e32d7cd6a1..05bbe3a7ab3 100644 --- a/lib/l10n/ru.js +++ b/lib/l10n/ru.js @@ -71,6 +71,9 @@ OC.L10N.register( "seconds ago" : "несколько секунд назад", "Empty file" : "Пустой файл", "Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator." : "Модуль с ID «%s» не существует. Включите его в настройках приложений или обратитесь к администратору.", + "File already exists" : "Файл уже существует", + "Failed to create file from template" : "Не удалось создать файл на основе шаблона", + "Templates" : "Шаблоны", "File name is a reserved word" : "Имя файла является зарезервированным словом", "File name contains at least one invalid character" : "Имя файла содержит по крайней мере один некорректный символ", "File name is too long" : "Имя файла слишком длинное.", @@ -117,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Файлы не могут иметь общий доступ с правами на создание", "Expiration date is in the past" : "Дата окончания срока действия уже прошла", "Can’t set expiration date more than %s days in the future" : "Невозможно установить дату окончания срока действия более %s дней", + "Sharing is only allowed with group members" : "Разрешено публиковать только для участников группы", "%1$s shared »%2$s« with you" : "%1$s предоставил(а) вам доступ к «%2$s»", "%1$s shared »%2$s« with you." : "%1$s предоставил(а) вам доступ к «%2$s».", "Click the button below to open it." : "Нажмите расположенную ниже кнопку для перехода к полученному общему ресурсу.", diff --git a/lib/l10n/ru.json b/lib/l10n/ru.json index 38855a30371..dfcd6288663 100644 --- a/lib/l10n/ru.json +++ b/lib/l10n/ru.json @@ -69,6 +69,9 @@ "seconds ago" : "несколько секунд назад", "Empty file" : "Пустой файл", "Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator." : "Модуль с ID «%s» не существует. Включите его в настройках приложений или обратитесь к администратору.", + "File already exists" : "Файл уже существует", + "Failed to create file from template" : "Не удалось создать файл на основе шаблона", + "Templates" : "Шаблоны", "File name is a reserved word" : "Имя файла является зарезервированным словом", "File name contains at least one invalid character" : "Имя файла содержит по крайней мере один некорректный символ", "File name is too long" : "Имя файла слишком длинное.", @@ -115,6 +118,7 @@ "Files can’t be shared with create permissions" : "Файлы не могут иметь общий доступ с правами на создание", "Expiration date is in the past" : "Дата окончания срока действия уже прошла", "Can’t set expiration date more than %s days in the future" : "Невозможно установить дату окончания срока действия более %s дней", + "Sharing is only allowed with group members" : "Разрешено публиковать только для участников группы", "%1$s shared »%2$s« with you" : "%1$s предоставил(а) вам доступ к «%2$s»", "%1$s shared »%2$s« with you." : "%1$s предоставил(а) вам доступ к «%2$s».", "Click the button below to open it." : "Нажмите расположенную ниже кнопку для перехода к полученному общему ресурсу.", diff --git a/lib/l10n/tr.js b/lib/l10n/tr.js index 43365676bcc..0bc65aab382 100644 --- a/lib/l10n/tr.js +++ b/lib/l10n/tr.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "Ekleme izni ile dosya paylaşılamaz", "Expiration date is in the past" : "Son kullanma tarihi geçmişte", "Can’t set expiration date more than %s days in the future" : "Son kullanma tarihi %sgünden sonrası olarak ayarlanamaz", + "Sharing is only allowed with group members" : "Paylaşım yalnız grup üyeleri ile yapılabilir", "%1$s shared »%2$s« with you" : "%1$s, sizinle »%2$s« ögesini paylaştı", "%1$s shared »%2$s« with you." : "%1$s, sizinle »%2$s« ögesini paylaştı.", "Click the button below to open it." : "Açmak için aşağıdaki düğmeye tıklayın.", diff --git a/lib/l10n/tr.json b/lib/l10n/tr.json index 9a8ab7634f1..63f49b9510c 100644 --- a/lib/l10n/tr.json +++ b/lib/l10n/tr.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "Ekleme izni ile dosya paylaşılamaz", "Expiration date is in the past" : "Son kullanma tarihi geçmişte", "Can’t set expiration date more than %s days in the future" : "Son kullanma tarihi %sgünden sonrası olarak ayarlanamaz", + "Sharing is only allowed with group members" : "Paylaşım yalnız grup üyeleri ile yapılabilir", "%1$s shared »%2$s« with you" : "%1$s, sizinle »%2$s« ögesini paylaştı", "%1$s shared »%2$s« with you." : "%1$s, sizinle »%2$s« ögesini paylaştı.", "Click the button below to open it." : "Açmak için aşağıdaki düğmeye tıklayın.", diff --git a/lib/l10n/zh_CN.js b/lib/l10n/zh_CN.js index 898d6820416..fdfe9f90a80 100644 --- a/lib/l10n/zh_CN.js +++ b/lib/l10n/zh_CN.js @@ -120,6 +120,7 @@ OC.L10N.register( "Files can’t be shared with create permissions" : "无法共享有创建权限的文件", "Expiration date is in the past" : "到期日期已过", "Can’t set expiration date more than %s days in the future" : "无法将过期日期设置为超过 %s 天。", + "Sharing is only allowed with group members" : "只允许与群组成员共享", "%1$s shared »%2$s« with you" : "%1$s 对您共享了 »%2$s«", "%1$s shared »%2$s« with you." : "%1$s 对您共享了 »%2$s«。", "Click the button below to open it." : "点击下方按钮可打开它。", diff --git a/lib/l10n/zh_CN.json b/lib/l10n/zh_CN.json index 3c44ebe0efc..dbd6d4ca6c5 100644 --- a/lib/l10n/zh_CN.json +++ b/lib/l10n/zh_CN.json @@ -118,6 +118,7 @@ "Files can’t be shared with create permissions" : "无法共享有创建权限的文件", "Expiration date is in the past" : "到期日期已过", "Can’t set expiration date more than %s days in the future" : "无法将过期日期设置为超过 %s 天。", + "Sharing is only allowed with group members" : "只允许与群组成员共享", "%1$s shared »%2$s« with you" : "%1$s 对您共享了 »%2$s«", "%1$s shared »%2$s« with you." : "%1$s 对您共享了 »%2$s«。", "Click the button below to open it." : "点击下方按钮可打开它。", diff --git a/lib/l10n/zh_HK.js b/lib/l10n/zh_HK.js index 235781807ad..da2e98c5bf3 100644 --- a/lib/l10n/zh_HK.js +++ b/lib/l10n/zh_HK.js @@ -47,7 +47,7 @@ OC.L10N.register( "Remote wipe finished" : "遠端抹除已完成", "The remote wipe on %s has finished" : "%s 的遠端抹除已經完成", "Authentication" : "認證", - "Unknown filetype" : "未知的檔案類型", + "Unknown filetype" : "不詳的檔案類型", "Invalid image" : "無效的圖片", "Avatar image is not square" : "頭像不是正方形", "today" : "今天", @@ -81,14 +81,14 @@ OC.L10N.register( "Empty filename is not allowed" : "不允許空白的檔名", "App \"%s\" cannot be installed because appinfo file cannot be read." : "應用程式 \"%s\" 無法安裝,因為無法讀取 appinfo 檔案。", "App \"%s\" cannot be installed because it is not compatible with this version of the server." : "應用程式 \"%s\" 無法安裝,因為該應用程式不相容於目前版本的伺服器。", - "__language_name__" : "正體中文(臺灣)", + "__language_name__" : "正體中文(香港)", "This is an automatically sent email, please do not reply." : "此為自動寄送的電子郵件,請不要回覆。", "Help" : "說明", "Apps" : "應用程式", "Settings" : "設定", "Log out" : "登出", - "Users" : "使用者", - "Unknown user" : "未知的使用者", + "Users" : "用戶", + "Unknown user" : "用戶不詳", "Additional settings" : "其他設定", "%s enter the database username and name." : "%s 輸入資料庫名稱及使用者名稱", "%s enter the database username." : "%s 輸入資料庫使用者名稱", diff --git a/lib/l10n/zh_HK.json b/lib/l10n/zh_HK.json index 99ea67540c2..2c156f0f83b 100644 --- a/lib/l10n/zh_HK.json +++ b/lib/l10n/zh_HK.json @@ -45,7 +45,7 @@ "Remote wipe finished" : "遠端抹除已完成", "The remote wipe on %s has finished" : "%s 的遠端抹除已經完成", "Authentication" : "認證", - "Unknown filetype" : "未知的檔案類型", + "Unknown filetype" : "不詳的檔案類型", "Invalid image" : "無效的圖片", "Avatar image is not square" : "頭像不是正方形", "today" : "今天", @@ -79,14 +79,14 @@ "Empty filename is not allowed" : "不允許空白的檔名", "App \"%s\" cannot be installed because appinfo file cannot be read." : "應用程式 \"%s\" 無法安裝,因為無法讀取 appinfo 檔案。", "App \"%s\" cannot be installed because it is not compatible with this version of the server." : "應用程式 \"%s\" 無法安裝,因為該應用程式不相容於目前版本的伺服器。", - "__language_name__" : "正體中文(臺灣)", + "__language_name__" : "正體中文(香港)", "This is an automatically sent email, please do not reply." : "此為自動寄送的電子郵件,請不要回覆。", "Help" : "說明", "Apps" : "應用程式", "Settings" : "設定", "Log out" : "登出", - "Users" : "使用者", - "Unknown user" : "未知的使用者", + "Users" : "用戶", + "Unknown user" : "用戶不詳", "Additional settings" : "其他設定", "%s enter the database username and name." : "%s 輸入資料庫名稱及使用者名稱", "%s enter the database username." : "%s 輸入資料庫使用者名稱", diff --git a/lib/private/AppFramework/Bootstrap/ARegistration.php b/lib/private/AppFramework/Bootstrap/ARegistration.php new file mode 100644 index 00000000000..1dde102ca34 --- /dev/null +++ b/lib/private/AppFramework/Bootstrap/ARegistration.php @@ -0,0 +1,46 @@ +<?php + +declare(strict_types=1); + +/* + * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\AppFramework\Bootstrap; + +/** + * @psalm-immutable + */ +abstract class ARegistration { + + /** @var string */ + private $appId; + + public function __construct(string $appId) { + $this->appId = $appId; + } + + /** + * @return string + */ + public function getAppId(): string { + return $this->appId; + } +} diff --git a/lib/private/AppFramework/Bootstrap/EventListenerRegistration.php b/lib/private/AppFramework/Bootstrap/EventListenerRegistration.php new file mode 100644 index 00000000000..17816466970 --- /dev/null +++ b/lib/private/AppFramework/Bootstrap/EventListenerRegistration.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/* + * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\AppFramework\Bootstrap; + +/** + * @psalm-immutable + * @template-extends ServiceRegistration<\OCP\EventDispatcher\IEventListener> + */ +class EventListenerRegistration extends ServiceRegistration { + + /** @var string */ + private $event; + + /** @var int */ + private $priority; + + public function __construct(string $appId, + string $event, + string $service, + int $priority) { + parent::__construct($appId, $service); + $this->event = $event; + $this->priority = $priority; + } + + /** + * @return string + */ + public function getEvent(): string { + return $this->event; + } + + /** + * @return int + */ + public function getPriority(): int { + return $this->priority; + } +} diff --git a/lib/private/AppFramework/Bootstrap/ParameterRegistration.php b/lib/private/AppFramework/Bootstrap/ParameterRegistration.php new file mode 100644 index 00000000000..2e31d708ee7 --- /dev/null +++ b/lib/private/AppFramework/Bootstrap/ParameterRegistration.php @@ -0,0 +1,57 @@ +<?php + +declare(strict_types=1); + +/* + * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\AppFramework\Bootstrap; + +/** + * @psalm-immutable + */ +final class ParameterRegistration extends ARegistration { + + /** @var string */ + private $name; + + /** @var mixed */ + private $value; + + public function __construct(string $appId, + string $name, + $value) { + parent::__construct($appId); + $this->name = $name; + $this->value = $value; + } + + public function getName(): string { + return $this->name; + } + + /** + * @return mixed + */ + public function getValue() { + return $this->value; + } +} diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index d2dc365d835..fc13a78f3d3 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -34,50 +34,58 @@ use Closure; use OC\Support\CrashReport\Registry; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\Middleware; +use OCP\Authentication\IAlternativeLogin; +use OCP\Capabilities\ICapability; use OCP\Dashboard\IManager; +use OCP\Dashboard\IWidget; use OCP\EventDispatcher\IEventDispatcher; +use OCP\Files\Template\ICustomTemplateProvider; +use OCP\Http\WellKnown\IHandler; use OCP\ILogger; +use OCP\Search\IProvider; +use OCP\Support\CrashReport\IReporter; use Throwable; class RegistrationContext { - /** @var array[] */ + /** @var ServiceRegistration<ICapability>[] */ private $capabilities = []; - /** @var array[] */ + /** @var ServiceRegistration<IReporter>[] */ private $crashReporters = []; - /** @var array[] */ + /** @var ServiceRegistration<IWidget>[] */ private $dashboardPanels = []; - /** @var array[] */ + /** @var ServiceFactoryRegistration[] */ private $services = []; - /** @var array[] */ + /** @var ServiceAliasRegistration[] */ private $aliases = []; - /** @var array[] */ + /** @var ParameterRegistration[] */ private $parameters = []; - /** @var array[] */ + /** @var EventListenerRegistration[] */ private $eventListeners = []; - /** @var array[] */ + /** @var ServiceRegistration<Middleware>[] */ private $middlewares = []; - /** @var array[] */ + /** @var ServiceRegistration<IProvider>[] */ private $searchProviders = []; - /** @var array[] */ + /** @var ServiceRegistration<IAlternativeLogin>[] */ private $alternativeLogins = []; /** @var array[] */ private $initialStates = []; - /** @var array[] */ + /** @var ServiceRegistration<IHandler>[] */ private $wellKnownHandlers = []; - /** @var array[] */ + /** @var ServiceRegistration<ICustomTemplateProvider>[] */ private $templateProviders = []; /** @var ILogger */ @@ -199,80 +207,56 @@ class RegistrationContext { }; } + /** + * @psalm-param class-string<ICapability> $capability + */ public function registerCapability(string $appId, string $capability): void { - $this->capabilities[] = [ - 'appId' => $appId, - 'capability' => $capability - ]; + $this->capabilities[] = new ServiceRegistration($appId, $capability); } + /** + * @psalm-param class-string<IReporter> $capability + */ public function registerCrashReporter(string $appId, string $reporterClass): void { - $this->crashReporters[] = [ - 'appId' => $appId, - 'class' => $reporterClass, - ]; + $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass); } + /** + * @psalm-param class-string<IWidget> $capability + */ public function registerDashboardPanel(string $appId, string $panelClass): void { - $this->dashboardPanels[] = [ - 'appId' => $appId, - 'class' => $panelClass - ]; + $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass); } public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void { - $this->services[] = [ - "appId" => $appId, - "name" => $name, - "factory" => $factory, - "shared" => $shared, - ]; + $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared); } public function registerServiceAlias(string $appId, string $alias, string $target): void { - $this->aliases[] = [ - "appId" => $appId, - "alias" => $alias, - "target" => $target, - ]; + $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target); } public function registerParameter(string $appId, string $name, $value): void { - $this->parameters[] = [ - "appId" => $appId, - "name" => $name, - "value" => $value, - ]; + $this->parameters[] = new ParameterRegistration($appId, $name, $value); } public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void { - $this->eventListeners[] = [ - "appId" => $appId, - "event" => $event, - "listener" => $listener, - "priority" => $priority, - ]; + $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority); } + /** + * @psalm-param class-string<Middleware> $class + */ public function registerMiddleware(string $appId, string $class): void { - $this->middlewares[] = [ - "appId" => $appId, - "class" => $class, - ]; + $this->middlewares[] = new ServiceRegistration($appId, $class); } public function registerSearchProvider(string $appId, string $class) { - $this->searchProviders[] = [ - 'appId' => $appId, - 'class' => $class, - ]; + $this->searchProviders[] = new ServiceRegistration($appId, $class); } public function registerAlternativeLogin(string $appId, string $class): void { - $this->alternativeLogins[] = [ - 'appId' => $appId, - 'class' => $class, - ]; + $this->alternativeLogins[] = new ServiceRegistration($appId, $class); } public function registerInitialState(string $appId, string $class): void { @@ -283,17 +267,11 @@ class RegistrationContext { } public function registerWellKnown(string $appId, string $class): void { - $this->wellKnownHandlers[] = [ - 'appId' => $appId, - 'class' => $class, - ]; + $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class); } public function registerTemplateProvider(string $appId, string $class): void { - $this->templateProviders[] = [ - 'appId' => $appId, - 'class' => $class, - ]; + $this->templateProviders[] = new ServiceRegistration($appId, $class); } /** @@ -302,11 +280,11 @@ class RegistrationContext { public function delegateCapabilityRegistrations(array $apps): void { while (($registration = array_shift($this->capabilities)) !== null) { try { - $apps[$registration['appId']] + $apps[$registration->getAppId()] ->getContainer() - ->registerCapability($registration['capability']); + ->registerCapability($registration->getService()); } catch (Throwable $e) { - $appId = $registration['appId']; + $appId = $registration->getAppId(); $this->logger->logException($e, [ 'message' => "Error during capability registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -321,9 +299,9 @@ class RegistrationContext { public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void { while (($registration = array_shift($this->crashReporters)) !== null) { try { - $registry->registerLazy($registration['class']); + $registry->registerLazy($registration->getService()); } catch (Throwable $e) { - $appId = $registration['appId']; + $appId = $registration->getAppId(); $this->logger->logException($e, [ 'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -338,9 +316,9 @@ class RegistrationContext { public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void { while (($panel = array_shift($this->dashboardPanels)) !== null) { try { - $dashboardManager->lazyRegisterWidget($panel['class']); + $dashboardManager->lazyRegisterWidget($panel->getService()); } catch (Throwable $e) { - $appId = $panel['appId']; + $appId = $panel->getAppId(); $this->logger->logException($e, [ 'message' => "Error during dashboard registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -352,20 +330,13 @@ class RegistrationContext { public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void { while (($registration = array_shift($this->eventListeners)) !== null) { try { - if (isset($registration['priority'])) { - $eventDispatcher->addServiceListener( - $registration['event'], - $registration['listener'], - $registration['priority'] - ); - } else { - $eventDispatcher->addServiceListener( - $registration['event'], - $registration['listener'] - ); - } + $eventDispatcher->addServiceListener( + $registration->getEvent(), + $registration->getService(), + $registration->getPriority() + ); } catch (Throwable $e) { - $appId = $registration['appId']; + $appId = $registration->getAppId(); $this->logger->logException($e, [ 'message' => "Error during event listener registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -383,15 +354,15 @@ class RegistrationContext { /** * Register the service and convert the callable into a \Closure if necessary */ - $apps[$registration['appId']] + $apps[$registration->getAppId()] ->getContainer() ->registerService( - $registration['name'], - Closure::fromCallable($registration['factory']), - $registration['shared'] ?? true + $registration->getName(), + Closure::fromCallable($registration->getFactory()), + $registration->isShared() ); } catch (Throwable $e) { - $appId = $registration['appId']; + $appId = $registration->getAppId(); $this->logger->logException($e, [ 'message' => "Error during service registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -401,14 +372,14 @@ class RegistrationContext { foreach ($this->aliases as $registration) { try { - $apps[$registration['appId']] + $apps[$registration->getAppId()] ->getContainer() ->registerAlias( - $registration['alias'], - $registration['target'] + $registration->getAlias(), + $registration->getTarget() ); } catch (Throwable $e) { - $appId = $registration['appId']; + $appId = $registration->getAppId(); $this->logger->logException($e, [ 'message' => "Error during service alias registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -418,14 +389,14 @@ class RegistrationContext { foreach ($this->parameters as $registration) { try { - $apps[$registration['appId']] + $apps[$registration->getAppId()] ->getContainer() ->registerParameter( - $registration['name'], - $registration['value'] + $registration->getName(), + $registration->getValue() ); } catch (Throwable $e) { - $appId = $registration['appId']; + $appId = $registration->getAppId(); $this->logger->logException($e, [ 'message' => "Error during service alias registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -440,11 +411,11 @@ class RegistrationContext { public function delegateMiddlewareRegistrations(array $apps): void { while (($middleware = array_shift($this->middlewares)) !== null) { try { - $apps[$middleware['appId']] + $apps[$middleware->getAppId()] ->getContainer() - ->registerMiddleWare($middleware['class']); + ->registerMiddleWare($middleware->getService()); } catch (Throwable $e) { - $appId = $middleware['appId']; + $appId = $middleware->getAppId(); $this->logger->logException($e, [ 'message' => "Error during capability registration of $appId: " . $e->getMessage(), 'level' => ILogger::ERROR, @@ -454,14 +425,14 @@ class RegistrationContext { } /** - * @return array[] + * @return ServiceRegistration<IProvider>[] */ public function getSearchProviders(): array { return $this->searchProviders; } /** - * @return array[] + * @return ServiceRegistration<IAlternativeLogin>[] */ public function getAlternativeLogins(): array { return $this->alternativeLogins; @@ -475,12 +446,15 @@ class RegistrationContext { } /** - * @return array[] + * @return ServiceRegistration<IHandler>[] */ public function getWellKnownHandlers(): array { return $this->wellKnownHandlers; } + /** + * @return ServiceRegistration<ICustomTemplateProvider>[] + */ public function getTemplateProviders(): array { return $this->templateProviders; } diff --git a/lib/private/AppFramework/Bootstrap/ServiceAliasRegistration.php b/lib/private/AppFramework/Bootstrap/ServiceAliasRegistration.php new file mode 100644 index 00000000000..04823172ed2 --- /dev/null +++ b/lib/private/AppFramework/Bootstrap/ServiceAliasRegistration.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/* + * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\AppFramework\Bootstrap; + +/** + * @psalm-immutable + */ +class ServiceAliasRegistration extends ARegistration { + + /** + * @var string + * @psalm-var string|class-string + */ + private $alias; + + /** + * @var string + * @psalm-var string|class-string + */ + private $target; + + /** + * @psalm-param string|class-string $alias + * @paslm-param string|class-string $target + */ + public function __construct(string $appId, + string $alias, + string $target) { + parent::__construct($appId); + $this->alias = $alias; + $this->target = $target; + } + + /** + * @psalm-return string|class-string + */ + public function getAlias(): string { + return $this->alias; + } + + /** + * @psalm-return string|class-string + */ + public function getTarget(): string { + return $this->target; + } +} diff --git a/lib/private/AppFramework/Bootstrap/ServiceFactoryRegistration.php b/lib/private/AppFramework/Bootstrap/ServiceFactoryRegistration.php new file mode 100644 index 00000000000..4776c5df55c --- /dev/null +++ b/lib/private/AppFramework/Bootstrap/ServiceFactoryRegistration.php @@ -0,0 +1,72 @@ +<?php + +declare(strict_types=1); + +/* + * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\AppFramework\Bootstrap; + +/** + * @psalm-immutable + */ +class ServiceFactoryRegistration extends ARegistration { + + /** + * @var string + * @psalm-var string|class-string + */ + private $name; + + /** + * @var callable + * @psalm-var callable(\Psr\Container\ContainerInterface): mixed + */ + private $factory; + + /** @var bool */ + private $shared; + + public function __construct(string $appId, + string $alias, + callable $target, + bool $shared) { + parent::__construct($appId); + $this->name = $alias; + $this->factory = $target; + $this->shared = $shared; + } + + public function getName(): string { + return $this->name; + } + + /** + * @psalm-return callable(\Psr\Container\ContainerInterface): mixed + */ + public function getFactory(): callable { + return $this->factory; + } + + public function isShared(): bool { + return $this->shared; + } +} diff --git a/lib/private/AppFramework/Bootstrap/ServiceRegistration.php b/lib/private/AppFramework/Bootstrap/ServiceRegistration.php new file mode 100644 index 00000000000..83ffe01e6c3 --- /dev/null +++ b/lib/private/AppFramework/Bootstrap/ServiceRegistration.php @@ -0,0 +1,53 @@ +<?php + +declare(strict_types=1); + +/* + * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\AppFramework\Bootstrap; + +/** + * @psalm-immutable + * @template T + */ +class ServiceRegistration extends ARegistration { + /** + * @var string + * @psalm-var class-string<T> + */ + private $service; + + /** + * @psalm-param class-string<T> $service + */ + public function __construct(string $appId, string $service) { + parent::__construct($appId); + $this->service = $service; + } + + /** + * @psalm-return class-string<T> + */ + public function getService(): string { + return $this->service; + } +} diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index f73e09e645e..2aa5da116e6 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -93,7 +93,12 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { if ($parameterType !== null && !$parameterType->isBuiltin()) { $resolveName = $parameter->getName(); - return $this->query($resolveName); + try { + return $this->query($resolveName); + } catch (QueryException $e2) { + // don't lose the error we got while trying to query by type + throw new QueryException($e2->getMessage(), (int) $e2->getCode(), $e); + } } throw $e; diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index 38551e63b87..a293d2a8404 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -414,11 +414,6 @@ class PublicKeyTokenProvider implements IProvider { public function updatePasswords(string $uid, string $password) { $this->cache->clear(); - if (!$this->mapper->hasExpiredTokens($uid)) { - // Nothing to do here - return; - } - // Update the password for all tokens $tokens = $this->mapper->getTokenByUser($uid); foreach ($tokens as $t) { diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index 7368425174a..8517bef5893 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -233,6 +233,9 @@ class Comment implements IComment { return []; } $uids = array_unique($mentions[0]); + usort($uids, static function ($uid1, $uid2) { + return mb_strlen($uid2) <=> mb_strlen($uid1); + }); $result = []; foreach ($uids as $uid) { $cleanUid = trim(substr($uid, 1), '"'); diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 10c578f41e0..9b1cc57aed3 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -221,7 +221,11 @@ class Application { $c = \OC::$server->query($command); } catch (QueryException $e) { if (class_exists($command)) { - $c = new $command(); + try { + $c = new $command(); + } catch (\ArgumentCountError $e2) { + throw new \Exception("Failed to construct console command '$command': " . $e->getMessage(), 0, $e); + } } else { throw new \Exception("Console command '$command' is unknown and could not be loaded"); } diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index cb7af4d51e2..4d9433122ce 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -53,7 +53,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\ILogger; use OCP\PreConditionNotMetException; -class Connection extends ReconnectWrapper { +class Connection extends \Doctrine\DBAL\Connection { /** @var string */ protected $tablePrefix; @@ -172,6 +172,9 @@ class Connection extends ReconnectWrapper { if (!isset($params['tablePrefix'])) { throw new \Exception('tablePrefix not set'); } + /** + * @psalm-suppress InternalMethod + */ parent::__construct($params, $driver, $config, $eventManager); $this->adapter = new $params['adapter']($this); $this->tablePrefix = $params['tablePrefix']; diff --git a/lib/private/DB/ReconnectWrapper.php b/lib/private/DB/ReconnectWrapper.php deleted file mode 100644 index a0170152862..00000000000 --- a/lib/private/DB/ReconnectWrapper.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Robin Appelman <robin@icewind.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OC\DB; - -use Doctrine\Common\EventManager; -use Doctrine\DBAL\Configuration; -use Doctrine\DBAL\Driver; - -class ReconnectWrapper extends \Doctrine\DBAL\Connection { - public const CHECK_CONNECTION_INTERVAL = 60; - - private $lastConnectionCheck = null; - - public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null) { - parent::__construct($params, $driver, $config, $eventManager); - $this->lastConnectionCheck = time(); - } - - public function connect() { - $now = time(); - $checkTime = $now - self::CHECK_CONNECTION_INTERVAL; - - if ($this->lastConnectionCheck > $checkTime || $this->isTransactionActive()) { - return parent::connect(); - } - - $this->lastConnectionCheck = $now; - if (!$this->isConnected()) { - $this->close(); - } - return parent::connect(); - } -} diff --git a/lib/private/EventDispatcher/EventDispatcher.php b/lib/private/EventDispatcher/EventDispatcher.php index 8fe4bcbb942..4e1fba67663 100644 --- a/lib/private/EventDispatcher/EventDispatcher.php +++ b/lib/private/EventDispatcher/EventDispatcher.php @@ -81,6 +81,9 @@ class EventDispatcher implements IEventDispatcher { $this->addListener($eventName, $listener, $priority); } + /** + * @deprecated + */ public function dispatch(string $eventName, Event $event): void { $this->dispatcher->dispatch($event, $eventName); diff --git a/lib/private/EventDispatcher/GenericEventWrapper.php b/lib/private/EventDispatcher/GenericEventWrapper.php index 916297f4998..1935c675812 100644 --- a/lib/private/EventDispatcher/GenericEventWrapper.php +++ b/lib/private/EventDispatcher/GenericEventWrapper.php @@ -41,6 +41,9 @@ class GenericEventWrapper extends GenericEvent { /** @var string */ private $eventName; + /** @var bool */ + private $deprecationNoticeLogged = false; + public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) { parent::__construct($eventName); $this->logger = $logger; @@ -49,11 +52,16 @@ class GenericEventWrapper extends GenericEvent { } private function log() { + if ($this->deprecationNoticeLogged) { + return; + } + $class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null'; $this->logger->info( 'Deprecated event type for {name}: {class} is used', [ 'name' => $this->eventName, 'class' => $class] ); + $this->deprecationNoticeLogged = true; } public function isPropagationStopped(): bool { diff --git a/lib/private/EventDispatcher/SymfonyAdapter.php b/lib/private/EventDispatcher/SymfonyAdapter.php index b1e5aa86049..39985cb112c 100644 --- a/lib/private/EventDispatcher/SymfonyAdapter.php +++ b/lib/private/EventDispatcher/SymfonyAdapter.php @@ -35,6 +35,8 @@ use OCP\EventDispatcher\Event; use OCP\ILogger; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use function is_object; +use function is_string; /** * @deprecated 20.0.0 use \OCP\EventDispatcher\IEventDispatcher @@ -54,6 +56,28 @@ class SymfonyAdapter implements EventDispatcherInterface { $this->logger = $logger; } + private static function detectEventAndName($a, $b) { + if (is_object($a) && (is_string($b) || $b === null)) { + // a is the event, the other one is the optional name + return [$a, $b]; + } + if (is_object($b) && (is_string($a) || $a === null)) { + // b is the event, the other one is the optional name + return [$b, $a]; + } + if (is_string($a) && $b === null) { + // a is a payload-less event + return [null, $a]; + } + if (is_string($b) && $a === null) { + // b is a payload-less event + return [null, $b]; + } + + // Anything else we can't detect + return [$a, $b]; + } + /** * Dispatches an event to all registered listeners. * @@ -67,7 +91,13 @@ class SymfonyAdapter implements EventDispatcherInterface { * @deprecated 20.0.0 */ public function dispatch($eventName, $event = null): object { + [$event, $eventName] = self::detectEventAndName($event, $eventName); + // type hinting is not possible, due to usage of GenericEvent + if ($event instanceof Event && $eventName === null) { + $this->eventDispatcher->dispatchTyped($event); + return $event; + } if ($event instanceof Event) { $this->eventDispatcher->dispatch($eventName, $event); return $event; @@ -87,7 +117,8 @@ class SymfonyAdapter implements EventDispatcherInterface { // Event with no payload (object) need special handling if ($newEvent === null) { - return $this->eventDispatcher->getSymfonyDispatcher()->dispatch($eventName); + $this->eventDispatcher->getSymfonyDispatcher()->dispatch($eventName); + return new Event(); } // Flip the argument order for Symfony to prevent a trigger_error diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 44e1b10fa35..33d42bc9c42 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -109,7 +109,8 @@ class TemplateManager implements ITemplateManager { $this->providers = []; foreach ($context->getTemplateProviders() as $provider) { - $this->providers[$provider['class']] = $this->serverContainer->get($provider['class']); + $class = $provider->getService(); + $this->providers[$class] = $this->serverContainer->get($class); } return $this->providers; } diff --git a/lib/private/Http/WellKnown/RequestManager.php b/lib/private/Http/WellKnown/RequestManager.php index 5993a9b36e0..052e2d38ea7 100644 --- a/lib/private/Http/WellKnown/RequestManager.php +++ b/lib/private/Http/WellKnown/RequestManager.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OC\Http\WellKnown; use OC\AppFramework\Bootstrap\Coordinator; +use OC\AppFramework\Bootstrap\ServiceRegistration; use OCP\AppFramework\QueryException; use OCP\Http\WellKnown\IHandler; use OCP\Http\WellKnown\IRequestContext; @@ -99,8 +100,9 @@ class RequestManager { $this->logger->debug(count($registrations) . " well known handlers registered"); return array_filter( - array_map(function (array $registration) { - $class = $registration['class']; + array_map(function (ServiceRegistration $registration) { + /** @var ServiceRegistration<IHandler> $registration */ + $class = $registration->getService(); try { $handler = $this->container->get($class); @@ -115,6 +117,7 @@ class RequestManager { } catch (QueryException $e) { $this->logger->error("Could not load well known handler $class", [ 'exception' => $e, + 'app' => $registration->getAppId(), ]); return null; diff --git a/lib/private/Search/SearchComposer.php b/lib/private/Search/SearchComposer.php index 5290c2ac3c1..09355f3aa0e 100644 --- a/lib/private/Search/SearchComposer.php +++ b/lib/private/Search/SearchComposer.php @@ -96,13 +96,14 @@ class SearchComposer { foreach ($registrations as $registration) { try { /** @var IProvider $provider */ - $provider = $this->container->query($registration['class']); + $provider = $this->container->query($registration->getService()); $this->providers[$provider->getId()] = $provider; } catch (QueryException $e) { // Log an continue. We can be fault tolerant here. $this->logger->logException($e, [ 'message' => 'Could not load search provider dynamically: ' . $e->getMessage(), 'level' => ILogger::ERROR, + 'app' => $registration->getAppId(), ]); } } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 9a2b413896b..32bc0363b99 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -542,7 +542,8 @@ class Manager implements IManager { $this->groupManager->getUserGroupIds($sharedWith) ); if (empty($groups)) { - throw new \Exception('Sharing is only allowed with group members'); + $message_t = $this->l->t('Sharing is only allowed with group members'); + throw new \Exception($message_t); } } diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index a64b13f1e2c..d48d6c40810 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -698,23 +698,23 @@ class OC_App { $bootstrapCoordinator = \OC::$server->query(Coordinator::class); foreach ($bootstrapCoordinator->getRegistrationContext()->getAlternativeLogins() as $registration) { - if (!in_array(IAlternativeLogin::class, class_implements($registration['class']), true)) { + if (!in_array(IAlternativeLogin::class, class_implements($registration->getService()), true)) { \OC::$server->getLogger()->error('Alternative login option {option} does not implement {interface} and is therefore ignored.', [ - 'option' => $registration['class'], + 'option' => $registration->getService(), 'interface' => IAlternativeLogin::class, - 'app' => $registration['app'], + 'app' => $registration->getAppId(), ]); continue; } try { /** @var IAlternativeLogin $provider */ - $provider = \OC::$server->query($registration['class']); + $provider = \OC::$server->query($registration->getService()); } catch (QueryException $e) { \OC::$server->getLogger()->logException($e, [ 'message' => 'Alternative login option {option} can not be initialised.', - 'option' => $registration['class'], - 'app' => $registration['app'], + 'option' => $registration->getService(), + 'app' => $registration->getAppId(), ]); } @@ -729,8 +729,8 @@ class OC_App { } catch (Throwable $e) { \OC::$server->getLogger()->logException($e, [ 'message' => 'Alternative login option {option} had an error while loading.', - 'option' => $registration['class'], - 'app' => $registration['app'], + 'option' => $registration->getService(), + 'app' => $registration->getAppId(), ]); } } diff --git a/lib/public/App/ManagerEvent.php b/lib/public/App/ManagerEvent.php index e2f718a556f..58cbdc3d117 100644 --- a/lib/public/App/ManagerEvent.php +++ b/lib/public/App/ManagerEvent.php @@ -32,12 +32,24 @@ use OCP\EventDispatcher\Event; * @since 9.0.0 */ class ManagerEvent extends Event { + /** + * @deprecated 22.0.0 + */ public const EVENT_APP_ENABLE = 'OCP\App\IAppManager::enableApp'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_APP_ENABLE_FOR_GROUPS = 'OCP\App\IAppManager::enableAppForGroups'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_APP_DISABLE = 'OCP\App\IAppManager::disableApp'; /** * @since 9.1.0 + * @deprecated 22.0.0 */ public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp'; diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index 8bc21a545f6..a53a4d2a6e4 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -30,6 +30,7 @@ declare(strict_types=1); namespace OCP\AppFramework\Bootstrap; use OCP\AppFramework\IAppContainer; +use OCP\Capabilities\ICapability; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Template\ICustomTemplateProvider; use OCP\IContainer; @@ -44,6 +45,7 @@ interface IRegistrationContext { /** * @param string $capability + * @psalm-param class-string<ICapability> $capability * @see IAppContainer::registerCapability * * @since 20.0.0 diff --git a/lib/public/Authentication/TwoFactorAuth/IProvider.php b/lib/public/Authentication/TwoFactorAuth/IProvider.php index 1328d60307e..83545fa4f6c 100644 --- a/lib/public/Authentication/TwoFactorAuth/IProvider.php +++ b/lib/public/Authentication/TwoFactorAuth/IProvider.php @@ -36,8 +36,13 @@ interface IProvider { /** * @since 14.0.0 + * @deprecated 22.0.0 */ public const EVENT_SUCCESS = self::class . '::success'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_FAILED = self::class . '::failed'; /** diff --git a/lib/public/Authentication/TwoFactorAuth/IRegistry.php b/lib/public/Authentication/TwoFactorAuth/IRegistry.php index c98feee2545..2e5951aaf2d 100644 --- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php +++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php @@ -39,7 +39,14 @@ use OCP\IUser; * @since 14.0.0 */ interface IRegistry { + /** + * @deprecated 22.0.0 + */ public const EVENT_PROVIDER_ENABLED = self::class . '::enable'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_PROVIDER_DISABLED = self::class . '::disable'; /** diff --git a/lib/public/Comments/CommentsEntityEvent.php b/lib/public/Comments/CommentsEntityEvent.php index 17f3e76a996..7ae2968ead8 100644 --- a/lib/public/Comments/CommentsEntityEvent.php +++ b/lib/public/Comments/CommentsEntityEvent.php @@ -32,6 +32,9 @@ use OCP\EventDispatcher\Event; * @since 9.1.0 */ class CommentsEntityEvent extends Event { + /** + * @deprecated 22.0.0 + */ public const EVENT_ENTITY = 'OCP\Comments\ICommentsManager::registerEntity'; /** @var string */ diff --git a/lib/public/Comments/CommentsEvent.php b/lib/public/Comments/CommentsEvent.php index a8a27948e99..9090425aae5 100644 --- a/lib/public/Comments/CommentsEvent.php +++ b/lib/public/Comments/CommentsEvent.php @@ -32,9 +32,25 @@ use OCP\EventDispatcher\Event; * @since 9.0.0 */ class CommentsEvent extends Event { + + /** + * @deprecated 22.0.0 + */ public const EVENT_ADD = 'OCP\Comments\ICommentsManager::addComment'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_PRE_UPDATE = 'OCP\Comments\ICommentsManager::preUpdateComment'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_UPDATE = 'OCP\Comments\ICommentsManager::updateComment'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_DELETE = 'OCP\Comments\ICommentsManager::deleteComment'; /** @var string */ diff --git a/lib/public/Console/ConsoleEvent.php b/lib/public/Console/ConsoleEvent.php index 1d946d50351..a12d65c3b15 100644 --- a/lib/public/Console/ConsoleEvent.php +++ b/lib/public/Console/ConsoleEvent.php @@ -32,6 +32,10 @@ use OCP\EventDispatcher\Event; * @since 9.0.0 */ class ConsoleEvent extends Event { + + /** + * @deprecated 22.0.0 + */ public const EVENT_RUN = 'OC\Console\Application::run'; /** @var string */ diff --git a/lib/public/EventDispatcher/Event.php b/lib/public/EventDispatcher/Event.php index 8e6a5217af9..b07efba0f19 100644 --- a/lib/public/EventDispatcher/Event.php +++ b/lib/public/EventDispatcher/Event.php @@ -26,7 +26,7 @@ declare(strict_types=1); namespace OCP\EventDispatcher; -use Symfony\Contracts\EventDispatcher\Event as SymfonyEvent; +use Psr\EventDispatcher\StoppableEventInterface; /** * Base event class for the event dispatcher service @@ -34,9 +34,21 @@ use Symfony\Contracts\EventDispatcher\Event as SymfonyEvent; * Typically this class isn't instantiated directly but sub classed for specific * event types * + * This class extended \Symfony\Contracts\EventDispatcher\Event until 21.0, since + * 22.0.0 this class directly implements the PSR StoppableEventInterface and no + * longer relies on Symfony. This transition does not come with any changes in API, + * the class has the same methods and behavior before and after this change. + * * @since 17.0.0 */ -class Event extends SymfonyEvent { +class Event implements StoppableEventInterface { + + /** + * @var bool + * + * @since 22.0.0 + */ + private $propagationStopped = false; /** * Compatibility constructor @@ -51,4 +63,25 @@ class Event extends SymfonyEvent { */ public function __construct() { } + + /** + * Stops the propagation of the event to further event listeners + * + * @return void + * + * @since 22.0.0 + */ + public function stopPropagation(): void { + $this->propagationStopped = true; + } + + /** + * {@inheritDoc} + * + * @since 22.0.0 + * @see \Psr\EventDispatcher\StoppableEventInterface + */ + public function isPropagationStopped(): bool { + return $this->propagationStopped; + } } diff --git a/lib/public/EventDispatcher/GenericEvent.php b/lib/public/EventDispatcher/GenericEvent.php index ab2ff734ada..eda7fdf0997 100644 --- a/lib/public/EventDispatcher/GenericEvent.php +++ b/lib/public/EventDispatcher/GenericEvent.php @@ -40,17 +40,23 @@ use function array_key_exists; * \OCP\EventDispatcher\Event * * @since 18.0.0 + * @deprecated 22.0.0 use \OCP\EventDispatcher\Event */ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { + /** @deprecated 22.0.0 */ protected $subject; + + /** @deprecated 22.0.0 */ protected $arguments; /** * Encapsulate an event with $subject and $args. * * @since 18.0.0 + * @deprecated 22.0.0 */ public function __construct($subject = null, array $arguments = []) { + parent::__construct(); $this->subject = $subject; $this->arguments = $arguments; } @@ -59,6 +65,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * Getter for subject property. * * @since 18.0.0 + * @deprecated 22.0.0 */ public function getSubject() { return $this->subject; @@ -69,6 +76,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * * @throws InvalidArgumentException if key is not found * @since 18.0.0 + * @deprecated 22.0.0 */ public function getArgument(string $key) { if ($this->hasArgument($key)) { @@ -82,6 +90,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * Add argument to event. * * @since 18.0.0 + * @deprecated 22.0.0 */ public function setArgument($key, $value): GenericEvent { $this->arguments[$key] = $value; @@ -92,6 +101,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * Getter for all arguments. * * @since 18.0.0 + * @deprecated 22.0.0 */ public function getArguments(): array { return $this->arguments; @@ -101,6 +111,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * Set args property. * * @since 18.0.0 + * @deprecated 22.0.0 */ public function setArguments(array $args = []): GenericEvent { $this->arguments = $args; @@ -111,6 +122,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * Has argument. * * @since 18.0.0 + * @deprecated 22.0.0 */ public function hasArgument($key): bool { return array_key_exists($key, $this->arguments); @@ -121,6 +133,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * * @link https://php.net/manual/en/iteratoraggregate.getiterator.php * @since 18.0.0 + * @deprecated 22.0.0 */ public function getIterator(): Traversable { return new ArrayIterator($this->arguments); @@ -131,6 +144,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * * @link https://php.net/manual/en/arrayaccess.offsetexists.php * @since 18.0.0 + * @deprecated 22.0.0 */ public function offsetExists($offset): bool { return $this->hasArgument($offset); @@ -141,6 +155,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * * @link https://php.net/manual/en/arrayaccess.offsetget.php * @since 18.0.0 + * @deprecated 22.0.0 */ public function offsetGet($offset) { return $this->arguments[$offset]; @@ -151,6 +166,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * * @link https://php.net/manual/en/arrayaccess.offsetset.php * @since 18.0.0 + * @deprecated 22.0.0 */ public function offsetSet($offset, $value): void { $this->setArgument($offset, $value); @@ -161,6 +177,7 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { * * @link https://php.net/manual/en/arrayaccess.offsetunset.php * @since 18.0.0 + * @deprecated 22.0.0 */ public function offsetUnset($offset): void { if ($this->hasArgument($offset)) { diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php index 5618e3ec40b..943ad1b8601 100644 --- a/lib/public/IDBConnection.php +++ b/lib/public/IDBConnection.php @@ -51,11 +51,34 @@ use OCP\DB\QueryBuilder\IQueryBuilder; * @since 6.0.0 */ interface IDBConnection { + /** + * @deprecated 22.0.0 this is an internal event + */ public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES'; + + /** + * @deprecated 22.0.0 this is an internal event + */ public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES'; + + /** + * @deprecated 22.0.0 this is an internal event + */ public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS'; + + /** + * @deprecated 22.0.0 this is an internal event + */ public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS'; + + /** + * @deprecated 22.0.0 this is an internal event + */ public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS'; + + /** + * @deprecated 22.0.0 this is an internal event + */ public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS'; /** diff --git a/lib/public/IPreview.php b/lib/public/IPreview.php index aa7bf559dff..2ae5d835254 100644 --- a/lib/public/IPreview.php +++ b/lib/public/IPreview.php @@ -48,6 +48,7 @@ interface IPreview { /** * @since 9.2.0 + * @deprecated 22.0.0 */ public const EVENT = self::class . ':' . 'PreviewRequested'; diff --git a/lib/public/SystemTag/ManagerEvent.php b/lib/public/SystemTag/ManagerEvent.php index 44419775800..45cd35fc821 100644 --- a/lib/public/SystemTag/ManagerEvent.php +++ b/lib/public/SystemTag/ManagerEvent.php @@ -37,8 +37,20 @@ use OCP\EventDispatcher\Event; * @since 9.0.0 */ class ManagerEvent extends Event { + + /** + * @deprecated 22.0.0 + */ public const EVENT_CREATE = 'OCP\SystemTag\ISystemTagManager::createTag'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_UPDATE = 'OCP\SystemTag\ISystemTagManager::updateTag'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_DELETE = 'OCP\SystemTag\ISystemTagManager::deleteTag'; /** @var string */ diff --git a/lib/public/SystemTag/MapperEvent.php b/lib/public/SystemTag/MapperEvent.php index 469a381d3c1..a8fc30771f4 100644 --- a/lib/public/SystemTag/MapperEvent.php +++ b/lib/public/SystemTag/MapperEvent.php @@ -36,7 +36,15 @@ use OCP\EventDispatcher\Event; * @since 9.0.0 */ class MapperEvent extends Event { + + /** + * @deprecated 22.0.0 + */ public const EVENT_ASSIGN = 'OCP\SystemTag\ISystemTagObjectMapper::assignTags'; + + /** + * @deprecated 22.0.0 + */ public const EVENT_UNASSIGN = 'OCP\SystemTag\ISystemTagObjectMapper::unassignTags'; /** @var string */ diff --git a/lib/public/SystemTag/SystemTagsEntityEvent.php b/lib/public/SystemTag/SystemTagsEntityEvent.php index 1ae82f2a7e4..33acecdcd2d 100644 --- a/lib/public/SystemTag/SystemTagsEntityEvent.php +++ b/lib/public/SystemTag/SystemTagsEntityEvent.php @@ -36,6 +36,10 @@ use OCP\EventDispatcher\Event; * @since 9.1.0 */ class SystemTagsEntityEvent extends Event { + + /** + * @deprecated 22.0.0 + */ public const EVENT_ENTITY = 'OCP\SystemTag\ISystemTagManager::registerEntity'; /** @var string */ diff --git a/lib/public/WorkflowEngine/IManager.php b/lib/public/WorkflowEngine/IManager.php index 5863cf7ce22..579cb4cd149 100644 --- a/lib/public/WorkflowEngine/IManager.php +++ b/lib/public/WorkflowEngine/IManager.php @@ -46,10 +46,18 @@ interface IManager { public const MAX_OPERATION_VALUE_BYTES = 4096; /** - * @deprecated Will be removed in NC19. Use the dedicated events in OCP\WorkflowEngine\Events + * @deprecated 17.0.0 Will be removed in NC19. Use the dedicated events in OCP\WorkflowEngine\Events */ public const EVENT_NAME_REG_OPERATION = 'OCP\WorkflowEngine::registerOperations'; + + /** + * @deprecated 17.0.0 + */ public const EVENT_NAME_REG_ENTITY = 'OCP\WorkflowEngine::registerEntities'; + + /** + * @deprecated 17.0.0 + */ public const EVENT_NAME_REG_CHECK = 'OCP\WorkflowEngine::registerChecks'; /** |