Skip to content

Commit

Permalink
修改代码错误
Browse files Browse the repository at this point in the history
  • Loading branch information
titrxw committed Nov 28, 2020
1 parent a85d237 commit d900fb4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@

use W7\Console\Application;
use W7\Console\Io\Output;
use W7\Contract\Config\RepositoryInterface;
use W7\Core\Bootstrap\BootstrapInterface;
use W7\Core\Bootstrap\LoadConfigBootstrap;
use W7\Core\Bootstrap\ProviderBootstrap;
use W7\Core\Bootstrap\RegisterHandleExceptionsBootstrap;
use W7\Core\Bootstrap\RegisterRuntimeEnvBootstrap;
use W7\Core\Bootstrap\RegisterSecurityDirBootstrap;
use W7\Core\Config\Config;
use W7\Core\Container\Container;
use W7\Core\Server\ServerAbstract;

class App {
const NAME = 'w7-rangine';
const VERSION = '2.4.2';
const VERSION = '2.4.3';

public static $self;
/**
Expand Down Expand Up @@ -86,12 +86,12 @@ public function getContainer() {
return $this->container;
}

public function getConfigger() : Config {
return $this->getContainer()->singleton(Config::class);
public function getConfigger() : RepositoryInterface {
return $this->getContainer()->singleton(RepositoryInterface::class);
}

public function bootstrapCachePath($path = '') {
return BASE_PATH . '/bootstrap/cache' . ($path ? '/' . $path : $path);
return BASE_PATH . '/bootstrap/cache' . ($path ? ('/' . $path) : $path);
}

public function getRouteCachePath() {
Expand Down
3 changes: 2 additions & 1 deletion Src/Core/Bootstrap/LoadConfigBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace W7\Core\Bootstrap;

use W7\App;
use W7\Contract\Config\RepositoryInterface;
use W7\Core\Config\Config;
use W7\Core\Config\Env\Env;

Expand All @@ -33,7 +34,7 @@ public function bootstrap(App $app) {
$this->loadConfigFile($this->getBuiltInConfigPath());
$this->loadConfigFile($loadDir);

$app->getContainer()->set(Config::class, function () {
$app->getContainer()->set(RepositoryInterface::class, function () {
$config = new Config($this->payload);
$this->payload = [];
return $config;
Expand Down
3 changes: 1 addition & 2 deletions Src/Core/Config/Env/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function __construct($path) {
if (empty($path) || !is_dir($path)) {
throw new \RuntimeException('Invalid env path');
}
$this->envPath = rtrim($path, '/');
$this->hostName = gethostname();
}

Expand Down Expand Up @@ -85,7 +84,7 @@ private function getEnvFileByHostName($hostname = '') {
*/
protected function getFilePaths(array $paths, $file) {
return array_map(function ($path) use ($file) {
return rtrim($path, '/').'/'.$file;
return $path . '/' . $file;
}, $paths);
}
}
2 changes: 1 addition & 1 deletion Src/Core/Log/Provider/LogProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private function clearLog() {
if ((ENV & CLEAR_LOG) !== CLEAR_LOG) {
return false;
}
$logPath = RUNTIME_PATH . DS. 'logs/*';
$logPath = RUNTIME_PATH . '/logs/*';
$tree = glob($logPath);
if (!empty($tree)) {
foreach ($tree as $file) {
Expand Down
10 changes: 5 additions & 5 deletions Src/Process/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function getType() {

protected function checkSetting() {
//获取要启动的process
$supportProcess = Config::get('process.process', []);
$servers = trim(Config::get('app.setting.server'));
$supportProcess = $this->getConfig()->get('process.process', []);
$servers = trim($this->getConfig()->get('app.setting.server'));
$servers = explode('|', $servers);

//获取需要启动的process
Expand All @@ -53,7 +53,7 @@ protected function checkSetting() {
//如果是全部启动的话,enable和配置中的值保持一致
$supportProcess[$processName]['enable'] = $startAll ? ($supportProcess[$processName]['enable'] ?? true) : true;
}
Config::set('process.process', $supportProcess);
$this->getConfig()->set('process.process', $supportProcess);

$this->setting['worker_num'] = $this->getWorkerNum();
if ($this->setting['worker_num'] == 0) {
Expand All @@ -65,7 +65,7 @@ protected function checkSetting() {

private function getWorkerNum() {
$workerNum = 0;
$configProcess = Config::get('process.process', []);
$configProcess = $this->getConfig()->get('process.process', []);
foreach ($configProcess as $key => $process) {
if (empty($process['enable'])) {
continue;
Expand All @@ -77,7 +77,7 @@ private function getWorkerNum() {
}

protected function register() {
$configProcess = Config::get('process.process', []);
$configProcess = $this->getConfig()->get('process.process', []);
foreach ($configProcess as $name => $process) {
if (empty($process['enable'])) {
continue;
Expand Down

0 comments on commit d900fb4

Please sign in to comment.