Quellcode durchsuchen

renamed getUpdateMechanism function to updateOrganizr
added install type check to dockerUpdate, windowsUpdate and linuxUpdate functions

CauseFX vor 4 Jahren
Ursprung
Commit
0b63b5335d
1 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen
  1. 13 1
      api/functions/update-functions.php

+ 13 - 1
api/functions/update-functions.php

@@ -2,7 +2,7 @@
 
 trait UpdateFunctions
 {
-	public function getUpdateMechanism()
+	public function updateOrganizr()
 	{
 		if ($this->docker) {
 			return $this->dockerUpdate();
@@ -15,6 +15,10 @@ trait UpdateFunctions
 	
 	public function dockerUpdate()
 	{
+		if (!$this->docker) {
+			$this->setResponse(409, 'Your install type is not Docker');
+			return false;
+		}
 		$dockerUpdate = null;
 		ini_set('max_execution_time', 0);
 		set_time_limit(0);
@@ -36,6 +40,10 @@ trait UpdateFunctions
 	
 	public function windowsUpdate()
 	{
+		if ($this->docker || $this->getOS() !== 'win') {
+			$this->setResponse(409, 'Your install type is not Windows');
+			return false;
+		}
 		$branch = ($this->config['branch'] == 'v2-master') ? '-m' : '-d';
 		ini_set('max_execution_time', 0);
 		set_time_limit(0);
@@ -53,6 +61,10 @@ trait UpdateFunctions
 	
 	public function linuxUpdate()
 	{
+		if ($this->docker || $this->getOS() == 'win') {
+			$this->setResponse(409, 'Your install type is not Linux');
+			return false;
+		}
 		$branch = $this->config['branch'] == 'v2-master';
 		ini_set('max_execution_time', 0);
 		set_time_limit(0);