Skip to content

Commit

Permalink
Merge pull request #218 from kmvan/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kmvan authored Jul 27, 2024
2 parents ae4b71a + 7d4803d commit 4319b6c
Show file tree
Hide file tree
Showing 9 changed files with 441 additions and 80 deletions.
4 changes: 1 addition & 3 deletions .php-cs-fixer54.php → .php-cs-fixer54
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->exclude(__DIR__ . '/dist')
->exclude(__DIR__ . '/.tmp')
->exclude(__DIR__ . '/node_modules')
->notPath(__DIR__ . '/functions.php')
->in(__DIR__);

return (new PhpCsFixer\Config())
->setIndent(' ')
->setRiskyAllowed(true)
Expand Down Expand Up @@ -140,7 +138,7 @@
'simple_to_complex_string_variable' => true,
'simplified_null_return' => true,
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
// 'single_blank_line_before_namespace' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_style' => true,
Expand Down
2 changes: 1 addition & 1 deletion AppConfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"APP_VERSION": "8.17",
"APP_VERSION": "8.18",
"APP_NAME": "X Prober",
"APP_URL": "https://github.com/kmvan/x-prober",
"AUTHOR_URL": "https://inn-studio.com/prober",
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

All Notable changes to `X-Prober` will be documented in this file

## 8.18.0 - 2024-07-27

### Add

- Add ARM CPU detection

### Optimize

- Optimize disk usage detection

## 8.17.0 - 2023-12-31

### Add

- Add detail disk usage
-

### Optimize

- Optimize style
Expand Down
24 changes: 12 additions & 12 deletions compiler/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(string $dir)

$code = '';

