Update blog/wiki layout handling

This commit is contained in:
markseu 2021-11-18 22:15:09 +01:00
parent a0d03dcd7c
commit 63cf2d4daf
3 changed files with 13 additions and 4 deletions

Binary file not shown.

View file

@ -129,11 +129,11 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea
system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful
Extension: Update
Version: 0.8.57
Version: 0.8.58
Description: Keep your website up to date.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/update
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/update.zip
Published: 2021-11-18 19:47:05
Published: 2021-11-18 22:03:08
Developer: Datenstrom
Tag: feature
system/extensions/update.php: update.php, create, update

View file

@ -2,7 +2,7 @@
// Update extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/update
class YellowUpdate {
const VERSION = "0.8.57";
const VERSION = "0.8.58";
const PRIORITY = "2";
public $yellow; // access to API
public $updates; // number of updates
@ -69,7 +69,7 @@ class YellowUpdate {
}
}
}
if ($action=="update") { // TODO: remove later, convert old content files
if ($action=="update") { // TODO: remove later, convert old content/layout files
if ($this->yellow->system->isExisting("blogLocation") || $this->yellow->system->isExisting("wikiLocation")) {
$path = $this->yellow->system->get("coreContentDirectory");
foreach ($this->yellow->toolbox->getDirectoryEntriesRecursive($path, "/^.*\.md$/", true, false) as $entry) {
@ -82,6 +82,15 @@ class YellowUpdate {
$this->yellow->log("error", "Can't write file '$entry'!");
}
}
$path = $this->yellow->system->get("coreLayoutDirectory");
foreach ($this->yellow->toolbox->getDirectoryEntriesRecursive($path, "/^.*\.html$/", true, false) as $entry) {
$fileData = $fileDataNew = $this->yellow->toolbox->readFile($entry);
$fileDataNew = str_replace("yellow->page->getPage(\"blog\")", "yellow->page->getPage(\"blogStart\")", $fileDataNew);
$fileDataNew = str_replace("yellow->page->getPage(\"wiki\")", "yellow->page->getPage(\"wikiStart\")", $fileDataNew);
if ($fileData!=$fileDataNew && !$this->yellow->toolbox->createFile($entry, $fileDataNew)) {
$this->yellow->log("error", "Can't write file '$entry'!");
}
}
}
}
if ($action=="update") { // TODO: remove later, convert old extension settings