diff options
author | Joas Schilling <coding@schilljs.com> | 2017-03-24 15:02:49 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-03-24 15:02:49 +0100 |
commit | 4174d75f8661ca3a26ef8cdfd48a6f955491fdfe (patch) | |
tree | 1f0b1ea8da3f0bde3eb692e88069323969aa7a1c /core/routes.php | |
parent | bc11c7ba97bcfb6115ed374b78cb767a2f328545 (diff) | |
download | nextcloud-server-4174d75f8661ca3a26ef8cdfd48a6f955491fdfe.tar.gz nextcloud-server-4174d75f8661ca3a26ef8cdfd48a6f955491fdfe.zip |
Throw a nice HintException when the apps are missing
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/routes.php')
-rw-r--r-- | core/routes.php | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/core/routes.php b/core/routes.php index 5243691df47..9b49b7198c3 100644 --- a/core/routes.php +++ b/core/routes.php @@ -84,26 +84,46 @@ $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($ // Call routes $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) { - $app = new \OCA\Spreed\AppInfo\Application($urlParams); - $app->dispatch('PageController', 'index'); + if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { + $app = new \OCA\Spreed\AppInfo\Application($urlParams); + $app->dispatch('PageController', 'index'); + } else { + throw new \OC\HintException('App spreed is not enabled'); + } }); // Sharing routes $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) { - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); - $app->dispatch('ShareController', 'showShare'); + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); + $app->dispatch('ShareController', 'showShare'); + } else { + throw new \OC\HintException('App file sharing is not enabled'); + } }); $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) { - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); - $app->dispatch('ShareController', 'authenticate'); + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); + $app->dispatch('ShareController', 'authenticate'); + } else { + throw new \OC\HintException('App file sharing is not enabled'); + } }); $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) { - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); - $app->dispatch('ShareController', 'showAuthenticate'); + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); + $app->dispatch('ShareController', 'showAuthenticate'); + } else { + throw new \OC\HintException('App file sharing is not enabled'); + } }); $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) { - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); - $app->dispatch('ShareController', 'downloadShare'); + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); + $app->dispatch('ShareController', 'downloadShare'); + } else { + throw new \OC\HintException('App file sharing is not enabled'); + } }); // used for heartbeat |