mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Merge pull request #4119 from Deltik/core-image-exclusions
CoreImage: Support path exclusions
This commit is contained in:
18
.github/workflows/build-release/CoreImage.php
vendored
18
.github/workflows/build-release/CoreImage.php
vendored
@@ -9,6 +9,11 @@
|
|||||||
|
|
||||||
abstract class CoreImage
|
abstract class CoreImage
|
||||||
{
|
{
|
||||||
|
const EXCLUDED_PATHS = [
|
||||||
|
'install.php',
|
||||||
|
'robots.txt'
|
||||||
|
];
|
||||||
|
|
||||||
protected function create_image($exportFolder, $tempFolder, $currentVersion)
|
protected function create_image($exportFolder, $tempFolder, $currentVersion)
|
||||||
{
|
{
|
||||||
echo("[Core-Image] Scanning Dir: " . $exportFolder . "\n");
|
echo("[Core-Image] Scanning Dir: " . $exportFolder . "\n");
|
||||||
@@ -34,6 +39,7 @@ abstract class CoreImage
|
|||||||
$relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", $absolutePath);
|
$relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", $absolutePath);
|
||||||
|
|
||||||
if (empty($relativePath) || $relativePath == $absolutePath) continue;
|
if (empty($relativePath) || $relativePath == $absolutePath) continue;
|
||||||
|
if ($this->isExcluded($relativePath)) continue;
|
||||||
|
|
||||||
$checksum = $this->checksumPath($absolutePath);
|
$checksum = $this->checksumPath($absolutePath);
|
||||||
$this->insertChecksumIntoDatabase($relativePath, $checksum, $currentVersion);
|
$this->insertChecksumIntoDatabase($relativePath, $checksum, $currentVersion);
|
||||||
@@ -126,6 +132,8 @@ abstract class CoreImage
|
|||||||
);
|
);
|
||||||
foreach ($removedFiles as $removedFilePath)
|
foreach ($removedFiles as $removedFilePath)
|
||||||
{
|
{
|
||||||
|
if ($this->isExcluded($removedFilePath)) continue;
|
||||||
|
|
||||||
$checksum = $this->checksumPath($timeMachineFolder . '/' . $removedFilePath);
|
$checksum = $this->checksumPath($timeMachineFolder . '/' . $removedFilePath);
|
||||||
$this->insertChecksumIntoDatabase($removedFilePath, $checksum, $version);
|
$this->insertChecksumIntoDatabase($removedFilePath, $checksum, $version);
|
||||||
}
|
}
|
||||||
@@ -157,4 +165,14 @@ abstract class CoreImage
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the provided relative path should make it into the generated integrity database
|
||||||
|
* @param $relativePath string Relative path candidate
|
||||||
|
* @return bool TRUE if the relative path should not be added to the integrity database; FALSE otherwise
|
||||||
|
*/
|
||||||
|
protected function isExcluded($relativePath)
|
||||||
|
{
|
||||||
|
return in_array($relativePath, self::EXCLUDED_PATHS);
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user