mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
added the final steps needed for creating the database for the user
This commit is contained in:
parent
d17e4d5648
commit
0c41c058d1
@ -75,7 +75,6 @@ class db {
|
||||
|
||||
/* establish connection, select database */
|
||||
if ( 0 == $this->Link_ID ) {
|
||||
|
||||
$this->Link_ID=mysql_pconnect($Host, $User, $Password);
|
||||
if (!$this->Link_ID) {
|
||||
$this->halt("pconnect($Host, $User, \$Password) failed.");
|
||||
@ -443,4 +442,27 @@ class db {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function create_database($dbname, $adminname = "", $adminpasswd = "") {
|
||||
$currentUser = $this->User;
|
||||
$currentPassword = $this->Password;
|
||||
$currentDatabase = $this->Database;
|
||||
|
||||
if ($adminname != "")
|
||||
{
|
||||
$this->User = $adminname;
|
||||
$this->Password = $adminpasswd;
|
||||
$this->Database = "mysql";
|
||||
}
|
||||
$this->disconnect();
|
||||
$this->query("CREATE DATABASE $dbname");
|
||||
$this->query("grant all on $dbname.* to $currentUser@localhost identified by '$currentPassword'");
|
||||
$this->disconnect();
|
||||
|
||||
$this->User = $currentUser;
|
||||
$this->Password = $currentPassword;
|
||||
$this->Database = $currentDatabase;
|
||||
$this->connect();
|
||||
//return $return;
|
||||
}
|
||||
}
|
||||
|
@ -321,4 +321,27 @@ class db {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function create_database($dbname, $adminname = "", $adminpasswd = "") {
|
||||
$currentUser = $this->User;
|
||||
$currentPassword = $this->Password;
|
||||
$currentDatabase = $this->Database;
|
||||
|
||||
if ($adminname != "")
|
||||
{
|
||||
$this->User = $adminname;
|
||||
$this->Password = $adminpasswd;
|
||||
$this->Database = "mysql";
|
||||
}
|
||||
$this->disconnect();
|
||||
$this->query("CREATE DATABASE $dbname");
|
||||
$this->query("grant all on $dbname.* to $currentUser@localhost identified by '$currentPassword'");
|
||||
$this->disconnect();
|
||||
|
||||
$this->User = $currentUser;
|
||||
$this->Password = $currentPassword;
|
||||
$this->Database = $currentDatabase;
|
||||
$this->connect();
|
||||
//return $return;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user