Merge pull request #2058 from nextcloud/better-error-message-for-installation-error
Use a better error message and point the users to the support channels
This commit is contained in:
commit
742c215946
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
namespace OC;
|
namespace OC;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Exception\TableExistsException;
|
||||||
use OC\App\AppStore\Fetcher\AppFetcher;
|
use OC\App\AppStore\Fetcher\AppFetcher;
|
||||||
use OC\App\CodeChecker\CodeChecker;
|
use OC\App\CodeChecker\CodeChecker;
|
||||||
use OC\App\CodeChecker\EmptyCheck;
|
use OC\App\CodeChecker\EmptyCheck;
|
||||||
|
@ -428,9 +429,12 @@ class Installer {
|
||||||
if ($softErrors) {
|
if ($softErrors) {
|
||||||
try {
|
try {
|
||||||
Installer::installShippedApp($filename);
|
Installer::installShippedApp($filename);
|
||||||
} catch (\Doctrine\DBAL\Exception\TableExistsException $e) {
|
} catch (HintException $e) {
|
||||||
$errors[$filename] = $e;
|
if ($e->getPrevious() instanceof TableExistsException) {
|
||||||
continue;
|
$errors[$filename] = $e;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Installer::installShippedApp($filename);
|
Installer::installShippedApp($filename);
|
||||||
|
@ -457,7 +461,15 @@ class Installer {
|
||||||
//install the database
|
//install the database
|
||||||
$appPath = OC_App::getAppPath($app);
|
$appPath = OC_App::getAppPath($app);
|
||||||
if(is_file("$appPath/appinfo/database.xml")) {
|
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
|
//run appinfo/install.php
|
||||||
|
|
|
@ -121,6 +121,10 @@ class Updater extends BasicEmitter {
|
||||||
$success = true;
|
$success = true;
|
||||||
try {
|
try {
|
||||||
$this->doUpgrade($currentVersion, $installedVersion);
|
$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) {
|
} catch (\Exception $exception) {
|
||||||
$this->log->logException($exception, ['app' => 'core']);
|
$this->log->logException($exception, ['app' => 'core']);
|
||||||
$this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
|
$this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
|
||||||
|
|
Loading…
Reference in New Issue