dblayer/authorizationdb : tableprefix is updated

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1595 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-07-30 09:10:41 +00:00
parent 8f9e540a4a
commit 09e7559086
2 changed files with 19 additions and 13 deletions

View File

@@ -15,6 +15,8 @@ class authorizationdb extends authorization
private $separator = "/";
/** Database PDO connector */
private $db = null;
/** The prefix for the table */
public $tableprefix = "";
/** Establish a connexion to the authorization database
@param string $dsn The DSN needed to connect to database
@@ -28,6 +30,7 @@ class authorizationdb extends authorization
// Define the structure of the table in the database
$this->db = new dblayer ($dsn, $username, $password, $driver_options);
$this->db->table = "domframework_authorization";
$this->db->tableprefix = $this->tableprefix;
$this->db->fields = array (
"object"=>array ("varchar", "255", "not null"),
"ownerid"=>array ("integer", "not null"),
@@ -43,7 +46,7 @@ class authorizationdb extends authorization
if ($this->db === null)
throw new Exception (_("Database to authorize is not connected"), 500);
$tables = $this->db->listTables ();
if (!in_array ($this->db->table, $tables))
if (!in_array ($this->db->tableprefix.$this->db->table, $tables))
{
$this->db->createTable ();
$first = array ("object"=>"/", "ownerid"=>0, "groupid"=>0,