Skip to content
Snippets Groups Projects
Commit 0132a0b2 authored by Sean Comeau's avatar Sean Comeau
Browse files

Rename TestException to DatabaseSetupException

parent 42cd9962
No related branches found
No related tags found
No related merge requests found
<?php <?php
class HintException extends Exception class DatabaseSetupException extends Exception
{ {
private $hint; private $hint;
...@@ -87,7 +87,7 @@ class OC_Setup { ...@@ -87,7 +87,7 @@ class OC_Setup {
try { try {
self::setupMySQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username); self::setupMySQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username);
} catch (HintException $e) { } catch (DatabaseSetupException $e) {
$error[] = array( $error[] = array(
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'hint' => $e->getHint() 'hint' => $e->getHint()
...@@ -190,7 +190,7 @@ class OC_Setup { ...@@ -190,7 +190,7 @@ class OC_Setup {
//check if the database user has admin right //check if the database user has admin right
$connection = @mysql_connect($dbhost, $dbuser, $dbpass); $connection = @mysql_connect($dbhost, $dbuser, $dbpass);
if(!$connection) { if(!$connection) {
throw new HintException('MySQL username and/or password not valid','You need to enter either an existing account or the administrator.'); throw new DatabaseSetupException('MySQL username and/or password not valid','You need to enter either an existing account or the administrator.');
} }
$oldUser=OC_Config::getValue('dbuser', false); $oldUser=OC_Config::getValue('dbuser', false);
...@@ -254,12 +254,12 @@ class OC_Setup { ...@@ -254,12 +254,12 @@ class OC_Setup {
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'"; $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
$result = mysql_query($query, $connection); $result = mysql_query($query, $connection);
if (!$result) { if (!$result) {
throw new HintException("MySQL user '" . "$name" . "'@'localhost' already exists","Delete this user from MySQL."); throw new DatabaseSetupException("MySQL user '" . "$name" . "'@'localhost' already exists","Delete this user from MySQL.");
} }
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
$result = mysql_query($query, $connection); $result = mysql_query($query, $connection);
if (!$result) { if (!$result) {
throw new HintException("MySQL user '" . "$name" . "'@'%' already exists","Delete this user from MySQL."); throw new DatabaseSetupException("MySQL user '" . "$name" . "'@'%' already exists","Delete this user from MySQL.");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment