1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 12:21:45 +02:00

Add a version filter to e_file_inspector::getPathIterator()

This commit is contained in:
Nick Liu
2020-03-23 13:37:46 -05:00
parent 0494000356
commit bb1c32489c
3 changed files with 28 additions and 5 deletions

View File

@@ -31,11 +31,24 @@ class e_file_inspector_sqlphar extends e_file_inspector
/**
* @inheritDoc
*/
public function getPathIterator()
public function getPathIterator($version = null)
{
$statement = $this->coreImage->query(
"SELECT path FROM file_hashes ORDER BY path ASC;"
);
$addVersionWhere = "";
$inputParameters = [];
if (!empty($version))
{
$addVersionWhere = "WHERE versions.version_string = ?";
$inputParameters[] = $version;
}
$statement = $this->coreImage->prepare("
SELECT path
FROM file_hashes
LEFT JOIN versions ON versions.version_id = file_hashes.release_version
$addVersionWhere
ORDER BY path ASC;
");
$statement->setFetchMode(PDO::FETCH_COLUMN, 0);
$statement->execute($inputParameters);
return new IteratorIterator($statement);
}