osCommerce Release 2.2 MS1 to MS2 Database Update Script

This script can be copied to any web directory to upgrade a MS1 database to a MS2 database. By MS1 and MS2 I mean the state of the database the DAY that the MS release was made, not *any* MS1 like CVS tree. So if you upgraded to MS1 and stayed there you can use this script.

Database Server Information
Server: (eg, 192.168.0.1)
Username: (eg, root)
Password: (eg, bee)
Database: (eg, catalog)
 
' . $errno . ' - ' . $error . '

' . $query . '

[TEP STOP]

'); } function osc_db_query($db_query) { global $db_link; $result = mysql_query($db_query, $db_link) or osc_db_error($db_query, mysql_errno(), mysql_error()); return $result; } function osc_db_fetch_array($db_query) { $result = mysql_fetch_array($db_query); return $result; } function osc_db_num_rows($db_query) { return mysql_num_rows($db_query); } // Sets timeout for the current script. // Cant be used in safe mode. function osc_set_time_limit($limit) { if (!get_cfg_var('safe_mode')) { set_time_limit($limit); } } osc_db_connect() or die('Unable to connect to database server!'); ?>

osCommerce
Open Source E-Commerce Solutions

Upgrade

Step 1: Database Upgrade

- Address Book
- Configuration

Status: Preparing

0) { $country = osc_db_fetch_array($country_query); if ($country['name'] != '') { $new_country_query = osc_db_query("select countries_id from countries where countries_iso_code_2 = '" . $country['name'] . "'"); $new_country = osc_db_fetch_array($new_country_query); if ($new_country['countries_iso_code_2'] != NULL) { osc_db_query("update configuration set configuration_value = " . $new_country['countries_iso_code_2'] . " where configuration_key = 'SHIPPING_ORIGIN_COUNTRY'"); } } } osc_db_query("delete from configuration where configuration_key = 'STORE_ORIGIN_COUNTRY'"); osc_db_query("insert into configuration_group values ('15', 'Sessions', 'Session options', '15', '1')"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Session Directory', 'SESSION_WRITE_DIRECTORY', '/tmp', 'If sessions are file based, store them in this directory.', '15', '1', now())"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Force Cookie Use', 'SESSION_FORCE_COOKIE_USE', 'False', 'Force the use of sessions when cookies are only enabled.', '15', '2', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check SSL Session ID', 'SESSION_CHECK_SSL_SESSION_ID', 'False', 'Validate the SSL_SESSION_ID on every secure HTTPS page request.', '15', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check User Agent', 'SESSION_CHECK_USER_AGENT', 'False', 'Validate the clients browser user agent on every page request.', '15', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check IP Address', 'SESSION_CHECK_IP_ADDRESS', 'False', 'Validate the clients IP address on every page request.', '15', '5', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Prevent Spider Sessions', 'SESSION_BLOCK_SPIDERS', 'False', 'Prevent known spiders from starting a session.', '15', '6', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Recreate Session', 'SESSION_RECREATE', 'False', 'Recreate the session to generate a new session ID when the customer logs on or creates an account (PHP >=4.1 needed).', '15', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); osc_db_update_configuration_title('SHIPPING_ORIGIN_COUNTRY', 'Country of Origin'); osc_db_update_configuration_description('ACCOUNT_COMPANY', 'Display company in the customers account'); osc_db_update_configuration_description('ACCOUNT_DOB', 'Display date of birth in the customers account'); osc_db_update_configuration_description('ACCOUNT_GENDER', 'Display gender in the customers account'); osc_db_update_configuration_description('ACCOUNT_STATE', 'Display state in the customers account'); osc_db_update_configuration_description('ACCOUNT_SUBURB', 'Display suburb in the customers account'); osc_db_update_configuration_description('SHIPPING_ORIGIN_COUNTRY', 'Select the country of origin to be used in shipping quotes.'); ?>

The database upgrade procedure was successful!