Merge pull request #2059 from nextcloud/backport-2058-better-error-message-for-installation-error

[stable10] Use a better error message and point the users to the support channels
This commit is contained in:
Morris Jobke 2016-11-09 14:00:58 +01:00 committed by GitHub
commit 17b1a720fa
3 changed files with 22 additions and 7 deletions

View File

@ -40,6 +40,7 @@
namespace OC;
use Doctrine\DBAL\Exception\TableExistsException;
use OC\App\CodeChecker\CodeChecker;
use OC\App\CodeChecker\EmptyCheck;
use OC\App\CodeChecker\PrivateCheck;
@ -532,9 +533,12 @@ class Installer {
if ($softErrors) {
try {
Installer::installShippedApp($filename);
} catch (\Doctrine\DBAL\Exception\TableExistsException $e) {
$errors[$filename] = $e;
continue;
} catch (HintException $e) {
if ($e->getPrevious() instanceof TableExistsException) {
$errors[$filename] = $e;
continue;
}
throw $e;
}
} else {
Installer::installShippedApp($filename);
@ -561,7 +565,15 @@ 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>.',
0, $e
);
}
}
//run appinfo/install.php

View File

@ -149,6 +149,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()));

View File

@ -28,9 +28,8 @@
<?php if($_['admin']) { ?>
<li>
<a href="https://github.com/nextcloud/server/blob/master/CONTRIBUTING.md"
target="_blank" rel="noreferrer">
<?php p($l->t('Issue tracker')); ?>
<a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer">
<?php p($l->t('Getting help')); ?>
</a>
</li>
<?php } ?>