commit 7e5e22291d851736ff330e033f2be04c51a1ab21
parent 63cf2d4dafc46f09164d228fbdcd41460111ae89
Author: markseu <mark2011@mayberg.se>
Date: Fri, 19 Nov 2021 14:41:42 +0100
Improved automatic update, thanks Steffen
Diffstat:
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -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.58
+Version: 0.8.59
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 22:03:08
+Published: 2021-11-19 14:35:39
Developer: Datenstrom
Tag: feature
system/extensions/update.php: update.php, create, update
diff --git a/system/extensions/update.php b/system/extensions/update.php
@@ -2,7 +2,7 @@
// Update extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/update
class YellowUpdate {
- const VERSION = "0.8.58";
+ const VERSION = "0.8.59";
const PRIORITY = "2";
public $yellow; // access to API
public $updates; // number of updates
@@ -69,10 +69,10 @@ class YellowUpdate {
}
}
}
- if ($action=="update") { // TODO: remove later, convert old content/layout files
- if ($this->yellow->system->isExisting("blogLocation") || $this->yellow->system->isExisting("wikiLocation")) {
+ if ($action=="update") { // TODO: remove later, convert files for blog/wiki extension
+ if ($this->yellow->system->isExisting("blogPagesMax") || $this->yellow->system->isExisting("wikiPagesMax")) {
$path = $this->yellow->system->get("coreContentDirectory");
- foreach ($this->yellow->toolbox->getDirectoryEntriesRecursive($path, "/^.*\.md$/", true, false) as $entry) {
+ foreach ($this->yellow->toolbox->getDirectoryEntriesRecursive($path, "/^.*\.(md|txt)$/", true, false) as $entry) {
$fileData = $fileDataNew = $this->yellow->toolbox->readFile($entry);
$fileDataNew = str_replace("[blogarchive", "[blogmonths", $fileDataNew);
$fileDataNew = preg_replace("/Layout: blogpages/i", "Layout: blog-start", $fileDataNew);
@@ -90,6 +90,10 @@ class YellowUpdate {
if ($fileData!=$fileDataNew && !$this->yellow->toolbox->createFile($entry, $fileDataNew)) {
$this->yellow->log("error", "Can't write file '$entry'!");
}
+ if(basename($entry)=="draftpages.html" &&
+ !$this->yellow->toolbox->deleteFile($entry, $this->yellow->system->get("coreTrashDirectory"))) {
+ $this->yellow->log("error", "Can't delete file '$entry'!");
+ }
}
}
}
@@ -107,14 +111,12 @@ class YellowUpdate {
}
if ($this->yellow->system->isExisting("blogLocation")) {
$blogStartLocation = $this->yellow->system->get("blogLocation");
- if (empty($blogStartLocation)) $blogStartLocation = "auto";
if (!$this->yellow->system->save($fileName, array("blogStartLocation" => $blogStartLocation))) {
$this->yellow->log("error", "Can't write file '$fileName'!");
}
}
if ($this->yellow->system->isExisting("wikiLocation")) {
$wikiStartLocation = $this->yellow->system->get("wikiLocation");
- if (empty($wikiStartLocation)) $wikiStartLocation = "auto";
if (!$this->yellow->system->save($fileName, array("wikiStartLocation" => $wikiStartLocation))) {
$this->yellow->log("error", "Can't write file '$fileName'!");
}