public function filterApplicableUpdates($updates, $jVersion = null)
{
if (empty($jVersion)) {
$jVersion = JVERSION;
}
$versionParts = explode('.', $jVersion, 4);
$platformVersionMajor = $versionParts[0];
$platformVersionMinor = $platformVersionMajor . '.' . $versionParts[1];
//$platformVersionNormal = $platformVersionMinor . '.' . $versionParts[2];
//$platformVersionFull = (count($versionParts) > 3) ? $platformVersionNormal . '.' . $versionParts[3] : $platformVersionNormal;
$ret = array();
foreach ($updates as $update) {
// Check each update for platform match
if (strtolower($update['targetplatform']['name']) != 'joomla') {
continue;
}
$targetPlatformVersion = $update['targetplatform']['version'];
if (!preg_match('/' . $targetPlatformVersion . '/', $platformVersionMinor)) {
continue;
}
// Get some information from the version number
$updateVersion = $update['version'];
$versionProperties = $this->getVersionProperties($updateVersion, $jVersion);
if ($versionProperties['upgrade'] == 'none') {
continue;
}
// The XML files are ill-maintained. Maybe we already have this update?
if (!array_key_exists($updateVersion, $ret)) {
$ret[$updateVersion] = array_merge($update, $versionProperties);
}
}
return $ret;
}