소스 검색

fix ssl issue & fix grav installer

fixes an issue where the install wouldn't work as expected when ssl was disabled
Sam 4 년 전
부모
커밋
84e604dcb8

+ 12 - 2
web/src/app/WebApp/Installers/DokuWiki/DokuWikiSetup.php

@@ -55,9 +55,18 @@ class DokuWikiSetup extends BaseSetup {
 	public function install(array $options = null)
 	{
 		parent::install($options);
+		
+		//check if ssl is enabled 
+        $this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status);
+		
+        if($status->code !== 0) {
+            throw new \Exception("Cannot list domain");
+        }
+        
+		$sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
 
-		$webDomain = "https://" . $this->domain . "/";
-
+		$webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
+		
 		$this->appcontext->runUser('v-copy-fs-directory',[
 			$this->getDocRoot($this->extractsubdir . "/dokuwiki-release_stable_2020-07-29/."),
 			$this->getDocRoot()], $result);
@@ -65,6 +74,7 @@ class DokuWikiSetup extends BaseSetup {
 		$installUrl = $webDomain . "install.php";
 
 		$cmd = "curl --request POST "
+		  . ($sslEnabled ? "" : "--insecure " )
 		  . "--url $installUrl "
 		  . "--header 'Content-Type: application/x-www-form-urlencoded' "
 		  . "--data l=en "

+ 3 - 1
web/src/app/WebApp/Installers/Grav/GravSetup.php

@@ -18,7 +18,9 @@ class GravSetup extends BaseSetup {
 	protected $appname = 'grav';
 	
 	protected $config = [
-		'form' => [],
+		'form' => [
+			"ignore this"=>"text",
+		],
 		'database' => false,
 		'resources' => [
 			'composer' => [ 'src' => 'getgrav/grav', 'dst' => '/']

+ 13 - 4
web/src/app/WebApp/Installers/MediaWiki/MediaWikiSetup.php

@@ -35,14 +35,21 @@ class MediaWikiSetup extends BaseSetup {
 	{
 		parent::install($options);
 
-		$webAddresss = "https://" . $this->domain;
+        //check if ssl is enabled 
+        $this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status);
+		
+        if($status->code !== 0) {
+            throw new \Exception("Cannot list domain");
+        }
+        
+		$sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
+		
+		$webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
 
 		$this->appcontext->runUser('v-copy-fs-directory',[
 			$this->getDocRoot($this->extractsubdir . "/mediawiki-1.36.1/."),
 			$this->getDocRoot()], $result);		
 
-		$this->cleanup();
-
 		$this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
 			$this->getDocRoot('maintenance/install.php'), 
 			'--dbserver=localhost',
@@ -58,7 +65,9 @@ class MediaWikiSetup extends BaseSetup {
 			"MediaWiki", // A Space here would trigger the next argument and preemptively set the admin username
 			$options['admin_username'],
 			], $status);
-
+			
+		$this->cleanup();
+		
 		return ($status->code === 0);
 	}
 }