Skip to content
Snippets Groups Projects
Commit 45d07906 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #7131 from owncloud/issue/6269

Change MySQL to MariaDB/MySQL in the frontend
parents 8c7fb64b dbec143f
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ class Controller { ...@@ -91,7 +91,7 @@ class Controller {
$databases['sqlite'] = 'SQLite'; $databases['sqlite'] = 'SQLite';
} }
if ($hasMySQL) { if ($hasMySQL) {
$databases['mysql'] = 'MySQL'; $databases['mysql'] = 'MySQL/MariaDB';
} }
if ($hasPostgreSQL) { if ($hasPostgreSQL) {
$databases['pgsql'] = 'PostgreSQL'; $databases['pgsql'] = 'PostgreSQL';
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
namespace OC\Setup; namespace OC\Setup;
class MySQL extends AbstractDatabase { class MySQL extends AbstractDatabase {
public $dbprettyname = 'MySQL'; public $dbprettyname = 'MySQL/MariaDB';
public function setupDatabase($username) { public function setupDatabase($username) {
//check if the database user has admin right //check if the database user has admin right
$connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword); $connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
if(!$connection) { if(!$connection) {
throw new \DatabaseSetupException($this->trans->t('MySQL username and/or password not valid'), throw new \DatabaseSetupException($this->trans->t('MySQL/MariaDB username and/or password not valid'),
$this->trans->t('You need to enter either an existing account or the administrator.')); $this->trans->t('You need to enter either an existing account or the administrator.'));
} }
$oldUser=\OC_Config::getValue('dbuser', false); $oldUser=\OC_Config::getValue('dbuser', false);
...@@ -82,14 +82,14 @@ class MySQL extends AbstractDatabase { ...@@ -82,14 +82,14 @@ class MySQL extends AbstractDatabase {
$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 \DatabaseSetupException($this->trans->t("MySQL user '%s'@'localhost' exists already.", array($name)), throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'localhost' exists already.", array($name)),
$this->trans->t("Drop this user from MySQL", array($name))); $this->trans->t("Drop this user from MySQL/MariaDB", array($name)));
} }
$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 \DatabaseSetupException($this->trans->t("MySQL user '%s'@'%%' already exists", array($name)), throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'%%' already exists", array($name)),
$this->trans->t("Drop this user from MySQL.")); $this->trans->t("Drop this user from MySQL/MariaDB."));
} }
} }
} }
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