fix: origin branch를 제대로 파싱하지 못하는 버그 수정

This commit is contained in:
2021-11-26 18:56:04 +09:00
parent 0f35569e05
commit 4ce49f259d
2 changed files with 13 additions and 9 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ class VersionGitDynamic
if (is_array($output)) { if (is_array($output)) {
if (count($output)) { if (count($output)) {
$output = $output[1]; $output = $output[1];
$versionTokens[] = trim($output, " \t\n\r\0\x0b*"); $output = trim($output, " \t\n\r\0\x0b*");
$output = explode('/', $output);
$versionTokens[] = Util::array_last($output);
} else { } else {
$versionTokens[] = 'unknown'; $versionTokens[] = 'unknown';
} }
+10 -8
View File
@@ -1,4 +1,5 @@
<?php <?php
namespace sammo; namespace sammo;
require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/autoload.php');
@@ -26,11 +27,12 @@ function getVersion($target = null)
} }
exec($command, $output); exec($command, $output);
if (is_array($output)) { if (is_array($output)) {
if(count($output)){ if (count($output)) {
$output = $output[1]; $output = $output[1];
$versionTokens[] = trim($output, " \t\n\r\0\x0b*"); $output = trim($output, " \t\n\r\0\x0b*");
} $output = explode('/', $output);
else{ $versionTokens[] = Util::array_last($output);
} else {
$versionTokens[] = 'unknown'; $versionTokens[] = 'unknown';
} }
} }
@@ -81,7 +83,7 @@ function tryNpmInstall()
} }
//2. package-lock.json 업데이트가 2주를 초과했다면 업데이트. //2. package-lock.json 업데이트가 2주를 초과했다면 업데이트.
if($oldTimestamp + 60*60*24*14 < $timestamp){ if ($oldTimestamp + 60 * 60 * 24 * 14 < $timestamp) {
break; break;
} }
@@ -99,8 +101,8 @@ function tryNpmInstall()
} }
file_put_contents($npmResultPath, json_encode([ file_put_contents($npmResultPath, json_encode([
'packageJsonHash'=>$packageJsonHash, 'packageJsonHash' => $packageJsonHash,
'updateTimestamp'=>$timestamp, 'updateTimestamp' => $timestamp,
])); ]));
return true; return true;
} }
@@ -108,7 +110,7 @@ function tryNpmInstall()
//묻고 따지지 않고 일단 npm install은 시도한다. //묻고 따지지 않고 일단 npm install은 시도한다.
//hwe 업데이트인 경우에만 한번 더 부른다. //hwe 업데이트인 경우에만 한번 더 부른다.
if(tryNpmInstall()){ if (tryNpmInstall()) {
genJS(Util::array_last_key(ServConfig::getServerList())); genJS(Util::array_last_key(ServConfig::getServerList()));
} }
$session = Session::requireLogin(null)->setReadOnly(); $session = Session::requireLogin(null)->setReadOnly();