Project

General

Profile

« Previous | Next » 

Revision 719

Added by doc over 16 years ago

modified upgrade script and suppressed headers already send message (avoid issues with error reporting E_ALL)

View differences:

upgrade-script.php
35 35
function check_baseline_configuration() {
36 36
	// check if config.php file exists and contains values
37 37
	status_msg('config.php: ');
38
	@include('config.php');
38
	@include_once('config.php');
39 39
	if(defined('WB_PATH')) {
40 40
		status_msg('OK', 'ok');
41 41
	} else {
......
50 50

  
51 51
	// check if the WB 2.7 installation files were already uploaded via FTP
52 52
	status_msg(', WB 2.7 core files uploaded: ');
53
	@include(WB_PATH .'/framework/functions.php');
54
	@include(WB_PATH .'/admin/interface/version.php');
53
	@include_once(WB_PATH .'/framework/functions.php');
54
	@include_once(WB_PATH .'/admin/interface/version.php');
55 55
	if(defined('VERSION') && VERSION == '2.7'
56 56
		&& function_exists('get_variable_content') 
57 57
		&& file_exists(WB_PATH .'/modules/menu_link/languages/DE.php') 
......
71 71
		return -1;
72 72
	}
73 73

  
74
	// check database connection
75
	$wb_version = '';
74
	// check database connection (try to extract a single value which should always exist)
75
	$group_id = '';
76 76
	status_msg(', Database connection: ');
77 77
	if(class_exists('database')) {
78 78
		$db = new database;
79
		$table = TABLE_PREFIX .'settings';
80
		$wb_version = @$db->get_one("SELECT value FROM $table WHERE name = 'wb_version' LIMIT 1");
79
		$table = TABLE_PREFIX .'groups';
80
		$group_id = @$db->get_one("SELECT group_id FROM $table WHERE group_id = '1' LIMIT 1");
81 81
	}
82
	if($wb_version) {
82
	if($group_id == '1') {
83 83
		status_msg('OK', 'ok');
84 84
	} else {
85 85
		// output error message and return error status
86 86
		status_msg('FAILED', 'error');
87
		status_msg('<strong>Error:</strong><br />Unable to obtain the WB version stored in the database of your existing installation.'
87
		status_msg('<strong>Error:</strong><br />Unable to connect to your existing Website Baker database.'
88 88
			.'<br />Make sure that the database class is available and the connection data in the config.php file is correct '
89
			.'and your database is not corrupted.<br />To check if your database is corrupted, you can use a tool like '
89
			.'and your database is not corrupt.<br />To check if your database is corrupt, you can use a tool like '
90 90
			.'<a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a>.'
91 91
			.'<br /><br />You can not proceed before this error is fixed!!!'
92 92
			, 'warning', 'div');
93 93
		return -1;
94 94
	}
95

  
96
	// check WB version in database is 2.6.7
97
	status_msg(', WB version (database): ');
98
	if($wb_version == '2.6.7') {
99
		status_msg('2.6.7 (OK)', 'ok');
100
	} else {
101
		// output a warning
102
		status_msg($wb_version .' (required 2.6.7)', 'error');
103
		status_msg('<strong>Warning:</strong><br />The extracted version number from the database is ' .$wb_version .' (required 2.6.7).'
104
			.'<br />If the extracted database version is lower than 2.6.7, please upgrade first to Website Baker 2.6.7 and then to 2.7.'
105
			.'<br />If the obtained database version is higher or equal to 2.7, you do not need to execute this script.'
106
			.'<br /><br />You can not proceed before this error is fixed!!!'
107
			, 'warning', 'div');
108
		return -1;
109
	}
110 95
	return 0;
111 96
}
112 97

  
......
116 101
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
117 102
<head>
118 103
<title>Upgrade script from Website Baker v2.6.7 to Website Baker v2.7</title>
119

  
104
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
120 105
<style type="text/css">
121 106
body {
122 107
	margin:0;
......
209 194
/**
210 195
	THE WEBSITE BAKER UPGRADE SCRIPT STARTS HERE
211 196
**/
212
require('config.php');
213
require(WB_PATH.'/framework/functions.php');
197
require_once('config.php');
198
require_once(WB_PATH.'/framework/functions.php');
214 199
?>
215 200
<h2>Step 3: Upgrading the existing Website Baker installation to WB 2.7</h2>
216 201
<p>will upgrade Website Baker 2.6.5 / 2.6.7 to version 2.7</p>

Also available in: Unified diff