|
| 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 | +} |
0 commit comments