diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2022-09-14 14:41:41 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2022-09-14 14:41:54 +0300 |
commit | 55757423cb424254ed5c89a3cd26ce62479f9faa (patch) | |
tree | d480c55c667fa5e0ab15e58f3db7933e2790b314 | |
parent | 979652430d8166e897c5370afaea01918917ea48 (diff) |
set defaultEnabled in shipped.jsonenh/noid/default-enabled-2
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
23 files changed, 61 insertions, 22 deletions
diff --git a/apps/comments/appinfo/info.xml b/apps/comments/appinfo/info.xml index 88f780cf7de..70a1695b923 100644 --- a/apps/comments/appinfo/info.xml +++ b/apps/comments/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Arthur Schiwon</author> <author>Vincent Petry</author> - <default_enable/> <types> <logging/> </types> diff --git a/apps/contactsinteraction/appinfo/info.xml b/apps/contactsinteraction/appinfo/info.xml index 8ea086712c0..2f52ff2c030 100644 --- a/apps/contactsinteraction/appinfo/info.xml +++ b/apps/contactsinteraction/appinfo/info.xml @@ -13,7 +13,6 @@ <types> <dav/> </types> - <default_enable/> <category>integration</category> <category>social</category> <bugs>https://github.com/nextcloud/server/issues</bugs> diff --git a/apps/dashboard/appinfo/info.xml b/apps/dashboard/appinfo/info.xml index a21f3ab47b1..5969c5d1dee 100644 --- a/apps/dashboard/appinfo/info.xml +++ b/apps/dashboard/appinfo/info.xml @@ -14,7 +14,6 @@ they like and change the background to their liking.]]></description> <licence>agpl</licence> <author>Julius Härtl</author> <namespace>Dashboard</namespace> - <default_enable/> <category>customization</category> diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index deb99b1c33b..02fbe970c47 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>owncloud.org</author> <namespace>DAV</namespace> - <default_enable/> <types> <filesystem/> </types> diff --git a/apps/federation/appinfo/info.xml b/apps/federation/appinfo/info.xml index 67280335769..263ffad2092 100644 --- a/apps/federation/appinfo/info.xml +++ b/apps/federation/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Bjoern Schiessle</author> <namespace>Federation</namespace> - <default_enable/> <types> <authentication/> diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml index f62a913e8f4..6c8c043cd2c 100644 --- a/apps/files/appinfo/info.xml +++ b/apps/files/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Robin Appelman</author> <author>Vincent Petry</author> - <default_enable/> <types> <filesystem/> </types> diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml index 44f3e3a45cd..66c49d6eeb6 100644 --- a/apps/files_sharing/appinfo/info.xml +++ b/apps/files_sharing/appinfo/info.xml @@ -14,7 +14,6 @@ Turning the feature off removes shared files and folders on the server for all s <author>Michael Gapczynski</author> <author>Bjoern Schiessle</author> <namespace>Files_Sharing</namespace> - <default_enable/> <types> <filesystem/> </types> diff --git a/apps/files_trashbin/appinfo/info.xml b/apps/files_trashbin/appinfo/info.xml index b8f4b5ea6b1..f63953ade9b 100644 --- a/apps/files_trashbin/appinfo/info.xml +++ b/apps/files_trashbin/appinfo/info.xml @@ -13,7 +13,6 @@ To prevent a user from running out of disk space, the Deleted files app will not <licence>agpl</licence> <author>Bjoern Schiessle</author> <namespace>Files_Trashbin</namespace> - <default_enable/> <types> <filesystem/> <dav/> diff --git a/apps/files_versions/appinfo/info.xml b/apps/files_versions/appinfo/info.xml index 49e48e6e436..bdd699d620c 100644 --- a/apps/files_versions/appinfo/info.xml +++ b/apps/files_versions/appinfo/info.xml @@ -13,7 +13,6 @@ <author>Frank Karlitschek</author> <author>Bjoern Schiessle</author> <namespace>Files_Versions</namespace> - <default_enable/> <types> <filesystem/> <dav/> diff --git a/apps/lookup_server_connector/appinfo/info.xml b/apps/lookup_server_connector/appinfo/info.xml index cf486e06228..5cc54c7e9f2 100644 --- a/apps/lookup_server_connector/appinfo/info.xml +++ b/apps/lookup_server_connector/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Bjoern Schiessle</author> <namespace>LookupServerConnector</namespace> - <default_enable/> <types> <authentication/> </types> diff --git a/apps/oauth2/appinfo/info.xml b/apps/oauth2/appinfo/info.xml index ae2fcb09986..6eed9b9d18e 100644 --- a/apps/oauth2/appinfo/info.xml +++ b/apps/oauth2/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Lukas Reschke</author> <namespace>OAuth2</namespace> - <default_enable/> <types> <authentication/> </types> diff --git a/apps/provisioning_api/appinfo/info.xml b/apps/provisioning_api/appinfo/info.xml index dd01689950a..56dc6e610d4 100644 --- a/apps/provisioning_api/appinfo/info.xml +++ b/apps/provisioning_api/appinfo/info.xml @@ -17,7 +17,6 @@ <licence>agpl</licence> <author>Tom Needham</author> <namespace>Provisioning_API</namespace> - <default_enable/> <types> <prevent_group_restriction/> </types> diff --git a/apps/settings/appinfo/info.xml b/apps/settings/appinfo/info.xml index 13e5eddcdf2..f030c1e5c50 100644 --- a/apps/settings/appinfo/info.xml +++ b/apps/settings/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Nextcloud</author> <namespace>Settings</namespace> - <default_enable/> <category>customization</category> <bugs>https://github.com/nextcloud/server/issues</bugs> diff --git a/apps/sharebymail/appinfo/info.xml b/apps/sharebymail/appinfo/info.xml index f4d2900c80d..70458f44d19 100644 --- a/apps/sharebymail/appinfo/info.xml +++ b/apps/sharebymail/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Bjoern Schiessle</author> <namespace>ShareByMail</namespace> - <default_enable/> <types> <filesystem/> diff --git a/apps/systemtags/appinfo/info.xml b/apps/systemtags/appinfo/info.xml index 9e0b347acbd..1f572a831d6 100644 --- a/apps/systemtags/appinfo/info.xml +++ b/apps/systemtags/appinfo/info.xml @@ -11,7 +11,6 @@ <author>Vincent Petry</author> <author>Joas Schilling</author> <namespace>SystemTags</namespace> - <default_enable/> <types> <logging/> </types> diff --git a/apps/theming/appinfo/info.xml b/apps/theming/appinfo/info.xml index b67b461c410..6823a9fbd88 100644 --- a/apps/theming/appinfo/info.xml +++ b/apps/theming/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Nextcloud</author> <namespace>Theming</namespace> - <default_enable/> <types> <logging/> diff --git a/apps/updatenotification/appinfo/info.xml b/apps/updatenotification/appinfo/info.xml index 44fa6b9c50f..626316f04aa 100644 --- a/apps/updatenotification/appinfo/info.xml +++ b/apps/updatenotification/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author>Lukas Reschke</author> <namespace>UpdateNotification</namespace> - <default_enable/> <category>monitoring</category> <bugs>https://github.com/nextcloud/server/issues</bugs> <dependencies> diff --git a/apps/user_status/appinfo/info.xml b/apps/user_status/appinfo/info.xml index c385886e946..23f07eb325a 100644 --- a/apps/user_status/appinfo/info.xml +++ b/apps/user_status/appinfo/info.xml @@ -9,7 +9,6 @@ <licence>agpl</licence> <author mail="oc.list@georgehrke.com" >Georg Ehrke</author> <namespace>UserStatus</namespace> - <default_enable/> <category>social</category> <bugs>https://github.com/nextcloud/server</bugs> <navigations> diff --git a/apps/weather_status/appinfo/info.xml b/apps/weather_status/appinfo/info.xml index 50d107855fd..403d5eb3e5d 100644 --- a/apps/weather_status/appinfo/info.xml +++ b/apps/weather_status/appinfo/info.xml @@ -11,7 +11,6 @@ <licence>agpl</licence> <author mail="eneiluj@posteo.net">Julien Veyssier</author> <namespace>WeatherStatus</namespace> - <default_enable/> <category>integration</category> <category>dashboard</category> <bugs>https://github.com/nextcloud/server</bugs> diff --git a/core/shipped.json b/core/shipped.json index 33980afb7c4..2f5074c348f 100644 --- a/core/shipped.json +++ b/core/shipped.json @@ -47,6 +47,28 @@ "weather_status", "workflowengine" ], + "defaultEnabled": [ + "comments", + "contactsinteraction", + "dashboard", + "dav", + "federation", + "files", + "files_sharing", + "files_trashbin", + "files_versions", + "lookup_server_connector", + "oauth2", + "provisioning_api", + "related_resources", + "settings", + "sharebymail", + "systemtags", + "theming", + "updatenotification", + "user_status", + "weather_status" + ], "alwaysEnabled": [ "files", "cloud_federation_api", diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index f154bd854ad..6d2fe51d0ed 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -13,6 +13,7 @@ * @author Julius Haertl <jus@bitgrid.net> * @author Julius Härtl <jus@bitgrid.net> * @author Lukas Reschke <lukas@statuscode.ch> + * @author Maxence Lange <maxence@artificial-owl.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Roeland Jago Douma <roeland@famdouma.nl> @@ -91,8 +92,8 @@ class AppManager implements IAppManager { /** @var string[] */ private $shippedApps; - /** @var string[] */ - private $alwaysEnabled; + private array $alwaysEnabled = []; + private array $defaultEnabled = []; /** @var array */ private $appInfos = []; @@ -574,6 +575,7 @@ class AppManager implements IAppManager { $content = json_decode(file_get_contents($shippedJson), true); $this->shippedApps = $content['shippedApps']; $this->alwaysEnabled = $content['alwaysEnabled']; + $this->defaultEnabled = $content['defaultEnabled']; } } @@ -584,4 +586,20 @@ class AppManager implements IAppManager { $this->loadShippedJson(); return $this->alwaysEnabled; } + + /** + * @inheritdoc + */ + public function isDefaultEnabled(string $appId): bool { + return (in_array($appId, $this->getDefaultEnabledApps())); + } + + /** + * @inheritdoc + */ + public function getDefaultEnabledApps():array { + $this->loadShippedJson(); + + return $this->defaultEnabled; + } } diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 86d933b6fbd..e629f884f0b 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -546,7 +546,9 @@ class Installer { if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { if ($config->getAppValue($filename, "installed_version", null) === null) { $info = OC_App::getAppInfo($filename); - $enabled = isset($info['default_enable']); + // default_enable is deprecated since 25 + // enabled-by-default apps needs to be added to core/shipped.json + $enabled = isset($info['default_enable']) || $appManager->isDefaultEnabled($filename); if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps())) && $config->getAppValue($filename, 'enabled') !== 'no') { if ($softErrors) { diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php index e0b5c049290..baf35af11e8 100644 --- a/lib/public/App/IAppManager.php +++ b/lib/public/App/IAppManager.php @@ -84,6 +84,16 @@ interface IAppManager { public function isInstalled($appId); /** + * Check if an app is enabled by default + * + * Notice: This actually checks if the app should be enabled by default + * and not if currently installed/enabled + * + * @since 25.0.0 + */ + public function isDefaultEnabled(string $appId):bool; + + /** * Enable an app for every user * * @param string $appId @@ -179,6 +189,12 @@ interface IAppManager { public function getAlwaysEnabledApps(); /** + * @return string[] + * @since 25.0.0 + */ + public function getDefaultEnabledApps(): array; + + /** * @param \OCP\IGroup $group * @return String[] * @since 17.0.0 |