Skip to content

Commit

Permalink
简单配置合并
Browse files Browse the repository at this point in the history
  • Loading branch information
evalor committed Sep 2, 2018
1 parent c9abbfa commit 44de5f7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/easyswoole
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use EasySwoole\Core\Utility\File;

define('EASYSWOOLE_ROOT', realpath(getcwd()));

foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
foreach ([ __DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php' ] as $file) {
if (file_exists($file)) {
require $file;
break;
Expand Down Expand Up @@ -60,7 +60,7 @@ function commandParser()
$options[$key] = array_shift($temp) ?: '';
}
}
return array($command, $options);
return array( $command, $options );
}

function opCacheClear()
Expand Down Expand Up @@ -109,7 +109,7 @@ function releaseResource($source, $destination)
$filename = basename($destination);
echo "{$filename} has already existed, do you want to replace it? [ Y / N (default) ] : ";
$answer = strtolower(trim(strtoupper(fgets(STDIN))));
if (!in_array($answer, ['y', 'yes'])) {
if (!in_array($answer, [ 'y', 'yes' ])) {
$replace = false;
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ function getRelativelyPath($a, $b)
if (count($arr2) - $depth - 1 > 0) {
$prefix = array_fill(0, count($arr2) - $depth - 1, '..');
} else {
$prefix = array('.');
$prefix = array( '.' );
}

$tmp = array_merge($prefix, array_slice($arr1, $depth));
Expand All @@ -261,6 +261,10 @@ function serverStart($options)
{
showLogo();
$conf = Conf::getInstance();
if ($options['e']) {
$confPath = file_exists($options['e']) ? $options['e'] : EASYSWOOLE_ROOT . '/' . ucfirst($options['e']) . '.php';
$conf->loadFile($confPath, true);
}
$inst = Core::getInstance()->initialize();
$version = \EasySwoole\Core\Component\Di::getInstance()->get(\EasySwoole\Core\Component\SysConst::VERSION);
echo "\n\e[31mEasySwoole\e[0m framework \e[34mVersion {$version}\e[0m\n\n";
Expand Down Expand Up @@ -419,7 +423,7 @@ function serverInstall($options)
if (is_dir($temPath)) {
echo 'Temp Directory has already existed, do you want to replace it? [ Y / N (default) ] : ';
$answer = strtolower(trim(strtoupper(fgets(STDIN))));
if (in_array($answer, ['y', 'yes'])) {
if (in_array($answer, [ 'y', 'yes' ])) {
if (!File::createDir($temPath)) {
die("create Temp Directory:{$temPath} fail");
}
Expand All @@ -433,7 +437,7 @@ function serverInstall($options)
if (is_dir($logPath)) {
echo 'Log Directory has already existed, do you want to replace it? [ Y / N (default) ] : ';
$answer = strtolower(trim(strtoupper(fgets(STDIN))));
if (in_array($answer, ['y', 'yes'])) {
if (in_array($answer, [ 'y', 'yes' ])) {
if (!File::createDir($logPath)) {
die("create Temp Directory:{$logPath} fail");
}
Expand Down

0 comments on commit 44de5f7

Please sign in to comment.