summaryrefslogtreecommitdiff
path: root/installer/libraries
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-19 00:14:28 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-19 00:14:28 +0000
commit631a7883ee355e5c01160eb5559f3912b4c604f8 (patch)
tree39ce9a01fd262f2350203234010ee81c16178b8c /installer/libraries
parentbecc2122094383af0fd1fdc4e353527f11ef7bc7 (diff)
Get rid of the driver libaries. Use mysql calls directly in the
installer for now. If we detect mysqli, we can always use that as a driver instead, but we don't require it for the installer.
Diffstat (limited to 'installer/libraries')
-rw-r--r--installer/libraries/Install_Mysql_Driver.php79
-rw-r--r--installer/libraries/Install_Mysqli_Driver.php86
2 files changed, 0 insertions, 165 deletions
diff --git a/installer/libraries/Install_Mysql_Driver.php b/installer/libraries/Install_Mysql_Driver.php
deleted file mode 100644
index 6ddfd1fc..00000000
--- a/installer/libraries/Install_Mysql_Driver.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2008 Bharat Mediratta
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-class Install_Mysql_Driver {
- private $_link;
- private $_server;
- private $_user;
-
- public function __construct($server, $user, $password) {
- $this->_link = @mysql_connect($server, $user, $password);
- if (!$this->_link) {
- throw new Exception(mysql_error());
- }
- $this->_server = $server;
- $this->_user = $user;
- }
-
- public function __destruct() {
- if (!empty($this->_link)) {
- @mysql_close($this->_link);
- }
- }
-
- public function list_dbs() {
- $db_list = mysql_list_dbs($this->_link);
- $databases = array();
- while ($row = mysql_fetch_object($db_list)) {
- $databases[$row->Database] = 1;
- }
- return $databases;
- }
-
- public function get_access_rights($dbname) {
- $select = "SELECT PRIVILEGE_TYPE " .
- " FROM `information_schema`.`schema_privileges`" .
- " WHERE `GRANTEE` = '\\'{$this->_user}\\'@\\'{$this->_server}\\''" .
- " AND `TABLE_SCHEMA` = '$dbname';";
- $privileges = mysql_query($select, $this->_link);
- $permissions = array();
- if ($privileges) {
- while ($row = mysql_fetch_assoc($privileges)) {
- $permissions[strtolower($row["PRIVILEGE_TYPE"])] = 1;
- }
- }
- return $permissions;
- }
-
- public function select_db($dbname) {
- mysql_select_db($dbname);
- }
-
- public function list_tables($dbname) {
- $select = "SHOW TABLES FROM $dbname;";
- $db_tables = mysql_query($select, $this->_link);
- $tables = array();
- if ($db_tables) {
- while ($row = mysql_fetch_assoc($db_tables)) {
- $tables[$row["Tables_in_$dbname"]] = 1;
- }
- }
- return $tables;
- }
-}
diff --git a/installer/libraries/Install_Mysqli_Driver.php b/installer/libraries/Install_Mysqli_Driver.php
deleted file mode 100644
index 9eaaf1fc..00000000
--- a/installer/libraries/Install_Mysqli_Driver.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2008 Bharat Mediratta
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-// Convienence wrapper around the Php mysqli class
-class Install_Mysqli_Driver {
- private $_mysqli;
- private $_server;
- private $_user;
-
- public function __construct($server, $user, $password) {
- $this->_mysqli = @mysqli_connect($server, $user, $password);
- if (!$this->_mysqli) {
- throw new Exception(mysqli_connect_error());
- }
- $this->_server = $server;
- $this->_user = $user;
- }
-
- public function __destruct() {
- if (!empty($this->_mysqli)) {
- @$this->_mysqli->close();
- $this->_mysqli = null;
- }
- }
-
- public function list_dbs() {
- $db_list = $this->_mysqli->query("SHOW DATABASES");
- $databases = array();
- if ($db_list) {
- while ($row = $db_list->fetch_row()) {
- $databases[$row[0]] = 1;
- }
- }
- return $databases;
- }
-
- public function get_access_rights($dbname) {
- $select = "SELECT PRIVILEGE_TYPE " .
- " FROM `information_schema`.`schema_privileges`" .
- " WHERE `GRANTEE` = '\\'{$this->_user}\\'@\\'{$this->_server}\\''" .
- " AND `TABLE_SCHEMA` = '$dbname';";
- print $select;
- $privileges = $this->_mysqli->query($select);
- $permissions = array();
- if ($privileges) {
- while ($row = $privileges->fetch_row()) {
- $permissions[strtolower($row[0])] = 1;
- }
- }
- return $permissions;
- }
-
- public function select_db($dbname) {
- $this->_mysqli->select_db($dbname);
- }
-
- public function list_tables($dbname) {
- $select = "SHOW TABLES FROM $dbname;";
- $db_tables = $this->_mysqli->query($select);
- $tables = array();
- if ($db_tables) {
- while ($row = $db_tables->fetch_row()) {
- $tables[strtolower($row[0])] = 1;
- }
- }
- return $tables;
- }
-}
-