mirror of
https://github.com/nextcloud/server.git
synced 2025-03-16 17:24:10 +00:00
Use appmanager instead of OC_App for check for enabled app
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
db1096bcfd
commit
f884e762bc
7 changed files with 12 additions and 9 deletions
apps/files_sharing/tests
core/Command/Maintenance
lib
settings
|
@ -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');
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue