commit b09c677b63b2a064a662c364b88aee1007204faa
parent 6f2990bbd44e75d4477cc95b921564bdb7050b0c
Author: markseu <mark2011@mayberg.se>
Date: Fri, 11 Jan 2019 13:28:35 +0100
improved static build for additional files and folders
Diffstat:
5 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/system/config/robots.txt b/robots.txt
diff --git a/system/config/config.ini b/system/config/config.ini
@@ -41,8 +41,6 @@ TextFile: text.ini
ErrorFile: page-error-(.*).md
NewFile: page-new-(.*).md
LanguageFile: language-(.*).txt
-RobotsFile: robots.txt
-FaviconFile: favicon.ico
ServerUrl:
StartupUpdate: none
Template: default
diff --git a/system/plugins/command.php b/system/plugins/command.php
@@ -1,10 +1,10 @@
<?php
// Command plugin, https://github.com/datenstrom/yellow-plugins/tree/master/command
-// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se
+// Copyright (c) 2013-2019 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowCommand {
- const VERSION = "0.7.11";
+ const VERSION = "0.7.12";
public $yellow; //access to API
public $files; //number of files
public $links; //number of links
@@ -107,6 +107,9 @@ class YellowCommand {
foreach ($this->getSystemLocations() as $location) {
$statusCode = max($statusCode, $this->buildStaticFile($path, $location));
}
+ foreach ($this->getExtraLocations() as $location) {
+ $statusCode = max($statusCode, $this->buildStaticFile($path, $location));
+ }
$statusCode = max($statusCode, $this->buildStaticFile($path, "/error/", false, false, true));
}
return $statusCode;
@@ -532,7 +535,23 @@ class YellowCommand {
foreach ($fileNames as $fileName) {
array_push($locations, $this->yellow->config->get("themeLocation").substru($fileName, $themeDirLength));
}
- array_push($locations, "/".$this->yellow->config->get("robotsFile"));
+ return $locations;
+ }
+
+ // Return extra locations
+ public function getExtraLocations() {
+ $locations = array();
+ $pathIgnore = "(".$this->yellow->config->get("staticDir")."|".
+ $this->yellow->config->get("cacheDir")."|".
+ $this->yellow->config->get("contentDir")."|".
+ $this->yellow->config->get("mediaDir")."|".
+ $this->yellow->config->get("systemDir").")";
+ $fileNames = $this->yellow->toolbox->getDirectoryEntriesRecursive(".", "/.*/", false, false);
+ foreach ($fileNames as $fileName) {
+ $fileName = substru($fileName, 2);
+ if (preg_match("#^$pathIgnore#", $fileName) || $fileName=="yellow.php") continue;
+ array_push($locations, "/".$fileName);
+ }
return $locations;
}
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -1,6 +1,6 @@
<?php
// Core plugin, https://github.com/datenstrom/yellow-plugins/tree/master/core
-// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se
+// Copyright (c) 2013-2019 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowCore {
@@ -66,8 +66,6 @@ class YellowCore {
$this->config->setDefault("errorFile", "page-error-(.*).md");
$this->config->setDefault("newFile", "page-new-(.*).md");
$this->config->setDefault("languageFile", "language-(.*).txt");
- $this->config->setDefault("robotsFile", "robots.txt");
- $this->config->setDefault("faviconFile", "favicon.ico");
$this->config->setDefault("serverUrl", "");
$this->config->setDefault("startupUpdate", "none");
$this->config->setDefault("template", "default");
@@ -2117,10 +2115,6 @@ class YellowLookup {
$fileName = $this->yellow->config->get("pluginDir").substru($location, $pluginLocationLength);
} elseif (substru($location, 0, $themeLocationLength)==$this->yellow->config->get("themeLocation")) {
$fileName = $this->yellow->config->get("themeDir").substru($location, $themeLocationLength);
- } elseif ($location=="/".$this->yellow->config->get("robotsFile")) {
- $fileName = $this->yellow->config->get("configDir").$this->yellow->config->get("robotsFile");
- } elseif ($location=="/".$this->yellow->config->get("faviconFile")) {
- $fileName = $this->yellow->config->get("assetDir").$this->yellow->config->get("siteicon").".png";
}
}
return $fileName;
diff --git a/system/plugins/update.php b/system/plugins/update.php
@@ -1,10 +1,10 @@
<?php
// Update plugin, https://github.com/datenstrom/yellow-plugins/tree/master/update
-// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se
+// Copyright (c) 2013-2019 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowUpdate {
- const VERSION = "0.7.23";
+ const VERSION = "0.7.24";
const PRIORITY = "2";
public $yellow; //access to API
public $updates; //number of updates
@@ -30,6 +30,18 @@ class YellowUpdate {
$this->yellow->config->save($fileNameConfig, array("staticDir" => "public/"));
}
}
+ if (true) { //TODO: remove later, converts old robots file
+ $fileNameRobots = $this->yellow->config->get("configDir")."robots.txt";
+ $fileNameError = $this->yellow->config->get("configDir")."system-error.log";
+ if (is_file($fileNameRobots)) {
+ if (!$this->yellow->toolbox->renameFile($fileNameRobots, "./robots.txt")) {
+ $fileDataError .= "ERROR renaming file '$fileNameRobots'!\n";
+ }
+ if (!empty($fileDataError)) {
+ $this->yellow->toolbox->createFile($fileNameError, $fileDataError);
+ }
+ }
+ }
if ($update) { //TODO: remove later, converts old Markdown extension
$fileNameConfig = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile");
$fileNameError = $this->yellow->config->get("configDir")."system-error.log";
@@ -45,7 +57,6 @@ class YellowUpdate {
}
$path = $this->yellow->config->get("configDir");
foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.txt$/", true, false) as $entry) {
- if (basename($entry) == $this->yellow->config->get("robotsFile")) continue;
if (!$this->yellow->toolbox->renameFile($entry, str_replace(".txt", ".md", $entry))) {
$fileDataError .= "ERROR renaming file '$entry!'\n";
}