@@ -4,19 +4,28 @@ class Restic
4
4
public $ validTypes = Array ("data " , "index " , "keys " , "locks " , "snapshots " , "config " );
5
5
public $ mimeTypeAPIV1 = "application/vnd.x.restic.rest.v1 " ;
6
6
public $ mimeTypeAPIV2 = "application/vnd.x.restic.rest.v2 " ;
7
- protected $ block_size = 8192 ;
7
+ private $ block_size = 8192 ;
8
+ private $ basePath = "restic " ;
9
+ public $ private_repos = false ;
8
10
9
- protected $ basePath ;
10
11
11
- private function __construct ($ path = " . " )
12
+ private function __construct ($ opts )
12
13
{
13
- $ this ->basePath = $ path ;
14
+ if (isset ($ opts ["path " ])) {
15
+ $ this ->basePath = $ opts ["path " ];
16
+ }
17
+ if (isset ($ opts ["private_repos " ])) {
18
+ $ this ->private_repos = $ opts ["private_repos " ];
19
+ }
20
+ if (isset ($ opts ["block_size " ])) {
21
+ $ this ->block_size = $ opts ["block_size " ];
22
+ }
14
23
}
15
- public static function Instance ($ path = " . " )
24
+ public static function Instance ($ opts = Array () )
16
25
{
17
26
static $ inst = null ;
18
27
if ($ inst === null ) {
19
- $ inst = new Restic ($ path );
28
+ $ inst = new Restic ($ opts );
20
29
}
21
30
return $ inst ;
22
31
}
@@ -29,6 +38,9 @@ public function sendStatus($status)
29
38
case 400 :
30
39
header ($ _SERVER ["SERVER_PROTOCOL " ] . " 400 Bad Request " );
31
40
break ;
41
+ case 401 :
42
+ header ($ _SERVER ["SERVER_PROTOCOL " ] . " 401 Unauthorized " );
43
+ break ;
32
44
case 403 :
33
45
header ($ _SERVER ["SERVER_PROTOCOL " ] . " 403 Forbidden " );
34
46
break ;
0 commit comments