mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit 2feb89ce9ecb67bf867a7bc7125a551ebf335fcf
parent 577cc3000e0699e1bc0add22e864315878f47654
Author: markseu <mark2011@mayberg.se>
Date:   Tue, 20 Jun 2017 00:38:21 +0200

System update (for Steffen)

Diffstat:
Msystem/plugins/update.php | 38+++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/system/plugins/update.php b/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