Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63dd672467 | ||
|
|
9df5b12aef | ||
|
|
8e89466e0b |
No files matched your search
@@ -43,9 +43,9 @@ return [
|
|||||||
|
|
||||||
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(PostRequestAuthentication::class)),
|
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(PostRequestAuthentication::class)),
|
||||||
|
|
||||||
MacAddressAuthentication::class => create(MacAddressAuthentication::class)->constructor(get(Authenticate::class), "mac"),
|
# MacAddressAuthentication::class => create(MacAddressAuthentication::class)->constructor(get(Authenticate::class), "mac"),
|
||||||
|
|
||||||
LocalMacAddressMiddleware::class => create(LocalMacAddressMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(MacAddressAuthentication::class)),
|
# LocalMacAddressMiddleware::class => create(LocalMacAddressMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(MacAddressAuthentication::class)),
|
||||||
|
|
||||||
'authentication.method' => null,
|
'authentication.method' => null,
|
||||||
|
|
||||||
|
|||||||
@@ -80,18 +80,7 @@ return [
|
|||||||
return uniqid("debug_");
|
return uniqid("debug_");
|
||||||
}
|
}
|
||||||
|
|
||||||
$gitdir = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . ".git" . DIRECTORY_SEPARATOR;
|
return \Lean\Git::getLatestCommit(getenv("PROJECT_PATH"));
|
||||||
|
|
||||||
if ( file_exists($gitdir . "HEAD") ) {
|
|
||||||
if (false !== ($currentBranch = file_get_contents($gitdir . "HEAD"))) {
|
|
||||||
$file = explode(": ", $currentBranch)[1];
|
|
||||||
$path = $gitdir . str_replace("/", DIRECTORY_SEPARATOR, trim($file, " \t\n\r"));
|
|
||||||
|
|
||||||
return file_exists($path) ? trim(file_get_contents($path), " \t\n\r") : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "gitless-project";
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Kash\CacheInvalidator::class => create(Kash\CacheInvalidator::class)->constructor(getenv('CACHE_PATH')."/version.cache", (bool) getenv('DEBUG')),
|
Kash\CacheInvalidator::class => create(Kash\CacheInvalidator::class)->constructor(getenv('CACHE_PATH')."/version.cache", (bool) getenv('DEBUG')),
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use Picea\Ui\Method\FormContextInterface;
|
|||||||
use TheBugs\Email\MailerInterface;
|
use TheBugs\Email\MailerInterface;
|
||||||
use Storage\{ Cookie, Session };
|
use Storage\{ Cookie, Session };
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
|
use Picea;
|
||||||
|
|
||||||
use Psr\Http\Message\{ ServerRequestInterface, ResponseInterface };
|
use Psr\Http\Message\{ ServerRequestInterface, ResponseInterface };
|
||||||
|
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean;
|
||||||
|
|
||||||
|
class Git
|
||||||
|
{
|
||||||
|
public static function projectVersion(string $projectPath) : string
|
||||||
|
{
|
||||||
|
$gitdir = implode(DIRECTORY_SEPARATOR, [ $projectPath, ".git", "refs", "tags" ]);
|
||||||
|
|
||||||
|
if ( file_exists($gitdir) ) {
|
||||||
|
$tags = array_filter(scandir($gitdir, SCANDIR_SORT_DESCENDING), fn($e) => ! str_starts_with($e, '.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_shift($tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLatestCommit(string $projectPath) : string
|
||||||
|
{
|
||||||
|
$gitdir = implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), ".git", "" ]);
|
||||||
|
|
||||||
|
if ( file_exists($gitdir . "HEAD") ) {
|
||||||
|
if (false !== ($currentBranch = file_get_contents($gitdir . "HEAD"))) {
|
||||||
|
$file = explode(": ", $currentBranch)[1];
|
||||||
|
$path = $gitdir . str_replace("/", DIRECTORY_SEPARATOR, trim($file, " \t\n\r"));
|
||||||
|
|
||||||
|
return file_exists($path) ? trim(file_get_contents($path), " \t\n\r") : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user