Nextcloud PHP API (master)

IAppManager

Interface IAppManager

Tags
warning

This interface shouldn't be included with dependency injection in classes used for installing Nextcloud.

since
8.0.0

Table of Contents

Methods

clearAppsCache()  : mixed
Clear the cached list of apps when enabling/disabling an app
disableApp()  : mixed
Disable an app for every user
enableApp()  : void
Enable an app for every user
enableAppForGroups()  : void
Enable an app only for specific groups
getAlwaysEnabledApps()  : array<string|int, string>
getAppIcon()  : string|null
Returns the app icon or null if none is found
getAppInfo()  : array<string|int, mixed>|null
Returns the app information from "appinfo/info.xml".
getAppPath()  : string
Get the directory for the given app.
getAppRestriction()  : array<string|int, string>
getAppVersion()  : string
Returns the app information from "appinfo/info.xml".
getAppWebPath()  : string
Get the web path for the given app.
getDefaultAppForUser()  : string
Returns the id of the user's default app
getDefaultApps()  : array<string|int, string>
Get the global default apps with fallbacks
getDefaultEnabledApps()  : array<string|int, string>
getEnabledAppsForGroup()  : array<string|int, string>
getEnabledAppsForUser()  : array<string|int, string>
List all apps enabled for a user
getInstalledApps()  : array<string|int, string>
List all installed apps
hasProtectedAppType()  : bool
Whether a list of types contains a protected app type
isAppLoaded()  : bool
Check if an app is loaded
isDefaultEnabled()  : bool
Check if an app should be enabled by default
isEnabledForUser()  : bool
Check if an app is enabled for user
isInstalled()  : bool
Check if an app is enabled in the instance
isShipped()  : bool
isType()  : bool
Check if an app is of a specific type
loadApp()  : void
Load an app, if not already loaded
loadApps()  : bool
Loads all apps
setDefaultApps()  : void
Set the global default apps with fallbacks

Methods

clearAppsCache()

Clear the cached list of apps when enabling/disabling an app

public clearAppsCache() : mixed
Tags
since
8.1.0

disableApp()

Disable an app for every user

public disableApp(string $appId[, bool $automaticDisabled = false ]) : mixed
Parameters
$appId : string
$automaticDisabled : bool = false
Tags
since
8.0.0

enableApp()

Enable an app for every user

public enableApp(string $appId[, bool $forceEnable = false ]) : void
Parameters
$appId : string
$forceEnable : bool = false
Tags
throws
AppPathNotFoundException
since
8.0.0

enableAppForGroups()

Enable an app only for specific groups

public enableAppForGroups(string $appId, array<string|int, IGroup$groups[, bool $forceEnable = false ]) : void
Parameters
$appId : string
$groups : array<string|int, IGroup>
$forceEnable : bool = false
Tags
throws
Exception
since
8.0.0

getAlwaysEnabledApps()

public getAlwaysEnabledApps() : array<string|int, string>
Tags
since
9.0.0
Return values
array<string|int, string>

getAppIcon()

Returns the app icon or null if none is found

public getAppIcon(string $appId[, bool $dark = false ]) : string|null
Parameters
$appId : string
$dark : bool = false

Enable to request a dark icon variant, default is a white icon

Tags
since
29.0.0
Return values
string|null

getAppInfo()

Returns the app information from "appinfo/info.xml".

public getAppInfo(string $appId[, bool $path = false ][, string|null $lang = null ]) : array<string|int, mixed>|null
Parameters
$appId : string
$path : bool = false
$lang : string|null = null
Tags
since
14.0.0
Return values
array<string|int, mixed>|null

getAppPath()

Get the directory for the given app.

public getAppPath(string $appId) : string
Parameters
$appId : string
Tags
since
11.0.0
throws
AppPathNotFoundException
Return values
string

getAppRestriction()

public getAppRestriction(string $appId) : array<string|int, string>
Parameters
$appId : string
Tags
since
17.0.0
Return values
array<string|int, string>

getAppVersion()

Returns the app information from "appinfo/info.xml".

