DatabasebackupLogDetailForm_Controller   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A download() 0 9 2
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