Merge pull request #6 from DerDreschner/feat/support-php-min-max-version

feat: Support optional PHP min/max version property in info.xml
This commit is contained in:
Robin Appelman 2026-06-21 22:17:05 +02:00 committed by GitHub
commit 40f959f606
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4792 additions and 4781 deletions

View file

@ -1,6 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<info> <info>
<dependencies> <dependencies>
<nextcloud min-version="25" max-version="29" /> <php max-version="8.1" />
<nextcloud min-version="27" max-version="33" />
</dependencies> </dependencies>
</info> </info>

9549
dist/index.js vendored

File diff suppressed because it is too large Load diff

View file

@ -131,23 +131,28 @@ function getPHPVersionID(version) {
const content = fs.readFileSync(filename, 'utf8'); const content = fs.readFileSync(filename, 'utf8');
const document = new DOMParser().parseFromString(content); const document = new DOMParser().parseFromString(content);
const minVersion = parseInt(xpath.select1("//info//dependencies//nextcloud/@min-version", document).value, 10); const nextcloudMinVersion = parseInt(xpath.select1("//info//dependencies//nextcloud/@min-version", document).value, 10);
const maxVersion = parseInt(xpath.select1("//info//dependencies//nextcloud/@max-version", document).value, 10); const nextcloudMaxVersion = parseInt(xpath.select1("//info//dependencies//nextcloud/@max-version", document).value, 10);
console.log(`App supports from ${minVersion} till ${maxVersion}`); const phpMinVersion = parseFloat(xpath.select1("//info//dependencies//php/@min-version", document)?.value);
const phpMaxVersion = parseFloat(xpath.select1("//info//dependencies//php/@max-version", document)?.value);
const versions = range(minVersion, maxVersion); console.log(`App supports Nextcloud ${nextcloudMinVersion} till ${nextcloudMaxVersion}`);
console.log(`App supports PHP ${phpMinVersion} till ${phpMaxVersion} (NaN = no range limit specified)`);
const versions = range(nextcloudMinVersion, nextcloudMaxVersion);
// we reverse the order to put highest version first for the "branched off check" // we reverse the order to put highest version first for the "branched off check"
const versionData= (await Promise.all(versions.reverse().map(async (version) => { let versionData = (await Promise.all(versions.reverse().map(async (version) => {
const branch = await getBranch(version); const branch = await getBranch(version);
const php = await getSupportedVersions(branch); const phpVersionRange = await getSupportedVersions(branch);
return { return {
"phpMin": php.min, "phpMin": isNaN(phpMinVersion) ? phpVersionRange.min : Math.max(phpVersionRange.min, phpMinVersion),
"phpMax": php.max, "phpMax": isNaN(phpMaxVersion) ? phpVersionRange.max : Math.min(phpVersionRange.max, phpMaxVersion),
"branch": branch, "branch": branch,
} }
}))).reverse(); }))).reverse();
versionData = versionData.filter(data => data.phpMin <= data.phpMax);
// matrix with a single php version per server version // matrix with a single php version per server version
const serverMatrix = cartesianProduct({ const serverMatrix = cartesianProduct({