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