diff --git a/appinfo/app.php b/appinfo/app.php index f107252..df93a7d 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -19,8 +19,11 @@ * */ -if ((@include_once(dirname(__DIR__).'/vendor/autoload.php')) === false) - throw new \Exception('Cannot include autoload. Did you run install dependencies using composer?'); +if ((@include_once(dirname(__DIR__).'/vendor/autoload.php')) === false) { + throw new \Exception('Cannot include autoload. Did you install dependencies using composer?'); +} -$app = new \OCA\Files_external_gdrive\AppInfo\Application(); -$app->register(); +if (\OC::$server->getAppManager()->isEnabledForUser('files_external')) { + $app = new \OCA\Files_external_gdrive\AppInfo\Application(); + $app->register(); +} diff --git a/appinfo/routes.php b/appinfo/routes.php index d5b51de..eef7541 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -20,9 +20,11 @@ * */ -$application = new \OCA\Files_external_gdrive\AppInfo\Application(); -$application->registerRoutes($this, [ - 'routes' => [ - ['name' => 'oauth#receiveToken', 'url' => '/oauth', 'verb' => 'POST'], - ], -]); +if (\OC::$server->getAppManager()->isEnabledForUser('files_external')) { + $application = new \OCA\Files_external_gdrive\AppInfo\Application(); + $application->registerRoutes($this, [ + 'routes' => [ + ['name' => 'oauth#receiveToken', 'url' => '/oauth', 'verb' => 'POST'], + ], + ]); +}