Prechádzať zdrojové kódy

System update (detect file system)

markseu 9 rokov pred
rodič
commit
f07c724591
1 zmenil súbory, kde vykonal 33 pridanie a 32 odobranie
  1. 33 32
      system/plugins/core.php

+ 33 - 32
system/plugins/core.php

@@ -2009,12 +2009,44 @@ class YellowLookup
 	// Load file system information
 	// Load file system information
 	function load()
 	function load()
 	{
 	{
-		list($pathRoot, $pathHome) = $this->getContentInformation();
+		list($pathRoot, $pathHome) = $this->detectFileSystem();
 		$this->yellow->config->set("contentRootDir", $pathRoot);
 		$this->yellow->config->set("contentRootDir", $pathRoot);
 		$this->yellow->config->set("contentHomeDir", $pathHome);
 		$this->yellow->config->set("contentHomeDir", $pathHome);
 		date_default_timezone_set($this->yellow->config->get("serverTime"));
 		date_default_timezone_set($this->yellow->config->get("serverTime"));
 	}
 	}
 	
 	
+	// Detect file system
+	function detectFileSystem()
+	{
+		$path = $this->yellow->config->get("contentDir");
+		$pathRoot = $this->yellow->config->get("contentRootDir");
+		$pathHome = $this->yellow->config->get("contentHomeDir");
+		if(!$this->yellow->config->get("multiLanguageMode")) $pathRoot = "";
+		if(!empty($pathRoot))
+		{
+			$token = $root = rtrim($pathRoot, '/');
+			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
+			{
+				if(empty($firstRoot)) { $firstRoot = $token = $entry; }
+				if($this->normaliseName($entry) == $root) { $token = $entry; break; }
+			}
+			$pathRoot = $this->normaliseName($token)."/";
+			$path .= "$firstRoot/";
+		}
+		if(!empty($pathHome))
+		{
+			$token = $home = rtrim($pathHome, '/');
+			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
+			{
+				if(empty($firstHome)) { $firstHome = $token = $entry; }
+				if($this->normaliseName($entry) == $home) { $token = $entry; break; }
+			}
+			$pathHome = $this->normaliseName($token)."/";
+			if(count($this->yellow->toolbox->getDirectoryEntries($path.$token, "/.*/", true, true, false))) $invalid = true;
+		}
+		return array($pathRoot, $invalid ? "invalid" : $pathHome);
+	}
+	
 	// Return root locations
 	// Return root locations
 	function findRootLocations($includePath = true)
 	function findRootLocations($includePath = true)
 	{
 	{
@@ -2305,37 +2337,6 @@ class YellowLookup
 		return $url;
 		return $url;
 	}
 	}
 	
 	
-	// Return content information
-	function getContentInformation()
-	{
-		$path = $this->yellow->config->get("contentDir");
-		$pathRoot = $this->yellow->config->get("contentRootDir");
-		$pathHome = $this->yellow->config->get("contentHomeDir");
-		if(!$this->yellow->config->get("multiLanguageMode")) $pathRoot = "";
-		if(!empty($pathRoot))
-		{
-			$token = $root = rtrim($pathRoot, '/');
-			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
-			{
-				if(empty($firstRoot)) { $firstRoot = $token = $entry; }
-				if($this->normaliseName($entry) == $root) { $token = $entry; break; }
-			}
-			$pathRoot = $this->normaliseName($token)."/";
-			$path .= "$firstRoot/";
-		}
-		if(!empty($pathHome))
-		{
-			$token = $home = rtrim($pathHome, '/');
-			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
-			{
-				if(empty($firstHome)) { $firstHome = $token = $entry; }
-				if($this->normaliseName($entry) == $home) { $token = $entry; break; }
-			}
-			$pathHome = $this->normaliseName($token)."/";
-		}
-		return array($pathRoot, $pathHome);
-	}
-
 	// Return directory location
 	// Return directory location
 	function getDirectoryLocation($location)
 	function getDirectoryLocation($location)
 	{
 	{