DatabasebackupLogDetailForm_Controller::download()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
class DatabasebackupLogDetailForm_Controller extends Controller
4
{
5
    private static $allowed_actions = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
6
        "download" => 'ADMIN'
7
    );
8
9
    public function download($request)
10
    {
11
        $id = intval($request->param("ID"));
12
        if ($id) {
13
            $obj = DatabasebackupLog::get()->byID($id);
14
            return SS_HTTPRequest::send_file(file_get_contents($obj->FullLocation), basename($obj->FullLocation));
15
        }
16
        user_error("Could not action download", E_USER_WARNING);
17
    }
18
}
19