Skip to content

Commit dbe1c39

Browse files
author
Kristan Kenney
committed
Merge branch 'main' into feature/user-roles
2 parents 2ff85da + 4f3c6fc commit dbe1c39

File tree

5 files changed

+110
-1
lines changed

5 files changed

+110
-1
lines changed

bin/v-restore-user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ if [ "$web" != 'no' ] && [ ! -z "$WEB_SYSTEM" ]; then
277277

278278
# Checking backend template
279279
check_backend_tpl=$(is_backend_template_valid $BACKEND)
280-
if [ ! -z "$check_proxy_tpl" ]; then
280+
if [ ! -z "$check_backend_tpl" ]; then
281281
BACKEND='default'
282282
fi
283283

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
}

install/deb/filemanager/filegator/configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
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' => [
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
namespace Hestia\WebApp\Installers\Nextcloud;
4+
5+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
6+
7+
class NextcloudSetup extends BaseSetup {
8+
9+
protected $appInfo = [
10+
'name' => 'Nextcloud',
11+
'group' => 'cloud',
12+
'enabled' => true,
13+
'version' => '21.0.0',
14+
'thumbnail' => 'nextcloud-thumb.png'
15+
];
16+
17+
protected $appname = 'nextcloud';
18+
19+
protected $config = [
20+
'form' => [
21+
'username' => ['value'=>'admin'],
22+
'password' => 'password'
23+
],
24+
'database' => true,
25+
'resources' => [
26+
'archive' => [ 'src' => 'https://download.nextcloud.com/server/releases/nextcloud-21.0.0.tar.bz2' ]
27+
],
28+
];
29+
30+
public function install(array $options = null) : bool
31+
{
32+
parent::install($options);
33+
34+
$this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
35+
36+
// install nextcloud
37+
$this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
38+
$this->getDocRoot('occ'),
39+
'maintenance:install',
40+
'--database mysql',
41+
'--database-name '.$this->appcontext->user() . '_' .$options['database_name'],
42+
'--database-user '.$this->appcontext->user() . '_' .$options['database_user'],
43+
'--database-pass '.$options['database_password'],
44+
'--admin-user '.$options['username'],
45+
'--admin-pass '.$options['password']
46+
], $status);
47+
48+
$this->appcontext->runUser('v-run-cli-cmd',
49+
['/usr/bin/php',
50+
$this->getDocRoot('occ'),
51+
'config:system:set',
52+
'trusted_domains 2 --value='.$this->domain
53+
], $status2);
54+
return ($status->code === 0 && $status2->code === 0);
55+
}
56+
}
29.4 KB
Loading

0 commit comments

Comments
 (0)