public getAppVersion(string $appId[, bool $useCache = true ]) : string
Parameters
$appId : string
$useCache : bool = true
Tags
since
14.0.0
Return values
string

getAppWebPath()

Get the web path for the given app.

public getAppWebPath(string $appId) : string
Parameters
$appId : string
Tags
since
18.0.0
throws
AppPathNotFoundException
Return values
string

getDefaultAppForUser()

Returns the id of the user's default app

public getDefaultAppForUser([IUser|null $user = null ][, bool $withFallbacks = true ]) : string

If user is not passed, the currently logged in user will be used

Parameters
$user : IUser|null = null

User to query default app for

$withFallbacks : bool = true

Include fallback values if no default app was configured manually Before falling back to predefined default apps, the user defined app order is considered and the first app would be used as the fallback.

Tags
since
25.0.6
since
28.0.0

Added optional $withFallbacks parameter

Return values
string

getDefaultApps()

Get the global default apps with fallbacks

public getDefaultApps() : array<string|int, string>
Tags
since
28.0.0
Return values
array<string|int, string>

The default applications

getDefaultEnabledApps()

public getDefaultEnabledApps() : array<string|int, string>
Tags
since
25.0.0
Return values
array<string|int, string>

app IDs

getEnabledAppsForGroup()

public getEnabledAppsForGroup(IGroup $group) : array<string|int, string>
Parameters
$group : IGroup
Tags
since
17.0.0
Return values
array<string|int, string>

getEnabledAppsForUser()

List all apps enabled for a user

public getEnabledAppsForUser(IUser $user) : array<string|int, string>
Parameters
$user : IUser
Tags
since
8.1.0
Return values
array<string|int, string>

getInstalledApps()

List all installed apps

public getInstalledApps() : array<string|int, string>
Tags
since
8.1.0
Return values
array<string|int, string>

hasProtectedAppType()

Whether a list of types contains a protected app type

public hasProtectedAppType(array<string|int, string> $types) : bool
Parameters
$types : array<string|int, string>
Tags
since
12.0.0
Return values
bool

isAppLoaded()

Check if an app is loaded

public isAppLoaded(string $app) : bool
Parameters
$app : string

app id

Tags
since
27.0.0
Return values
bool

isDefaultEnabled()

Check if an app should be enabled by default

public isDefaultEnabled(string $appId) : bool

Notice: This actually checks if the app should be enabled by default and not if currently installed/enabled

Parameters
$appId : string

ID of the app

Tags
since
25.0.0
Return values
bool

isEnabledForUser()

Check if an app is enabled for user

public isEnabledForUser(string $appId[, IUser|null $user = null ]) : bool
Parameters
$appId : string
$user : IUser|null = null

(optional) if not defined, the currently loggedin user will be used

Tags
since
8.0.0
Return values
bool

isInstalled()

Check if an app is enabled in the instance

public isInstalled(string $appId) : bool

Notice: This actually checks if the app is enabled and not only if it is installed.

Parameters
$appId : string
Tags
since
8.0.0
Return values
bool

isShipped()

public isShipped(string $appId) : bool
Parameters
$appId : string
Tags
since
9.0.0
Return values
bool

isType()

Check if an app is of a specific type

public isType(string $app, array<string|int, mixed> $types) : bool
Parameters
$app : string
$types : array<string|int, mixed>
Tags
since
27.0.0
Return values
bool

loadApp()

Load an app, if not already loaded

public loadApp(string $app) : void
Parameters
$app : string

app id

Tags
since
27.0.0

loadApps()

Loads all apps

public loadApps([array<string|int, string> $types = [] ]) : bool
Parameters
$types : array<string|int, string> = []
Tags
since
27.0.0
Return values
bool

This function walks through the Nextcloud directory and loads all apps it can find. A directory contains an app if the file /appinfo/info.xml exists.

if $types is set to non-empty array, only apps of those types will be loaded

setDefaultApps()

Set the global default apps with fallbacks

public setDefaultApps(array<string|int, mixed> $defaultApps) : void
Parameters
$defaultApps : array<string|int, mixed>
Tags
throws
InvalidArgumentException

If any of the apps is not installed

since
28.0.0

        
On this page

Search results