feat: produire un sha1 à la compilation

pull/42/head
JamesRezo 4 months ago
parent 82a119b0dc
commit 9f52f838a7

@ -28,6 +28,7 @@ class Build {
[
'spip_loader.php',
'version',
'sha1',
] as $clean_file
) {
if (file_exists($this->buildDirectory . '/' . $clean_file)) {
@ -54,6 +55,7 @@ class Build {
$this->stats['Nb files'] = $n;
$phar->renameTo($this->pharFilename);
file_put_contents($this->buildDirectory . '/version', $git->getVersion());
file_put_contents($this->buildDirectory . '/sha1', \sha1_file($this->buildDirectory . '/' . $this->pharFilename));
$this->stop();
}
@ -83,7 +85,7 @@ class Build {
if (!is_dir($prodDirectory)) {
throw new \Exception(sprintf('Directory %s needs to exists', $prodDirectory));
}
$files = [$this->pharFilename, 'version'];
$files = [$this->pharFilename, 'version', 'sha1'];
foreach ($files as $file) {
if (!file_exists($this->buildDirectory . '/' . $file)) {
throw new \Exception(sprintf('File %s is not compiled ?', $this->buildDirectory . '/' . $file));
@ -115,6 +117,7 @@ class Build {
'Time' => '',
'Memory' => '',
'Filesize' => 'No archive file',
'sha1' => '',
'Nb files' => '',
];
$this->timer->start();
@ -135,6 +138,9 @@ class Build {
if (file_exists($this->buildDirectory . '/version')) {
$this->stats['Version'] = file_get_contents($this->buildDirectory . '/version');
}
if (file_exists($this->buildDirectory . '/sha1')) {
$this->stats['sha1'] = \sha1_file($pharPath);
}
}
private function parseResourceUsage(Duration $duration): array {

Loading…
Cancel
Save