better version numbers

This commit is contained in:
Paul Wilde 2021-08-10 17:09:22 +01:00
parent 3653946225
commit d09d47251e
3 changed files with 7 additions and 3 deletions

View file

@ -29,7 +29,6 @@ class Init {
// YOU REALLY SHOULD HAVE YOUR OWN CONFIG FILE!!! // YOU REALLY SHOULD HAVE YOUR OWN CONFIG FILE!!!
if (!file_exists($config)) { if (!file_exists($config)) {
echo copy(Core::root_dir()."/sample-config/services.sample.ini", $config);
$config = Core::root_dir()."/sample-config/config.sample.ini"; $config = Core::root_dir()."/sample-config/config.sample.ini";
} }
@ -40,7 +39,6 @@ class Init {
// YOU REALLY SHOULD HAVE YOUR OWN SERVICES FILE!!! // YOU REALLY SHOULD HAVE YOUR OWN SERVICES FILE!!!
if (!file_exists($services)) { if (!file_exists($services)) {
echo copy(Core::root_dir()."/sample-config/services.sample.ini", $services);
$services = Core::root_dir()."/sample-config/services.sample.ini"; $services = Core::root_dir()."/sample-config/services.sample.ini";
} }

View file

@ -1,5 +1,6 @@
<?php class Core { <?php class Core {
public static $Config; public static $Config;
public const VERSION = "0.0.1";
public static $CurrentPage; public static $CurrentPage;
public static function root_dir(){ public static function root_dir(){
return $_SERVER['DOCUMENT_ROOT']; return $_SERVER['DOCUMENT_ROOT'];

View file

@ -84,6 +84,11 @@ class Response {
public function __construct(){ public function __construct(){
// add requested page to response. I don't know why, but it could helpful for diagnostics at some point // add requested page to response. I don't know why, but it could helpful for diagnostics at some point
$this->url = Core::$CurrentPage; $this->url = Core::$CurrentPage;
$this->commit = Core::$Config["CommitID"]; if (!Core::$Config["CommitID"]){
$this->version = Core::VERSION;
} else {
$this->version = "git commit ".Core::$Config["CommitID"];
}
} }
} }