Skip to content

Commit 78ea8b7

Browse files
committed
Framework: update -v output
1 parent 0fd7fd4 commit 78ea8b7

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

src/iTXTech/SimpleFramework/Console/Command/PackModuleCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ public function execute(string $command, array $args) : bool{
7272
"api" => $info->getApi(),
7373
"description" => $info->getDescription(),
7474
"authors" => $info->getAuthors(),
75+
"generator" => Framework::PROG_NAME . " " . Framework::PROG_VERSION,
7576
"creationDate" => time()
7677
]);
77-
$phar->setStub('<?php echo "' . Framework::PROG_NAME . ' module ' . $info->getName() . ' v' . $info->getVersion() . '\nThis file has been generated using PackModule Command at ' . date("r") . '\n----------------\n";if(extension_loaded("phar")){$phar = new \Phar(__FILE__);foreach($phar->getMetadata() as $key => $value){echo ucfirst($key).": ".(is_array($value) ? implode(", ", $value):$value)."\n";}} __HALT_COMPILER();');
78+
$phar->setStub('<?php echo "' . Framework::PROG_NAME . ' module ' . $info->getName() . ' v' . $info->getVersion() . '\n----------------\n";if(extension_loaded("phar")){$phar = new \Phar(__FILE__);foreach($phar->getMetadata() as $key => $value){echo ucfirst($key).": ".(is_array($value) ? implode(", ", $value):$value)."\n";}} __HALT_COMPILER();');
7879
$phar->setSignatureAlgorithm(\Phar::SHA1);
7980
$filePath = rtrim(str_replace("\\", "/", $module->getFile()), "/") . "/";
8081
$phar->startBuffering();

src/iTXTech/SimpleFramework/Console/ConsoleReader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ConsoleReader extends Thread{
3030
private $shutdown = false;
3131
private $type = self::TYPE_STREAM;
3232

33-
3433
public function __construct(){
3534
$this->buffer = new \Threaded;
3635
$this->start();

src/iTXTech/SimpleFramework/Console/Terminal.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
namespace iTXTech\SimpleFramework\Console;
1818

19-
use iTXTech\SimpleFramework\Util\StringUtil;
2019
use iTXTech\SimpleFramework\Util\Util;
2120

2221
abstract class Terminal{
@@ -52,7 +51,7 @@ public static function hasFormattingCodes(){
5251
if((Util::getOS() !== Util::OS_WINDOWS and getenv("TERM") != "" and
5352
(!function_exists("posix_ttyname") or !defined("STDOUT")
5453
or posix_ttyname(STDOUT) !== false)) or
55-
(Util::getOS() === Util::OS_WINDOWS and StringUtil::contains(php_uname("v"), "Windows 10"))){
54+
(Util::getOS() === Util::OS_WINDOWS and php_uname("r") >= 10)){
5655
self::$formattingCodes = true;
5756
}
5857
}

src/iTXTech/SimpleFramework/Framework.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,19 @@ private function processCommandLineOptions(array $argv){
182182
exit(0);
183183
}
184184
if($cmd->hasOption("version")){
185+
$built = date("r") . " (Source)";
186+
if(($phar = \Phar::running(true)) !== ""){
187+
$phar = new \Phar($phar);
188+
$built = date("r", $phar->getMetadata()["creationDate"]) . " (Phar)";
189+
}
190+
185191
Util::println(Framework::PROG_NAME . " " . Framework::PROG_VERSION .
186-
" \"" . Framework::CODENAME . "\" [PHP " . PHP_VERSION . "]");
187-
Util::println(Framework::PROG_NAME . " API " . Framework::API_LEVEL);
192+
" \"" . Framework::CODENAME . "\" (API " . Framework::API_LEVEL . ")");
193+
Util::println("Built: " . $built);
194+
Util::println("Copyright (C) 2016-2018 iTX Technologies");
188195
Util::println(str_repeat("-", 30));
196+
Util::println("OS => " . PHP_OS_FAMILY . " " . php_uname("r"));
197+
Util::println("PHP => " . PHP_VERSION);
189198
foreach(["curl", "Phar", "pthreads", "yaml", "swoole"] as $ext){
190199
Util::println(Util::generateExtensionInfo($ext));
191200
}
@@ -272,8 +281,11 @@ public function start(bool $useMainThreadTick = true, array $argv = []){
272281
self::PROG_VERSION . TextFormat::GREEN . " [" . self::CODENAME . "]");
273282
Logger::info(TextFormat::GOLD . "Licensed under GNU General Public License v3.0");
274283

275-
$this->moduleManager = new ModuleManager($this->classLoader,
276-
$this->properties->modulePath, $this->properties->moduleDataPath);
284+
//TODO: preload plugins before initialize
285+
if($this->moduleManager === null){
286+
$this->moduleManager = new ModuleManager($this->classLoader,
287+
$this->properties->modulePath, $this->properties->moduleDataPath);
288+
}
277289

278290
if(!\iTXTech\SimpleFramework\SINGLE_THREAD){
279291
Logger::info("Starting ConsoleReader...");

0 commit comments

Comments
 (0)