Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set defaultEnabled in shipped.json #34072

Merged
merged 3 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/comments/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Arthur Schiwon</author>
<author>Vincent Petry</author>
<default_enable/>
<types>
<logging/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/contactsinteraction/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<types>
<dav/>
</types>
<default_enable/>
<category>integration</category>
<category>social</category>
<bugs>https://github.com/nextcloud/server/issues</bugs>
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 0 additions & 1 deletion apps/dav/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>owncloud.org</author>
<namespace>DAV</namespace>
<default_enable/>
<types>
<filesystem/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/federation/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Bjoern Schiessle</author>
<namespace>Federation</namespace>
<default_enable/>

<types>
<authentication/>
Expand Down
1 change: 0 additions & 1 deletion apps/files/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Robin Appelman</author>
<author>Vincent Petry</author>
<default_enable/>
<types>
<filesystem/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/files_sharing/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion apps/files_trashbin/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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/>
Expand Down
1 change: 0 additions & 1 deletion apps/files_versions/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<author>Frank Karlitschek</author>
<author>Bjoern Schiessle</author>
<namespace>Files_Versions</namespace>
<default_enable/>
<types>
<filesystem/>
<dav/>
Expand Down
1 change: 0 additions & 1 deletion apps/lookup_server_connector/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Bjoern Schiessle</author>
<namespace>LookupServerConnector</namespace>
<default_enable/>
<types>
<authentication/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/oauth2/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Lukas Reschke</author>
<namespace>OAuth2</namespace>
<default_enable/>
<types>
<authentication/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/provisioning_api/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<licence>agpl</licence>
<author>Tom Needham</author>
<namespace>Provisioning_API</namespace>
<default_enable/>
<types>
<prevent_group_restriction/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/settings/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion apps/sharebymail/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Bjoern Schiessle</author>
<namespace>ShareByMail</namespace>
<default_enable/>

<types>
<filesystem/>
Expand Down
1 change: 0 additions & 1 deletion apps/systemtags/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<author>Vincent Petry</author>
<author>Joas Schilling</author>
<namespace>SystemTags</namespace>
<default_enable/>
<types>
<logging/>
</types>
Expand Down
1 change: 0 additions & 1 deletion apps/theming/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<licence>agpl</licence>
<author>Nextcloud</author>
<namespace>Theming</namespace>
<default_enable/>

<types>
<logging/>
Expand Down
1 change: 0 additions & 1 deletion apps/updatenotification/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion apps/user_status/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion apps/weather_status/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
40 changes: 40 additions & 0 deletions core/shipped.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,46 @@
"weather_status",
"workflowengine"
],
"defaultEnabled": [
ArtificialOwl marked this conversation as resolved.
Show resolved Hide resolved
"activity",
"circles",
"comments",
"contactsinteraction",
"dashboard",
"dav",
"federation",
"files",
"files_pdfviewer",
"files_rightclick",
"files_sharing",
"files_trashbin",
"files_versions",
"files_videoplayer",
"firstrunwizard",
"logreader",
"lookup_server_connector",
"nextcloud_announcements",
"notifications",
"oauth2",
"password_policy",
"photos",
"privacy",
"provisioning_api",
"recommendations",
"related_resources",
"serverinfo",
"settings",
"sharebymail",
"support",
"survey_client",
"systemtags",
"text",
"theming",
"updatenotification",
"user_status",
"viewer",
"weather_status"
],
"alwaysEnabled": [
"files",
"cloud_federation_api",
Expand Down
22 changes: 20 additions & 2 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -574,6 +575,7 @@ private function loadShippedJson() {
$content = json_decode(file_get_contents($shippedJson), true);
$this->shippedApps = $content['shippedApps'];
$this->alwaysEnabled = $content['alwaysEnabled'];
$this->defaultEnabled = $content['defaultEnabled'];
}
}

Expand All @@ -584,4 +586,20 @@ public function getAlwaysEnabledApps() {
$this->loadShippedJson();
return $this->alwaysEnabled;
}

/**
* @inheritdoc
*/
public function isDefaultEnabled(string $appId): bool {
return (in_array($appId, $this->getDefaultEnabledApps()));
}
come-nc marked this conversation as resolved.
Show resolved Hide resolved

/**
* @inheritdoc
*/
public function getDefaultEnabledApps():array {
$this->loadShippedJson();

return $this->defaultEnabled;
}
}
3 changes: 1 addition & 2 deletions lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,7 @@ public static function installShippedApps($softErrors = false) {
if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) {
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']);
$enabled = $appManager->isDefaultEnabled($filename);
if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps()))
&& $config->getAppValue($filename, 'enabled') !== 'no') {
if ($softErrors) {
Expand Down
17 changes: 17 additions & 0 deletions lib/public/App/IAppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ public function isEnabledForUser($appId, $user = null);
*/
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
*
* @param string $appId
* @since 25.0.0
ArtificialOwl marked this conversation as resolved.
Show resolved Hide resolved
*/
public function isDefaultEnabled(string $appId):bool;

/**
* Enable an app for every user
*
Expand Down Expand Up @@ -178,6 +189,12 @@ public function isShipped($appId);
*/
public function getAlwaysEnabledApps();

/**
* @return string[] app IDs
* @since 25.0.0
*/
public function getDefaultEnabledApps(): array;

/**
* @param \OCP\IGroup $group
* @return String[]
Expand Down