summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-24 13:53:17 +0200
committerGitHub <noreply@github.com>2017-10-24 13:53:17 +0200
commit3eaf23f29f67dbb6077121cc24beaddd8d587504 (patch)
tree738ba69ef08701f9917206dc101b967035fa17c2
parent18601903052e389d7dbc25ff2603eb7091415ca0 (diff)
parentf884e762bcf3e1737f1cdd5a4453ca0664087b61 (diff)
downloadnextcloud-server-3eaf23f29f67dbb6077121cc24beaddd8d587504.tar.gz
nextcloud-server-3eaf23f29f67dbb6077121cc24beaddd8d587504.zip
Merge pull request #6920 from nextcloud/appmanager-usage
Use appmanager instead of OC_App for check for enabled app
-rw-r--r--apps/files_sharing/tests/UpdaterTest.php2
-rw-r--r--core/Command/Maintenance/Repair.php5
-rw-r--r--lib/private/legacy/app.php2
-rw-r--r--lib/private/legacy/json.php2
-rw-r--r--lib/private/legacy/template.php2
-rw-r--r--lib/public/App.php3
-rw-r--r--settings/users.php5
7 files changed, 12 insertions, 9 deletions
diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index 63000152b5a..c01365a500a 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -70,7 +70,7 @@ class UpdaterTest extends TestCase {
* that the mount point doesn't end up at the trash bin
*/
public function testDeleteParentFolder() {
- $status = \OC_App::isEnabled('files_trashbin');
+ $status = \OC::$server->getAppManager()->isEnabledForUser('files_trashbin');
(new \OC_App())->enable('files_trashbin');
diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php
index 299554fe190..0d95b0ea3e2 100644
--- a/core/Command/Maintenance/Repair.php
+++ b/core/Command/Maintenance/Repair.php
@@ -78,9 +78,10 @@ class Repair extends Command {
}
}
- $apps = \OC::$server->getAppManager()->getInstalledApps();
+ $appManager = \OC::$server->getAppManager();
+ $apps = $appManager->getInstalledApps();
foreach ($apps as $app) {
- if (!\OC_App::isEnabled($app)) {
+ if (!$appManager->isEnabledForUser($app)) {
continue;
}
$info = \OC_App::getAppInfo($app);
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index bd261b05e51..9b25810ca98 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -1159,7 +1159,7 @@ class OC_App {
* @return \OC\Files\View|false
*/
public static function getStorage($appId) {
- if (OC_App::isEnabled($appId)) { //sanity check
+ if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
if (\OC::$server->getUserSession()->isLoggedIn()) {
$view = new \OC\Files\View('/' . OC_User::getUser());
if (!$view->file_exists($appId)) {
diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php
index 180dd7c448d..221a0047eb4 100644
--- a/lib/private/legacy/json.php
+++ b/lib/private/legacy/json.php
@@ -55,7 +55,7 @@ class OC_JSON{
* @suppress PhanDeprecatedFunction
*/
public static function checkAppEnabled($app) {
- if( !OC_App::isEnabled($app)) {
+ if( !\OC::$server->getAppManager()->isEnabledForUser($app)) {
$l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' )));
exit();
diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php
index 8c6185cd556..55df2dece11 100644
--- a/lib/private/legacy/template.php
+++ b/lib/private/legacy/template.php
@@ -297,7 +297,7 @@ class OC_Template extends \OC\Template\Base {
* @suppress PhanAccessMethodInternal
*/
public static function printErrorPage( $error_msg, $hint = '' ) {
- if (\OC_App::isEnabled('theming') && !\OC_App::isAppLoaded('theming')) {
+ if (\OC::$server->getAppManager()->isEnabledForUser('theming') && !\OC_App::isAppLoaded('theming')) {
\OC_App::loadApp('theming');
}
diff --git a/lib/public/App.php b/lib/public/App.php
index 06dde22b8d1..250d33bf01f 100644
--- a/lib/public/App.php
+++ b/lib/public/App.php
@@ -127,9 +127,10 @@ class App {
*
* This function checks whether or not an app is enabled.
* @since 4.0.0
+ * @deprecated 13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId)
*/
public static function isEnabled( $app ) {
- return \OC_App::isEnabled( $app );
+ return \OC::$server->getAppManager()->isEnabledForUser( $app );
}
/**
diff --git a/settings/users.php b/settings/users.php
index 76c6b5848eb..2d949cb618c 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -41,6 +41,7 @@ OC_Util::checkSubAdminUser();
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
+$appManager = \OC::$server->getAppManager();
// Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME
$sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT;
@@ -51,7 +52,7 @@ if ($config->getSystemValue('sort_groups_by_name', false)) {
$sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME;
} else {
$isLDAPUsed = false;
- if (\OC_App::isEnabled('user_ldap')) {
+ if ($appManager->isEnabledForUser('user_ldap')) {
$isLDAPUsed =
$groupManager->isBackendUsed('\OCA\User_LDAP\Group_LDAP')
|| $groupManager->isBackendUsed('\OCA\User_LDAP\Group_Proxy');
@@ -76,7 +77,7 @@ $groupsInfo = new \OC\Group\MetaData(
$groupsInfo->setSorting($sortGroupsBy);
list($adminGroup, $groups) = $groupsInfo->get();
-$recoveryAdminEnabled = OC_App::isEnabled('encryption') &&
+$recoveryAdminEnabled = $appManager->isEnabledForUser('encryption') &&
$config->getAppValue( 'encryption', 'recoveryAdminEnabled', '0');
if($isAdmin) {