OC_App

class OC_App
This class manages the apps. It allows them to register and integrate in the
ownCloud ecosystem. Furthermore, this class is responsible for installing,
upgrading and removing apps.
Source:lib/private/legacy/OC_App.php#71

Constants

supportedApp = 300
Source:lib/private/legacy/OC_App.php#78
officialApp = 200
Source:lib/private/legacy/OC_App.php#79

Properties

Methods

public static OC_App::cleanAppId($app)
clean the appId
Source:

lib/private/legacy/OC_App.php#90

Parameters:
  • $app (string) AppId that needs to be cleaned
Returns:

string

public static OC_App::isAppLoaded($app)
Check if an app is loaded
Source:

lib/private/legacy/OC_App.php#100

Parameters:
  • $app (string)
Returns:

bool

public static OC_App::loadApps($types=[])
loads all apps
Source:

lib/private/legacy/OC_App.php#116

Parameters:
  • $types (string[])
Returns:

bool This function walks through the ownCloud 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

public static OC_App::loadApp($app)
load a single app
Source:

lib/private/legacy/OC_App.php#159

Parameters:
  • $app (string)
Throws:

\Exception

public static OC_App::registerAutoloading($app, $path, $force=\false)
Source:

lib/private/legacy/OC_App.php#269

Parameters:
  • $app (string)
  • $path (string)
  • $force (bool)
public static OC_App::isType($app, $types)
check if an app is of a specific type
Source:

lib/private/legacy/OC_App.php#313

Parameters:
  • $app (string)
  • $types (array)
Returns:

bool

public static OC_App::setAppTypes($app)
read app types from info.xml and cache them in the database
Source:lib/private/legacy/OC_App.php#345
public static OC_App::getEnabledApps($forceRefresh=\false, $all=\false)
Returns apps enabled for the current user.
Source:

lib/private/legacy/OC_App.php#378

Parameters:
  • $forceRefresh (bool) whether to refresh the cache
  • $all (bool) whether to return apps for all users, not only the

currently logged in one

Returns:

string[]

public static OC_App::isEnabled($app)
checks whether or not an app is enabled
Source:

lib/private/legacy/OC_App.php#413

Parameters:
  • $app (string) app
Returns:

bool

Deprecated:

13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId)

This function checks whether or not an app is enabled.

public OC_App::enable($appId, $groups=[])
enables an app
Source:

lib/private/legacy/OC_App.php#427

Parameters:
  • $appId (string)
  • $groups (array) (optional) when set, only these groups will have access to the app
Throws:

\Exception

Returns:

void This function set an app as enabled in appconfig.

public static OC_App::getInstallPath()
Get the path where to install apps
Source:lib/private/legacy/OC_App.php#462
Returns:string | bool
public static OC_App::findAppInDirectories($appId)
search for an app in all app-directories
Source:

lib/private/legacy/OC_App.php#484

Parameters:
  • $appId (string)
Returns:

bool | string

public static OC_App::getAppPath($appId)
Get the directory for the given app.
If the app is defined in multiple directories, the first one is taken. (false if not found)
Source:

lib/private/legacy/OC_App.php#535

Parameters:
  • $appId (string)
Returns:

string | bool

Deprecated:

11.0.0 use \OC::$server->getAppManager()->getAppPath()

public static OC_App::getAppWebPath($appId)
Get the path for the given app on the access
If the app is defined in multiple directories, the first one is taken. (false if not found)
Source:

lib/private/legacy/OC_App.php#554

Parameters:
  • $appId (string)
Returns:

string | bool

Deprecated:

18.0.0 use \OC::$server->getAppManager()->getAppWebPath()

public static OC_App::getAppVersion($appId, $useCache=\true)
get the last version of the app from appinfo/info.xml
Source:

lib/private/legacy/OC_App.php#569

Parameters:
  • $appId (string)
  • $useCache (bool)
Returns:

string

Deprecated:

14.0.0 use \OC::$server->getAppManager()->getAppVersion()

public static OC_App::getAppVersionByPath($path)
get app’s version based on it’s path
Source:

lib/private/legacy/OC_App.php#579

Parameters:
  • $path (string)
Returns:

string

public static OC_App::getAppInfo($appId, $path=\false, $lang=\null)
Read all app metadata from the info.xml file
Source:

lib/private/legacy/OC_App.php#596

Parameters:
  • $appId (string) id of the app or the path of the info.xml file
  • $path (bool)
  • $lang (string)
