Fix incorrect filesystem determination and simplify hash calculation

This commit is contained in:
Alex Cabal 2024-11-05 14:04:56 -06:00
parent 163ada3b09
commit 274605a0e8

View file

@ -314,8 +314,7 @@ class Ebook{
} }
private function GetLatestCommitHash(): string{ private function GetLatestCommitHash(): string{
$gitCommits = $this->GitCommits; return substr(sha1($this->GitCommits[0]->Hash), 0, 8);
return substr(sha1($gitCommits[0]->Created->format('U') . ' ' . $gitCommits[0]->Message), 0, 8);
} }
protected function GetHeroImageUrl(): string{ protected function GetHeroImageUrl(): string{
@ -606,7 +605,7 @@ class Ebook{
$ebookFromFilesystem = new Ebook(); $ebookFromFilesystem = new Ebook();
// First, construct a source repo path from our WWW filesystem path. // First, construct a source repo path from our WWW filesystem path.
if(str_starts_with($wwwFilesystemPath, '/')){ if(is_dir($wwwFilesystemPath . '/.git')){
$ebookFromFilesystem->RepoFilesystemPath = $wwwFilesystemPath; $ebookFromFilesystem->RepoFilesystemPath = $wwwFilesystemPath;
} }
else{ else{