改名
This commit is contained in:
+11
-8
@@ -25,6 +25,7 @@ use Snowflake\Exception\NotFindClassException;
|
|||||||
use Snowflake\Exception\NotFindPropertyException;
|
use Snowflake\Exception\NotFindPropertyException;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Swoole\Timer;
|
use Swoole\Timer;
|
||||||
|
use function Co\run;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Init
|
* Class Init
|
||||||
@@ -98,10 +99,10 @@ class Application extends BaseApplication
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Input $argv
|
* @param Input $argv
|
||||||
* @return bool|string
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function start(Input $argv): bool|string
|
public function start(Input $argv): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
ini_set('opcache.enable', '1');
|
ini_set('opcache.enable', '1');
|
||||||
@@ -111,14 +112,16 @@ class Application extends BaseApplication
|
|||||||
|
|
||||||
fire(Event::SERVER_BEFORE_START);
|
fire(Event::SERVER_BEFORE_START);
|
||||||
|
|
||||||
$this->set('input', $argv);
|
run(function () use ($argv) {
|
||||||
|
$this->set('input', $argv);
|
||||||
|
|
||||||
$manager = Snowflake::app()->get('console');
|
$manager = Snowflake::app()->get('console');
|
||||||
$manager->setParameters($argv);
|
$manager->setParameters($argv);
|
||||||
$class = $manager->search();
|
$class = $manager->search();
|
||||||
return response()->send($manager->execCommand($class));
|
response()->send($manager->execCommand($class));
|
||||||
|
});
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
return response()->send(implode("\n", [
|
response()->send(implode("\n", [
|
||||||
'Msg: ' . $exception->getMessage(),
|
'Msg: ' . $exception->getMessage(),
|
||||||
'Line: ' . $exception->getLine(),
|
'Line: ' . $exception->getLine(),
|
||||||
'File: ' . $exception->getFile()
|
'File: ' . $exception->getFile()
|
||||||
|
|||||||
@@ -167,7 +167,11 @@ class Logger extends Component
|
|||||||
|
|
||||||
$files = glob(storage(null, $dirName) . '/*');
|
$files = glob(storage(null, $dirName) . '/*');
|
||||||
if (count($files) >= 15) {
|
if (count($files) >= 15) {
|
||||||
Coroutine\System::exec('find ' . storage(null, $dirName) . '/ -mtime +15 -name "*.log" -exec rm -rf {} \;');
|
$command = 'find ' . storage(null, $dirName) . '/ -mtime +15 -name "*.log" -exec rm -rf {} \;';
|
||||||
|
if (Context::inCoroutine())
|
||||||
|
Coroutine\System::exec($command);
|
||||||
|
else
|
||||||
|
exec($command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user