commit 435050113bc9db255b357f137dabc3726fea957b
parent c838ff69cdf37b9827ff763a31b7f592c849a58a
Author: markseu <mark2011@mayberg.se>
Date: Sun, 20 Mar 2022 21:34:45 +0100
Updated installation instructions, Murphy's law
Diffstat:
3 files changed, 30 insertions(+), 40 deletions(-)
diff --git a/system/extensions/install.php b/system/extensions/install.php
@@ -2,7 +2,7 @@
// Install extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/install
class YellowInstall {
- const VERSION = "0.8.65";
+ const VERSION = "0.8.66";
const PRIORITY = "1";
public $yellow; // access to API
@@ -66,14 +66,24 @@ class YellowInstall {
// Process command to install website
public function processCommandInstall($command, $text) {
+ $statusCode = 0;
if ($this->yellow->system->get("updateCurrentRelease")=="none") {
$this->checkCommandRequirements();
- $statusCode = $this->updateLog();
- if ($command=="build" || $command=="clean") {
+ if (empty($command)) {
+ $statusCode = 304;
+ echo "Datenstrom Yellow is for people who make small websites. https://datenstrom.se/yellow/\n";
+ echo "Syntax: php yellow.php\n";
+ echo " php yellow.php about\n";
+ echo " php yellow.php build [directory location]\n";
+ echo " php yellow.php serve [url]\n";
+ } elseif ($command=="build") {
+ $statusCode = $this->updateLog();
if ($statusCode==200) $statusCode = $this->updateLanguages();
if ($statusCode==200) $statusCode = $this->updateSettings();
if ($statusCode==200) $statusCode = $this->removeInstall();
- } elseif ($command!="serve") {
+ } elseif ($command=="serve" || $command=="about") {
+ $statusCode = 200;
+ } else {
$statusCode = 304;
echo "The installation has not been completed. Please type 'php yellow.php serve'\n";
}
diff --git a/system/extensions/serve.php b/system/extensions/serve.php
@@ -2,7 +2,7 @@
// Serve extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/serve
class YellowServe {
- const VERSION = "0.8.17";
+ const VERSION = "0.8.18";
public $yellow; // access to API
// Handle initialisation
@@ -21,34 +21,24 @@ class YellowServe {
// Handle command help
public function onCommandHelp() {
- return "serve [directory url]\n";
+ return "serve [url]\n";
}
// Process command to start built-in web server
public function processCommandServe($command, $text) {
- list($path, $url) = $this->yellow->toolbox->getTextArguments($text);
+ list($url) = $this->yellow->toolbox->getTextArguments($text);
if (empty($url)) $url = "http://localhost:8000";
list($scheme, $address, $base) = $this->yellow->lookup->getUrlInformation($url);
if ($scheme=="http" && !empty($address)) {
- if ($this->checkDynamicSettings($path, $url)) {
- if (!preg_match("/\:\d+$/", $address)) $address .= ":8000";
- echo "Starting built-in web server. Open a web browser and go to $scheme://$address/\n";
- echo "Press Ctrl+C to quit...\n";
- if ($this->isDynamicPath($path)) {
- exec("php -S $address yellow.php 2>&1", $outputLines, $returnStatus);
- } else {
- exec("php -S $address -t $path 2>&1", $outputLines, $returnStatus);
- }
- $statusCode = $returnStatus!=0 ? 500 : 200;
- if ($statusCode!=200) {
- $output = !empty($outputLines) ? end($outputLines) : "Please check arguments!";
- if (preg_match("/^\[(.*?)\]\s*(.*)$/", $output, $matches)) $output = $matches[2];
- echo "ERROR starting web server: $output\n";
- }
- } else {
- $statusCode = 400;
- $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreSystemFile");
- echo "ERROR starting web server: Please configure `CoreServerUrl: auto` in file '$fileName'!\n";
+ if (!preg_match("/\:\d+$/", $address)) $address .= ":8000";
+ echo "Starting built-in web server. Open a web browser and go to $scheme://$address/\n";
+ echo "Press Ctrl+C to quit...\n";
+ exec("php -S $address yellow.php 2>&1", $outputLines, $returnStatus);
+ $statusCode = $returnStatus!=0 ? 500 : 200;
+ if ($statusCode!=200) {
+ $output = !empty($outputLines) ? end($outputLines) : "Please check arguments!";
+ if (preg_match("/^\[(.*?)\]\s*(.*)$/", $output, $matches)) $output = $matches[2];
+ echo "ERROR starting web server: $output\n";
}
} else {
$statusCode = 400;
@@ -56,14 +46,4 @@ class YellowServe {
}
return $statusCode;
}
-
- // Check dynamic settings
- public function checkDynamicSettings($path, $url) {
- return $this->yellow->system->get("coreServerUrl")=="auto" || !$this->isDynamicPath($path);
- }
-
- // Check if dynamic path
- public function isDynamicPath($path) {
- return empty($path) || $path=="dynamic";
- }
}
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -64,11 +64,11 @@ media/images/photo.jpg: photo.jpg, create, optional
media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional
Extension: Install
-Version: 0.8.65
+Version: 0.8.66
Description: Install a brand new, shiny website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/install
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/install.zip
-Published: 2022-03-17 00:07:07
+Published: 2022-03-20 21:29:16
Developer: Datenstrom
Status: unlisted
system/extensions/install.php: install.php, create
@@ -106,11 +106,11 @@ Tag: feature
system/extensions/meta.php: meta.php, create, update
Extension: Serve
-Version: 0.8.17
+Version: 0.8.18
Description: Built-in web server.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/serve
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/serve.zip
-Published: 2022-03-16 16:15:47
+Published: 2022-03-18 11:03:27
Developer: Datenstrom
Tag: feature
system/extensions/serve.php: serve.php, create, update