System update (for Steffen)
This commit is contained in:
parent
577cc3000e
commit
2feb89ce9e
1 changed files with 19 additions and 19 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue