CompareVersion

class OC\App\CompareVersion
Source:lib/private/App/CompareVersion.php#32

Constants

REGEX_MAJOR = /^\d+$/
Source:lib/private/App/CompareVersion.php#33
REGEX_MAJOR_MINOR = /^\d+\.\d+$/
Source:lib/private/App/CompareVersion.php#34
REGEX_MAJOR_MINOR_PATCH = /^\d+\.\d+\.\d+(?!\.\d+)/
Source:lib/private/App/CompareVersion.php#35
REGEX_ACTUAL = /^\d+(\.\d+){1,2}/
Source:lib/private/App/CompareVersion.php#36

Methods

public OC\App\CompareVersion::isCompatible($actual, $required, $comparator=>=)
Checks if the given server version fulfills the given (app) version requirements.
Version requirements can be ‘major.minor.patch’, ‘major.minor’ or just ‘major’,
so ‘13.0.1’, ‘13.0’ and ‘13’ are valid.
Source:

lib/private/App/CompareVersion.php#50

Parameters:
  • $actual (string) version as major.minor.patch notation
  • $required (string) version where major is requried and minor and patch are optional
  • $comparator (string) passed to version_compare
Returns:

bool whether the requirement is fulfilled

Throws:

\InvalidArgumentException if versions specified in an invalid format