Returns:

array | null

Deprecated:

14.0.0 use \OC::$server->getAppManager()->getAppInfo()

public static OC_App::getNavigation()
Returns the navigation
Source:

lib/private/legacy/OC_App.php#611

Returns:

array

Deprecated:

14.0.0 use \OC::$server->getNavigationManager()->getAll()

This function returns an array containing all entries added. The entries are sorted by the key ‘order’ ascending. Additional to the keys given for each app the following keys exist:

- active: boolean, signals if the user is on this navigation entry

public static OC_App::getSettingsNavigation()
Returns the Settings Navigation
Source:

lib/private/legacy/OC_App.php#624

Returns:

string[]

Deprecated:

14.0.0 use \OC::$server->getNavigationManager()->getAll(‘settings’)

This function returns an array containing all settings pages added. The entries are sorted by the key ‘order’ ascending.

public static OC_App::getCurrentApp()
get the id of loaded app
Source:lib/private/legacy/OC_App.php#633
Returns:string
public static OC_App::getForms($type)
Source:

lib/private/legacy/OC_App.php#655

Parameters:
  • $type (string)
Returns:

array

public static OC_App::registerAdmin($app, $page)
register an admin form to be shown
Source:

lib/private/legacy/OC_App.php#679

Parameters:
  • $app (string)
  • $page (string)
public static OC_App::registerPersonal($app, $page)
register a personal form to be shown
Source:

lib/private/legacy/OC_App.php#688

Parameters:
  • $app (string)
  • $page (string)
public static OC_App::registerLogIn($entry)
Source:

lib/private/legacy/OC_App.php#696

Parameters:
  • $entry (array)
Deprecated:

20.0.0 Please register your alternative login option using the registerAlternativeLogin() on the RegistrationContext in your Application class implementing the OCP\Authentication\IAlternativeLogin interface

public static OC_App::getAlternativeLogIns()
Source:lib/private/legacy/OC_App.php#704
Returns:array
public static OC_App::getAllApps()
get a list of all apps in the apps folder
Source:lib/private/legacy/OC_App.php#755
Returns:string[] an array of app names (string IDs)
public OC_App::listAllApps()
List all apps, this is used in apps.php
Source:lib/private/legacy/OC_App.php#784
Returns:array
public static OC_App::shouldUpgrade($app)
Source:lib/private/legacy/OC_App.php#871
public static OC_App::isAppCompatible($ocVersion, $appInfo, $ignoreMax=\false)
Check whether the current ownCloud version matches the given
application’s version requirements.
The comparison is made based on the number of parts that the
app info version has. For example for ownCloud 6.0.3 if the
app info version is expecting version 6.0, the comparison is
made on the first two parts of the ownCloud version.
This means that it’s possible to specify “requiremin” => 6
and “requiremax” => 6 and it will still match ownCloud 6.0.3.
Source:

lib/private/legacy/OC_App.php#921

Parameters:
  • $ocVersion (string) ownCloud version to check against
  • $appInfo (array) app info (from xml)
Returns:

bool true if compatible, otherwise false

public static OC_App::getAppVersions()
get the installed version of all apps
Source:lib/private/legacy/OC_App.php#960
public static OC_App::updateApp($appId)
update the database for the app and call the update script
Source:

lib/private/legacy/OC_App.php#976

Parameters:
  • $appId (string)
Returns:

bool

public static OC_App::executeRepairSteps($appId, $steps)
Source:

lib/private/legacy/OC_App.php#1043

Parameters:
  • $appId (string)
  • $steps (string[])
Throws:

\OC\NeedsUpdateException

public static OC_App::setupBackgroundJobs($jobs)
Source:lib/private/legacy/OC_App.php#1066
public static OC_App::getStorage($appId)
Source:

lib/private/legacy/OC_App.php#1090

Parameters:
  • $appId (string)
Returns:

\OC\Files\View | bool

protected static OC_App::findBestL10NOption($options, $lang)
Source:lib/private/legacy/OC_App.php#1108
public static OC_App::parseAppInfo($data, $lang=\null)
parses the app data array and enhanced the ‘description’ value
Source:

lib/private/legacy/OC_App.php#1165

Parameters:
  • $data (array) the app data
  • $lang (string)
Returns:

array improved app data

public static OC_App::checkAppDependencies($config, $l, $info, $ignoreMax)
Source:

lib/private/legacy/OC_App.php#1189

Parameters:
Throws:

\Exception