File: restore_execute.html

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (60 lines) | stat: -rw-r--r-- 2,126 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php //$Id: restore_execute.html,v 1.56.2.1 2006/06/03 20:16:19 stronk7 Exp $
    //This page receives the required info and executes the restore
    //with the parameters suplied. Whe finished, delete temporary
    //data from backup_tables and temp directory

    //Get objects from session
    if ($SESSION) {
        $info = $SESSION->info;
        $course_header = $SESSION->course_header;
        $restore = $SESSION->restore;
    }

    //Add info->original_wwwroot to $restore to be able to use it in all the restore process
    //(mainly when decoding internal links)
    $restore->original_wwwroot = $info->original_wwwroot;
    //Add info->backup_version to $restore to be able to detect versions in the restore process
    //(to decide when to convert wiki texts to markdown...)
    $restore->backup_version = $info->backup_backup_version;

    //Check login
    require_login();

    //Check admin
    if (!empty($id)) {
        if (!isteacheredit($id)) {
            if (empty($to)) {
                error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
            } else {
                if (!isteacheredit($to)) {
                    error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
                }
            }
        }
    } else {
        if (!isadmin()) {
            error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
        }
    }

    //Check site
    if (!$site = get_site()) {
        error("Site not found!");
    }
    $errorstr = '';
    $status = restore_execute($restore,$info,$course_header,$errorstr);

    if (!$status) {
        error ("An error has occurred and the restore could not be completed!");
    }

    if (empty($restore->importing)) {
        //Print final message
        print_simple_box(get_string("restorefinished"),"center");
    } else {
        print_simple_box(get_string("importdatafinished"),"center");
        unset($SESSION->restore);
    }
    print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id);

?>