File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
install/deb/filemanager/filegator
backend/Services/Archiver/Adapters Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Filegator \Services \Archiver \Adapters ;
4+
5+ use Filegator \Container \Container ;
6+ use Filegator \Services \Archiver \ArchiverInterface ;
7+ use Filegator \Services \Service ;
8+ use Filegator \Services \Storage \Filesystem as Storage ;
9+ use Filegator \Services \Tmpfs \TmpfsInterface ;
10+
11+
12+ class HestiaZipArchiver extends ZipArchiver implements Service, ArchiverInterface
13+ {
14+ protected $ container ;
15+
16+ public function __construct (TmpfsInterface $ tmpfs , Container $ container )
17+ {
18+ $ this ->tmpfs = $ tmpfs ;
19+ $ this ->container = $ container ;
20+ }
21+
22+ public function uncompress (string $ source , string $ destination , Storage $ storage )
23+ {
24+
25+ $ auth = $ this ->container ->get ('Filegator\Services\Auth\AuthInterface ' );
26+
27+ $ v_user = basename ($ auth ->user ()->getUsername ());
28+
29+ if (!strlen ($ v_user )) {
30+ return ;
31+ }
32+
33+ if (strpos ($ source , '/home ' ) === false ) {
34+ $ source = "/home/ $ v_user/ " . $ source ;
35+ }
36+
37+ if (strpos ($ destination , '/home ' ) === false ) {
38+ $ destination = "/home/ $ v_user/ " . $ destination ;
39+ }
40+
41+ exec ("sudo /usr/local/hestia/bin/v-extract-fs-archive " .
42+ escapeshellarg ($ v_user ) . " " .
43+ escapeshellarg ($ source ) . " " .
44+ escapeshellarg ($ destination )
45+ ,$ output , $ return_var );
46+
47+ }
48+ }
Original file line number Diff line number Diff line change 4242 ]);
4343 };
4444
45+ $ dist_config ['services ' ]['Filegator\Services\Archiver\ArchiverInterface ' ] = [
46+ 'handler ' => '\Filegator\Services\Archiver\Adapters\HestiaZipArchiver ' ,
47+ 'config ' => [],
48+ ];
49+
4550$ dist_config ['services ' ]['Filegator\Services\Auth\AuthInterface ' ] = [
4651 'handler ' => '\Filegator\Services\Auth\Adapters\HestiaAuth ' ,
4752 'config ' => [
You can’t perform that action at this time.
0 commit comments