]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use a better error message and point the users to the support channels
authorJoas Schilling <coding@schilljs.com>
Wed, 9 Nov 2016 08:10:32 +0000 (09:10 +0100)
committerJoas Schilling <coding@schilljs.com>
Wed, 9 Nov 2016 08:10:32 +0000 (09:10 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Installer.php
lib/private/Updater.php

index 2366b762654edac4a41919d6cf2046b0ce5e81d1..fdfa44c143f29208b0bbf11ea1b71e6b58937e39 100644 (file)
@@ -41,6 +41,7 @@
 
 namespace OC;
 
+use Doctrine\DBAL\Exception\TableExistsException;
 use OC\App\AppStore\Fetcher\AppFetcher;
 use OC\App\CodeChecker\CodeChecker;
 use OC\App\CodeChecker\EmptyCheck;
@@ -457,7 +458,14 @@ class Installer {
                //install the database
                $appPath = OC_App::getAppPath($app);
                if(is_file("$appPath/appinfo/database.xml")) {
-                       OC_DB::createDbFromStructure("$appPath/appinfo/database.xml");
+                       try {
+                               OC_DB::createDbFromStructure("$appPath/appinfo/database.xml");
+                       } catch (TableExistsException $e) {
+                               throw new HintException(
+                                       'Failed to enable app ' . $app,
+                                       'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer">support channels</a>.'
+                               );
+                       }
                }
 
                //run appinfo/install.php
index e7f7a9449022db9f15dde1ee30b0d29196ca35b9..2fed67988b889cefa12d6ae1d7b6d1ee19ff1c5e 100644 (file)
@@ -121,6 +121,10 @@ class Updater extends BasicEmitter {
                $success = true;
                try {
                        $this->doUpgrade($currentVersion, $installedVersion);
+               } catch (HintException $exception) {
+                       $this->log->logException($exception, ['app' => 'core']);
+                       $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint()));
+                       $success = false;
                } catch (\Exception $exception) {
                        $this->log->logException($exception, ['app' => 'core']);
                        $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));