~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to admin/delete.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP //$Id: delete.php,v 1.12 2006/09/25 20:22:56 skodak Exp $
 
1
<?PHP //$Id: delete.php,v 1.13.4.2 2008/05/02 04:07:27 dongsheng Exp $
2
2
 
3
3
// Deletes the moodledata directory, COMPLETELY!!
4
4
// BE VERY CAREFUL USING THIS!
5
5
 
6
6
    require_once('../config.php');
7
7
    require_once($CFG->libdir.'/adminlib.php');
8
 
    $adminroot = admin_get_root();
9
 
    admin_externalpage_setup('purgemoodledata', $adminroot);
 
8
 
 
9
    admin_externalpage_setup('purgemoodledata');
10
10
 
11
11
    require_login();
12
12
 
13
13
    $sure       = optional_param('sure', 0, PARAM_BOOL);
14
14
    $reallysure = optional_param('reallysure', 0, PARAM_BOOL);
15
15
 
16
 
    require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
 
16
    require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
17
17
 
18
18
    $deletedir = $CFG->dataroot;   // The directory to delete!
19
19
 
20
 
    admin_externalpage_print_header($adminroot);
 
20
    admin_externalpage_print_header();
21
21
    print_heading('Purge moodledata');
22
22
 
23
23
    if (empty($sure)) {
24
24
        $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());
25
25
        notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?',
26
26
            'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
27
 
        admin_externalpage_print_footer($adminroot);
 
27
        admin_externalpage_print_footer();
28
28
        exit;
29
29
    }
30
30
 
32
32
        $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
33
33
        notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?',
34
34
            'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
35
 
        admin_externalpage_print_footer($adminroot);
 
35
        admin_externalpage_print_footer();
36
36
        exit;
37
37
    }
38
38
 
46
46
 
47
47
    echo '<h1 align="center">Done!</h1>';
48
48
    print_continue($CFG->wwwroot);
49
 
    admin_externalpage_print_footer($adminroot);
 
49
    admin_externalpage_print_footer();
50
50
    exit;
51
51
 
52
52
 
54
54
 
55
55
    $dir = opendir($rootdir);
56
56
 
57
 
    while ($file = readdir($dir)) {
 
57
    while (false !== ($file = readdir($dir))) {
58
58
        if ($file != '.' and $file != '..') {
59
59
            $fullfile = $rootdir .'/'. $file;
60
60
            if (filetype($fullfile) == 'dir') {