made a copy
[atutor.git] / install / upgrade.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg, Heidi Hazelton */
6 /* http://atutor.ca                                                                                                             */
7 /*                                                                                                                                              */
8 /* This program is free software. You can redistribute it and/or                */
9 /* modify it under the terms of the GNU General Public License                  */
10 /* as published by the Free Software Foundation.                                                */
11 /************************************************************************/
12 // $Id$
13
14 define('AT_INCLUDE_PATH', '../include/');
15
16 if (isset($_POST['new_version'])) {
17         $new_version = $_POST['new_version'];
18 }
19
20 if (isset($_POST['step'])) {
21         $step = intval($_POST['step']);
22 }
23
24 if (!isset($step) || ($step == 0)) {
25         $step = 1;
26 }
27
28 require('include/common.inc.php');
29
30 if (($step == 2) && isset($_POST['override']) && ($_POST['override'] == 0)) {
31         header('Location: index.php');
32         exit;
33 }
34 session_start();
35 require('include/upgrade_header.php');
36
37 if ($step == 1) {
38         if (!$new_version) {
39                 echo 'You cannot access this page directly. <a href="index.php">Upgrade from here</a> using the <em>Upgrade</em> button.';
40                 require('include/footer.php');
41                 exit;
42         }
43         // in:  select directory
44         // out: confirm verions
45         require('include/ustep1.php');
46 }
47 if ($step == 2) {
48         // in:  update database
49         // out: -
50         require('include/ustep2.php');
51 }
52 if ($step == 3) {
53         // in:  database info
54         // out: convert database from <encoding> to UTF-8
55         require('include/ustep7.php');
56 }
57 if ($step == 4) {
58         // in:  display version specific notices
59         // out: update database with new options
60         require('include/ustep3.php');
61 }
62 if ($step == 5) {
63         // in:  determine where the old content dir is and if it has to be copied
64         // out: try to create the directory and set permissions
65         require('include/step5.php');
66 }
67 if ($step == 6) {
68         // in:  copy the content if needed
69         // out: -
70         require('include/ustep4.php');
71 }
72 if ($step == 7) {
73         // in:  copy the config file
74         // out: -
75         require('include/ustep5.php');
76 }
77 /* anonymous data collection */
78 if ($step == 8) {       
79         require('include/step7.php');
80 }
81
82 if ($step == 9) {
83         require('include/ustep6.php');
84 }
85 require('include/footer.php');
86 ?>