Explorar el Código

System update (for Steffen)

markseu hace 8 años
padre
commit
2feb89ce9e
Se han modificado 1 ficheros con 19 adiciones y 19 borrados
  1. 19 19
      system/plugins/update.php

+ 19 - 19
system/plugins/update.php

@@ -31,8 +31,7 @@ class YellowUpdate
 			$fileData = preg_replace("#yellow->plugins->load\(\)#", "yellow->load()", $fileData);
 			$this->yellow->toolbox->createFile("yellow.php", $fileData);
 		}
-		
-		if($update) //TODO: remove later, converts old config file
+		if($update) //TODO: remove later, converts old config
 		{
 			$fileNameConfig = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile");
 			$fileData = $this->yellow->toolbox->readFile($fileNameConfig);
@@ -40,7 +39,8 @@ class YellowUpdate
 			{
 				$line = preg_replace("/^Webinterface/i", "Edit", $line);
 				preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches);
-				if(!empty($matches[1]) && is_null($this->yellow->config->configDefaults[$matches[1]]))
+				if(substru($matches[1], 0, 4)=="Edit" && !strempty($matches[2])) $this->yellow->config->set($matches[1], $matches[2]);
+				if(!empty($matches[1]) && $matches[1][0]!='#' && is_null($this->yellow->config->configDefaults[$matches[1]]))
 				{
 					$fileDataNew .= "# $line";
 				} else {
@@ -49,6 +49,22 @@ class YellowUpdate
 			}
 			if($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileNameConfig, $fileDataNew);
 		}
+		if($update)	//TODO: remove later, converts old theme
+		{
+			$path = $this->yellow->config->get("themeDir");
+			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.css$/", true, false) as $entry)
+			{
+				$fileNameAsset = $this->yellow->config->get("assetDir").basename($entry);
+				if(!is_file($fileNameAsset))
+				{
+					$fileData = $this->yellow->toolbox->readFile($entry);
+					$fileData = preg_replace("#url\(assets/(.*?)\)#", "url($1)", $fileData);
+					$this->yellow->toolbox->createFile($fileNameAsset, $fileData);
+				}
+				$this->yellow->toolbox->deleteFile($entry, $this->yellow->config->get("trashDir"));
+				$_GET["clean-url"] = "theme-has-been-updated";
+			}
+		}
 		if($update)	//TODO: remove later, converts old error page
 		{
 			$fileName = $this->yellow->config->get("configDir")."page-error-500.txt";
@@ -106,22 +122,6 @@ class YellowUpdate
 			}
 			$this->yellow->pages = new YellowPages($this->yellow);
 		}
-		if($update)	//TODO: remove later, converts theme files
-		{
-			$path = $this->yellow->config->get("themeDir");
-			foreach($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.css$/", true, false) as $entry)
-			{
-				$fileNameAsset = $this->yellow->config->get("assetDir").basename($entry);
-				if(!is_file($fileNameAsset))
-				{
-					$fileData = $this->yellow->toolbox->readFile($entry);
-					$fileData = preg_replace("#url\(assets/(.*?)\)#", "url($1)", $fileData);
-					$this->yellow->toolbox->createFile($fileNameAsset, $fileData);
-				}
-				$this->yellow->toolbox->deleteFile($entry, $this->yellow->config->get("trashDir"));
-				$_GET["clean-url"] = "software-has-been-updated";
-			}
-		}
 	}
 	
 	// Handle request