mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Generic index add routine for updates; index date stamp in tmp
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
||||||
| $Revision: 1.12 $
|
| $Revision: 1.13 $
|
||||||
| $Date: 2008-11-02 14:54:38 $
|
| $Date: 2008-11-18 21:29:37 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -457,7 +457,8 @@ CREATE TABLE tmp (
|
|||||||
tmp_ip varchar(45) NOT NULL default '',
|
tmp_ip varchar(45) NOT NULL default '',
|
||||||
tmp_time int(10) unsigned NOT NULL default '0',
|
tmp_time int(10) unsigned NOT NULL default '0',
|
||||||
tmp_info text NOT NULL,
|
tmp_info text NOT NULL,
|
||||||
KEY tmp_ip (tmp_ip)
|
KEY tmp_ip (tmp_ip),
|
||||||
|
KEY tmp_time (tmp_time)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
||||||
| $Revision: 1.30 $
|
| $Revision: 1.31 $
|
||||||
| $Date: 2008-11-09 20:14:17 $
|
| $Date: 2008-11-18 21:29:37 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -442,28 +442,24 @@ function update_706_to_800($type='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
|
||||||
// Add index to download history
|
// Add index to download history
|
||||||
//---------------------------------------------------------
|
if (FALSE !== ($temp = addIndexToTable('download_requests', 'download_request_datestamp', $just_check, &$updateMessages)))
|
||||||
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."download_requests"))
|
|
||||||
{
|
{
|
||||||
$found = FALSE;
|
if ($just_check)
|
||||||
while ($row = $sql -> db_Fetch())
|
|
||||||
{ // One index per field
|
|
||||||
if (in_array('download_request_datestamp', $row))
|
|
||||||
{
|
{
|
||||||
$found = TRUE;
|
return update_needed($temp);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!$found)
|
|
||||||
{
|
|
||||||
if ($just_check) return update_needed();
|
|
||||||
mysql_query("ALTER TABLE `".MPREFIX."download_requests` ADD INDEX `download_request_datestamp` (`download_request_datestamp`);");
|
|
||||||
$updateMessages[] = LAN_UPDATE_37;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extra index to tmp table
|
||||||
|
if (FALSE !== ($temp = addIndexToTable('tmp', 'tmp_time', $just_check, &$updateMessages)))
|
||||||
|
{
|
||||||
|
if ($just_check)
|
||||||
|
{
|
||||||
|
return update_needed($temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Front page prefs (logic has changed)
|
// Front page prefs (logic has changed)
|
||||||
if (!isset($pref['frontpage_force']))
|
if (!isset($pref['frontpage_force']))
|
||||||
@@ -825,6 +821,32 @@ function mysql_table_exists($table)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Add index to a table. Returns FALSE if not required. Returns a message if required and just checking
|
||||||
|
function addIndexToTable($target, $indexSpec, $just_check, &$updateMessages)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX.$target))
|
||||||
|
{
|
||||||
|
$found = FALSE;
|
||||||
|
while ($row = $sql -> db_Fetch())
|
||||||
|
{ // One index per field
|
||||||
|
if (in_array($indexSpec, $row))
|
||||||
|
{
|
||||||
|
return !$just_check; // Found - nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Index not found here
|
||||||
|
if ($just_check)
|
||||||
|
{
|
||||||
|
return 'Required to add index to '.$target;
|
||||||
|
}
|
||||||
|
mysql_query("ALTER TABLE `".MPREFIX.$target."` ADD INDEX `".$indexSpec."` (`".$indexSpec."`);");
|
||||||
|
$updateMessages[] = str_replace(array('--TABLE--','--INDEX--'),array($target,$indexSpec),LAN_UPDATE_37);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function catch_error()
|
function catch_error()
|
||||||
{
|
{
|
||||||
if (mysql_error()!='' && E107_DEBUG_LEVEL != 0)
|
if (mysql_error()!='' && E107_DEBUG_LEVEL != 0)
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
| e107 website system - Language File.
|
| e107 website system - Language File.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_e107_update.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_e107_update.php,v $
|
||||||
| $Revision: 1.4 $
|
| $Revision: 1.5 $
|
||||||
| $Date: 2008-11-09 20:14:22 $
|
| $Date: 2008-11-18 21:29:43 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -41,7 +41,7 @@ define('LAN_UPDATE_33', 'Update comment table format');
|
|||||||
define('LAN_UPDATE_34', 'Error adding columns to comment table');
|
define('LAN_UPDATE_34', 'Error adding columns to comment table');
|
||||||
define('LAN_UPDATE_35', 'Error modifying data in comment table');
|
define('LAN_UPDATE_35', 'Error modifying data in comment table');
|
||||||
define('LAN_UPDATE_36', 'Error deleting old field in comment table');
|
define('LAN_UPDATE_36', 'Error deleting old field in comment table');
|
||||||
define('LAN_UPDATE_37', 'Add index to download history');
|
define('LAN_UPDATE_37', 'Add index --INDEX-- to table --TABLE--');
|
||||||
define('LAN_UPDATE_38', 'Update front page settings');
|
define('LAN_UPDATE_38', 'Update front page settings');
|
||||||
define('LAN_UPDATE_39', 'Update linkwords table');
|
define('LAN_UPDATE_39', 'Update linkwords table');
|
||||||
define('LAN_UPDATE_40', 'Update newsfeeds table');
|
define('LAN_UPDATE_40', 'Update newsfeeds table');
|
||||||
|
Reference in New Issue
Block a user