📄 header_php.php
字号:
<?php
/**
* @package Installer
* @access private
* @copyright Copyright 2003-2007 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: header_php.php 7115 2007-09-27 03:50:44Z drbyte $
*/
/*
* Database Upgrade script
* 1. Checks to be sure that the configure.php exists and can be read
* 2. Uses info from configure.php to connect to database
* 3. Queries database to determine whether settings unique to each upgrade level exist or not
* 4. Presents a list of upgrade steps to be completed (checkboxes)
* 5. If can connect to database, but cannot find the "configuration" table, only allows option to rename table prefixes
* 6. Requires admin password in order to do upgrade steps
* 7. Cycles through processing each upgrade SQL file in sequence, as selected.
* Won't process upgrades if prerequisites for prior step aren't already validated.
*
* @todo Optimize routine to check for database permissions at the MySQL "user" level.
* Needs: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP
* NEEDS TO WORK RELIABLY FOR BOTH well-configured and poorly-configured hosting configurations
*/
/////////////////////////////////////////////////////////////////////
//this is the latest database-version-level that this script knows how to inspect and upgrade to.
//it is used to determine whether to stay on the upgrade page when done, or continue to the finished page
$latest_version = '1.3.8';
///////////////////////////////////
$is_upgrade = true; //that's what this page is all about!
$failed_entries=0;
$configure_files_array = array('../includes/configure.php','../admin/includes/configure.php');
$database_tablenames_array=array('../includes/database_tables.php', '../includes/extra_datafiles/music_type_database_names.php');
define('DIR_WS_INCLUDES', '../includes/');
$zc_install->test_store_configure(ERROR_TEXT_STORE_CONFIGURE,ERROR_CODE_STORE_CONFIGURE);
if (ZC_UPG_DEBUG==true && $zc_install->fatal_error) echo 'FATAL ERROR-CONFIGURE FILE';
if (!$zc_install->fatal_error) {
if (ZC_UPG_DEBUG==true) echo 'configure.php file exists<br />';
@require_once(DIR_WS_INCLUDES . 'configure.php');
require(DIR_WS_INCLUDES . 'classes/db/' . DB_TYPE . '/query_factory.php');
//open database connection to run queries against it
$db_test = new queryFactory;
$db_test->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die("Unable to connect to database");
//check to see if a database_table_prefix has been defined. If not, set it to blank.
if (!defined('DB_PREFIX') || DB_PREFIX == 'DB_PREFIX' || "'".DB_PREFIX."'" == 'DB_PREFIX') {
define('DB_PREFIX','');
}
// Now check the database for what version it's at, if found
require('includes/classes/class.installer_version_manager.php');
$dbinfo = new versionManager;
$privs_array = explode('|||',zen_check_database_privs('','',true));
$db_priv_ok = $privs_array[0];
$zdb_privs_list = $privs_array[1];
$privs_found_text='';
if (ZC_UPG_DEBUG==true) echo 'privs_list_to_parse='.$db_priv_ok.'|||'.$zdb_privs_list;
foreach(array('ALL PRIVILEGES','SELECT','INSERT','UPDATE','DELETE','CREATE','ALTER','INDEX','DROP') as $value) {
if (in_array($value,explode(', ',$zdb_privs_list))) {
$privs_found_text .= $value .', ';
}
}
$zdb_privs=str_replace(', ',' ',$privs_found_text.' ');
if (!zen_not_null($zdb_privs)) $zdb_privs=$zdb_privs_list;
if ($zdb_privs_list == 'Not Checked') $zdb_privs = $zdb_privs_list;
// Finished querying database for configuration info
$db_test->Close();
// *** NOW DETERMINE REQUIRED UPDATES BASED ON TEST RESULTS
$sniffer_text = '';
//display options based on what was found -- THESE SHOULD BE PROCESSED IN REVERSE ORDER, NEWEST VERSION FIRST... !
//that way only the "earliest-required" upgrade is suggested first.
$needs_v1_3_8=false;
if (!$dbinfo->version138) {
$sniffer_text = ' upgrade v1.3.7 to v1.3.8';
$needs_v1_3_8=true;
}
$needs_v1_3_7=false;
if (!$dbinfo->version137) {
$sniffer_text = ' upgrade v1.3.6 to v1.3.7';
$needs_v1_3_7=true;
}
$needs_v1_3_6=false;
if (!$dbinfo->version136) {
$sniffer_text = ' upgrade v1.3.5 to v1.3.6';
$needs_v1_3_6=true;
}
$needs_v1_3_5=false;
if (!$dbinfo->version135) {
$sniffer_text = ' upgrade v1.3.0.2 to v1.3.5';
$needs_v1_3_5=true;
}
$needs_v1_3_0_2=false;
if (!$dbinfo->version1302) {
$sniffer_text = ' upgrade v1.3.0.1 to v1.3.0.2';
$needs_v1_3_0_2=true;
}
$needs_v1_3_0_1=false;
if (!$dbinfo->version1301) {
$sniffer_text = ' upgrade v1.3.0 to v1.3.0.1';
$needs_v1_3_0_1=true;
}
$needs_v1_3_0=false;
if (!$dbinfo->version130) {
$sniffer_text = ' upgrade v1.2.7 to v1.3.0';
$needs_v1_3_0=true;
}
$needs_v1_2_7=false;
if (!$dbinfo->version127) {
$sniffer_text = ' upgrade v1.2.6 to v1.2.7';
$needs_v1_2_7=true;
}
$needs_v1_2_6=false;
if (!$dbinfo->version126) {
$sniffer_text = ' upgrade v1.2.5 to v1.2.6';
$needs_v1_2_6=true;
}
$needs_v1_2_5=false;
if (!$dbinfo->version125) {
$sniffer_text = ' upgrade v1.2.4 to v1.2.5';
$needs_v1_2_5=true;
}
$needs_v1_2_4=false;
if (!$dbinfo->version124) {
$sniffer_text = ' upgrade v1.2.3 to v1.2.4';
$needs_v1_2_4=true;
}
$needs_v1_2_3=false;
if (!$dbinfo->version123) {
$sniffer_text = ' upgrade v1.2.2 to v1.2.3';
$needs_v1_2_3=true;
}
$needs_v1_2_2=false;
if (!$dbinfo->version122) {
$sniffer_text = ' upgrade v1.2.1 to v1.2.2';
$needs_v1_2_2=true;
}
$needs_v1_2_1=false;
if (!$dbinfo->version121) {
$sniffer_text = ' upgrade v1.2.0 to v1.2.1';
$needs_v1_2_1=true;
}
$needs_v1_2_0=false;
if (!$dbinfo->version120) {
$sniffer_text = ' upgrade v1.1.4 to v1.2.0';
$needs_v1_2_0=true;
}
$needs_v1_1_4_patch1=false;
if (!$dbinfo->version1141) {
$sniffer_text = ' upgrade v1.1.4 to v1.1.4_patch1';
$needs_v1_1_4_patch1=true;
}
$needs_v1_1_4=false;
if (!$dbinfo->version114) {
$sniffer_text = ' upgrade v1.1.2 or v1.1.3 to v1.1.4';
$needs_v1_1_4=true;
}
$needs_v1_1_2=false;
if (!$dbinfo->version112) {
$sniffer_text = ' upgrade v1.1.1 to v1.1.2';
$needs_v1_1_2=true;
}
$needs_v1_1_1=false;
if (!$dbinfo->version111) {
$sniffer_text = ' upgrade v1.1.0 to v1.1.1';
$needs_v1_1_1=true;
}
$needs_v1_1_0=false;
if (!$dbinfo->version110) {
$sniffer_text = ' upgrade v1.04 to v.1.1.1';
$needs_v1_1_0=true;
// $needs_v1_1_1=false; // exclude the 1.1.0-to-1.1.1 update since it's included in this step if selected
}
if (!isset($sniffer_text) || $sniffer_text == '') {
$sniffer_text = ' *** 鏃犻渶鍗囩骇 ***';
$sniffer_version = '';
}
} // end if zc_install_error == false ....... and database schema checks
if (ZC_UPG_DEBUG2==true) {
echo '<br>110='.$dbinfo->version110;
echo '<br>111='.$dbinfo->version111;
echo '<br>112='.$dbinfo->version112;
echo '<br>114='.$dbinfo->version114;
echo '<br>1_1_4_patch1='.$dbinfo->version1141;
echo '<br>120='.$dbinfo->version120;
echo '<br>121='.$dbinfo->version121;
echo '<br>122='.$dbinfo->version122;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -