Description
Determine if the current version is compatible with the required version
Usage
OIK_libs::compatible_version( $current_version, $required_version );Parameters
- $current_version
- ( string ) required – a specific version
- $required_version
- ( string ) required – may include wildcards
Returns
voidTO DO
Decide what to do about version checking, which is already fully implemented for packages in Composer| $version_compare | comparison | means |
|---|---|---|
| -1 | current < required | no good |
| 0 | current = required | that’s fine and dandy |
| 1 | current > required | |
| current | required | Means |
| ——- | ——– | ———– |
| any | * | OK |
| x | y | -1 = no good |
| x | x | 0 = OK |
| y | x | actually we need to do semantic versioning checking |
Source
File name: oik-lib/includes/class-oik-libs.phpLines:
1 to 26 of 26
function compatible_version( $current_version, $required_version ) { //bw_trace2( null, null, true, BW_TRACE_VERBOSE ); bw_trace2(); if ( ($current_version !== null) && ($required_version !== null) && ("*" != $required_version) ) { $version_compare = version_compare( $current_version, $required_version ); $acceptable = false; bw_trace2( $version_compare, "version compare", false, BW_TRACE_VERBOSE ); switch ( $version_compare ) { case 0: $acceptable = true; break; case -1: break; default: // Now we have to check semantic versioning // but in the mean time pretend it's acceptable $acceptable = true; } } else { $acceptable = true; } return( $acceptable ); }View on GitHub
Called by
1 to 2 of 2
Invoked by
Call hooks
API Letters:
