mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
No more MySQL errors when using db_Table_exists(). Install now saving preferences in a better way.
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* mySQL Handler
|
* mySQL Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
||||||
* $Revision: 1.44 $
|
* $Revision: 1.45 $
|
||||||
* $Date: 2009-09-04 01:17:21 $
|
* $Date: 2009-09-05 12:48:28 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
|
|||||||
* MySQL Abstraction class
|
* MySQL Abstraction class
|
||||||
*
|
*
|
||||||
* @package e107
|
* @package e107
|
||||||
* @version $Revision: 1.44 $
|
* @version $Revision: 1.45 $
|
||||||
* @author $Author: e107coders $
|
* @author $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
class db {
|
class db {
|
||||||
@@ -81,6 +81,7 @@ class db {
|
|||||||
var $mySQLlanguage;
|
var $mySQLlanguage;
|
||||||
var $mySQLinfo;
|
var $mySQLinfo;
|
||||||
var $tabset;
|
var $tabset;
|
||||||
|
private $mySQLtableList = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public MySQL Charset
|
* @public MySQL Charset
|
||||||
@@ -1146,20 +1147,34 @@ class db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Verify whether a table exists, without causing an error
|
* Verify whether a table exists, without causing an error
|
||||||
*
|
*
|
||||||
* @param string $table
|
* @param string $table Table name without the prefix
|
||||||
* @return string
|
* @return boolean TRUE if exists, FALSE if it doesn't
|
||||||
*
|
*
|
||||||
* NOTES: the 'official' way to do this uses SHOW TABLE STATUS, but that is 20x slower!
|
* NOTES: Slower (28ms) than "SELECT 1 FROM" (4-5ms), but doesn't produce MySQL errors.
|
||||||
* LIMIT 0 is 3x slower than LIMIT 1
|
* Multiple checks on a single page will only use 1 query. ie. faster on multiple calls.
|
||||||
*/
|
*/
|
||||||
function db_Table_exists($table)
|
function db_Table_exists($table)
|
||||||
{
|
{
|
||||||
$res = $this->db_Query("SELECT 1 FROM ".$this->mySQLPrefix.$table." LIMIT 1"); // error if not there
|
if(!$this->mySQLtableList)
|
||||||
if ($res) return TRUE;
|
{
|
||||||
return FALSE;
|
$res = $this->db_Query("SHOW TABLES LIKE '".$this->mySQLPrefix."%' "); // error if not there
|
||||||
|
while($rows = $this->db_Fetch(MYSQL_BOTH))
|
||||||
|
{
|
||||||
|
$this->mySQLtableList[] = $rows[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!in_array($this->mySQLPrefix.$table,$this->mySQLtableList))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
13
install_.php
13
install_.php
@@ -9,8 +9,8 @@
|
|||||||
* Installation file
|
* Installation file
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/install_.php,v $
|
* $Source: /cvs_backup/e107_0.8/install_.php,v $
|
||||||
* $Revision: 1.35 $
|
* $Revision: 1.36 $
|
||||||
* $Date: 2009-09-04 01:17:22 $
|
* $Date: 2009-09-05 12:48:28 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -986,11 +986,12 @@ class e_install
|
|||||||
$cookiename = str_replace(" ","_",$this->previous_steps['prefs']['sitename']);
|
$cookiename = str_replace(" ","_",$this->previous_steps['prefs']['sitename']);
|
||||||
$this->previous_steps['prefs']['cookie_name'] = substr($cookiename,0,5)."cookie";
|
$this->previous_steps['prefs']['cookie_name'] = substr($cookiename,0,5)."cookie";
|
||||||
|
|
||||||
foreach($this->previous_steps['prefs'] as $key=>$val)
|
// foreach($this->previous_steps['prefs'] as $key=>$val)
|
||||||
{
|
// {
|
||||||
e107::getConfig('core')->set($key,$val);
|
// e107::getConfig('core')->set($key,$val);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
e107::getConfig('core')->setPref($this->previous_steps['prefs']);
|
||||||
e107::getConfig('core')->save(FALSE); // save preferences made during install.
|
e107::getConfig('core')->save(FALSE); // save preferences made during install.
|
||||||
|
|
||||||
// Create the admin user - replacing any that may be been included in the XML.
|
// Create the admin user - replacing any that may be been included in the XML.
|
||||||
|
Reference in New Issue
Block a user