if ( ! $this->isDev()) {
if (! $this->isDev()) {
foreach ($this->yieldFiles($this->COMPONENTS_DIR) as $filePath) {
if (is_dir($filePath) || false === strpos($filePath, '.php')) {
continue;
Expand Down Expand Up @@ -63,12 +63,12 @@ public function __construct(string $dir)
'distFilePath' => $this->COMPILE_FILE_PATH,
));

if ( ! $this->isDev()) {
if ($this->isDebug()) {
$this->writeFile(file_get_contents($this->COMPILE_FILE_PATH));
} else {
$this->writeFile(php_strip_whitespace($this->COMPILE_FILE_PATH));
}
if (! $this->isDev()) {
// if ($this->isDebug()) {
$this->writeFile(file_get_contents($this->COMPILE_FILE_PATH));
// } else {
// $this->writeFile(php_strip_whitespace($this->COMPILE_FILE_PATH));
// }
}

echo 'Compiled!';
Expand Down Expand Up @@ -165,7 +165,7 @@ private function loader(): string
{
$dirs = glob($this->COMPONENTS_DIR . '/*');

if ( ! $dirs) {
if (! $dirs) {
return '';
}

Expand All @@ -175,7 +175,7 @@ private function loader(): string
$basename = basename($dir);
$filePath = "{$dir}/{$basename}.php";

if ( ! is_file($filePath)) {
if (! is_file($filePath)) {
continue;
}

Expand All @@ -193,7 +193,7 @@ private function loader(): string

private function genVendorCode(): string
{
if ( ! $this->isDev()) {
if (! $this->isDev()) {
return '';
}

Expand All @@ -207,7 +207,7 @@ private function yieldFiles(string $dir): Iterator
if (is_dir($dir)) {
$dh = opendir($dir);

if ( ! $dh) {
if (! $dh) {
yield false;
}

Expand Down Expand Up @@ -237,7 +237,7 @@ private function writeFile(string $data): bool
{
$dir = \dirname($this->COMPILE_FILE_PATH);

if ( ! is_dir($dir)) {
if (! is_dir($dir)) {
mkdir($dir, 0755, true);
}

Expand Down
106 changes: 102 additions & 4 deletions dist/prober.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"scripts": {
"lang": "node ./tools/lang-builder.mjs",
"dev": "webpack --config webpack.config.mjs",
"dev:php": "php ./Make.php dev; php -S localhost:8000 -t .tmp",
"dev:php": "php ./Make.php dev && php -S localhost:8000 -t .tmp",
"build": "webpack --config webpack.config.prod.mjs",
"build:php": "php-cs-fixer fix ./src --config=.php-cs-fixer54.php; php ./Make.php build; echo '\nPlease access via http://localhost:8001/prober.php'; php -S localhost:8001 -t dist",
"build:php-debug": "php ./Make.php build debug; echo '\nPlease access via http://localhost:8001/prober.php'; php -S localhost:8001 -t dist",
"php-cs-fixer-54": "php-cs-fixer fix ./src --config=.php-cs-fixer54.php"
"build:php": "php-cs-fixer fix ./src --config=.php-cs-fixer54 && php ./Make.php build; echo '\nPlease access via http://localhost:8001/prober.php' && php -S localhost:8001 -t dist",
"build:php-debug": "php ./Make.php build debug && echo '\nPlease access via http://localhost:8001/prober.php' && php -S localhost:8001 -t dist",
"php-cs-fixer-54": "php-cs-fixer fix ./src --config=.php-cs-fixer54"
},
"browserslist": [
"defaults"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Config/ConfigApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ConfigApi
{
public static $APP_VERSION = '8.17';
public static $APP_VERSION = '8.18';
public static $APP_NAME = 'X Prober';
public static $APP_URL = 'https://github.com/kmvan/x-prober';
public static $APP_CONFIG_URLS = array('https://raw.githubusercontent.com/kmvan/x-prober/master/AppConfig.json', 'https://api.inn-studio.com/download/?id=xprober-config');
Expand Down
Loading

13 comments on commit 4319b6c

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did NOT work on latest alpine. And 8.17 worked normally.

Alpine: nginx php-fpm

https://par.serv.net.eu.org/tz1.php (8.17) .../tz2.php(8.18)

@kmvan
Copy link
Owner Author

@kmvan kmvan commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did NOT work on latest alpine. And 8.17 worked normally.

Alpine: nginx php-fpm

https://par.serv.net.eu.org/tz1.php (8.17) .../tz2.php(8.18)

With Docker?

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did NOT work on latest alpine. And 8.17 worked normally.
Alpine: nginx php-fpm
https://par.serv.net.eu.org/tz1.php (8.17) .../tz2.php(8.18)

With Docker?

Scaleway, 1C1G1G, kvm, latest Alpine

System: alpine-3.20.2 [kvm:x86_64]
CPU: AMD EPYC 7281 16-Core Processor 1 Virtual Core (5.97%)
Disk: 328.96M / 762M (43.17%)
RAM: 392.05M / 967.84M (40.51%)
Swap: OFF
Usage: 21.91M 228.15M
Load: 0.03 / 0.06 / 0.00
Process Count: 0
Connection Count: TCP 0 / UDP 0
Boot Time: 8/16/2024, 10:32:16 AM
Last Active: 8/16/2024, 11:03:18 AM
Uptime: 0:31:02
Version: 0.18.18

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tested on Racknerd VPS, dd to alpine, has the same issue.

System: alpine-3.20.2 [x86_64]
CPU: Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz 1 Virtual Core (7.18%)
Disk: 2.34G / 16.54G (14.14%)
RAM: 486.74M / 973.35M (50.01%)
Swap: 0B / 1024M (0.00%)
Usage: 2.6G 2.65G
Load: 0.07 / 0.15 / 0.15
Process Count: 0
Connection Count: TCP 0 / UDP 0
Boot Time: 8/16/2024, 10:33:10 AM
Last Active: 8/16/2024, 11:05:50 AM
Uptime: 0:33:35
Version: 0.18.18

@kmvan
Copy link
Owner Author

@kmvan kmvan commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any error messages?

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://par.serv.net.eu.org/tz2.php

HTTP ERROR 500

But I don't think it's useful.

@kmvan
Copy link
Owner Author

@kmvan kmvan commented on 4319b6c Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to simulate a similar environment, thanks for the feedback!

@kmvan
Copy link
Owner Author

@kmvan kmvan commented on 4319b6c Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://par.serv.net.eu.org/tz2.php

HTTP ERROR 500

But I don't think it's useful.

I updated dev version: https://github.com/kmvan/x-prober/tree/dev/dist

Can you help try it out?

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. https://par.serv.net.eu.org/tz2.php

HTTP ERROR 500
But I don't think it's useful.

I updated dev version: https://github.com/kmvan/x-prober/tree/dev/dist

Can you help try it out?

It works.
And I also replied your email, give you a VPS ssh info.

https://fr.serv.net.eu.org/prober.php

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in mail, Nginx+Php-fpm on Debian 11. Download the dev file and test, it works too.

@kmvan
Copy link
Owner Author

@kmvan kmvan commented on 4319b6c Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in mail, Nginx+Php-fpm on Debian 11. Download the dev file and test, it works too.

Done. I will release a new version later.

@yiji2
Copy link

@yiji2 yiji2 commented on 4319b6c Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.19 works on both Alpine and Debian.

@kmvan
Copy link
Owner Author

@kmvan kmvan commented on 4319b6c Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Please sign in to comment.