Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

+18 -13
View File
@@ -5,11 +5,11 @@
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: bfarber $
* $Author: AndyMillne $
* @since Tuesday 1st March 2005 15:40
* $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* @version v3.3.4
* $Revision: 10914 $
* $LastChangedDate: 2013-05-07 11:14:15 -0400 (Tue, 07 May 2013) $
* @version v3.4.5
* $Revision: 12235 $
*/
/**
@@ -89,7 +89,7 @@ class db_tools
$final_primary = array();
/* Remove backticks */
$definition = str_replace( '`', '', $definition );
$definition = $this->_sqlStripTicks( $definition );
$definition = preg_replace( "#CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\s+#i", "CREATE TABLE ", $definition );
@@ -141,7 +141,7 @@ class db_tools
// Now find all non-primary keys
//-----------------------------------------
if ( preg_match_all( "#\s+?(UNIQUE KEY|KEY|INDEX|UNIQUE)\s+?(?:(\w+?)\s+?)?\(\s*(.+?)\s*\)(\n|,\n)#is", $definition, $fields ) )
if ( preg_match_all( "#\s+?(UNIQUE KEY|KEY|INDEX|UNIQUE)\s+?(?:(\w+?)\s+?)?\(\s*(.+?)\s*\)(?:\s+using (?:btree|hash))?(\n|,\n)#is", $definition, $fields ) )
{
//-----------------------------------------
// We got some fields!
@@ -209,8 +209,10 @@ class db_tools
// Get table schematics and clean it
//-----------------------------------------
$row = ipsRegistry::DB()->getTableSchematic( $data['table'] );
$tbl = $this->_sqlStripTicks( $row['Create Table'] );
$row = ipsRegistry::DB()->getTableSchematic( $data['table'] );
$tbl = $this->_sqlStripTicks( $row['Create Table'] );
$tbl = preg_replace( "#(USING BTREE|USING HASH)#i", "", $tbl );
//-----------------------------------------
// Start output (one per index)
@@ -357,7 +359,7 @@ class db_tools
$ok = 0;
/* MySql seems to name multi-column indexes by the first field name regardless of what KEY NAME you specify. I know, nice isn't it. */
if ( strstr( $index_cols, ',' ) AND ! preg_match( "#\n\s*?(?:UNIQUE KEY|KEY|INDEX|UNIQUE)\s+?{$_checkName}\s+?(\(\s*(.+?)\s*\))(\n|,\n)#is", $tbl, $match ) )
if ( strstr( $index_cols, ',' ) AND ! preg_match( "#\n\s*?(?:UNIQUE KEY|KEY|INDEX|UNIQUE)\s+?{$_checkName}\s+?(\(\s*(.+?)\s*\))(?:\s+using (?:btree|hash))?(\s|,\s)#is", $tbl, $match ) )
{
list( $_checkName, ) = explode( ',', $index_cols );
@@ -372,7 +374,7 @@ class db_tools
// Is the key there?
//-----------------------------------------
if ( preg_match( "#\n\s*?(?:UNIQUE KEY|KEY|INDEX|UNIQUE)\s+?{$_checkName}\s+?(\(\s*(.+?)\s*\))(\n|,\n)#is", $tbl, $match ) )
if ( preg_match( "#\n\s*?(?:UNIQUE KEY|KEY|INDEX|UNIQUE)\s+?{$_checkName}\s+?(\(\s*(.+?)\s*\))(?:\s+using (?:btree|hash))?(\s|,\s)#is", $tbl, $match ) )
{
$ok = 1;
@@ -524,7 +526,7 @@ class db_tools
$missing_columns = array();
/* Remove backticks */
$the_table = str_replace( '`', '', $the_table );
$the_table = $this->_sqlStripTicks( $the_table );
$the_table = preg_replace( "#CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\s+#i", "CREATE TABLE ", $the_table );
@@ -780,7 +782,7 @@ class db_tools
}
/**
* Remove ticks from statement
* Remove ticks and double quotes from statement
*
* @param string $data String to clean
* @return @e string
@@ -792,6 +794,9 @@ class db_tools
*/
protected function _sqlStripTicks( $data )
{
return str_replace( "`", "", $data );
$data = str_replace( '`', '', $data );
$data = str_replace( '"', '', $data );
return $data;
}
}