Changeset 2388:731ff8ef9ded for inc/core/class.dc.utils.php
- Timestamp:
- 10/16/13 17:47:56 (12 years ago)
- Branch:
- 2.6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.utils.php
r1179 r2388 74 74 return $clean_ids; 75 75 } 76 77 /** 78 * Compare two versions with option of using only main numbers. 79 * 80 * @param string $current_version Current version 81 * @param string $required_version Required version 82 * @param string $operator Comparison operand 83 * @param boolean $strict Use full version 84 * @return boolean True if comparison success 85 */ 86 public static function versionsCompare($current_version, $required_version, $operator='>=', $strict=true) 87 { 88 if ($strict) { 89 $current_version = preg_replace('!-r(\d+)$!', '-p$1', $current_version); 90 $required_version = preg_replace('!-r(\d+)$!', '-p$1', $required_version); 91 } 92 else { 93 $current_version = preg_replace('/^([0-9\.]+)(.*?)$/', '$1', $current_version); 94 $required_version = preg_replace('/^([0-9\.]+)(.*?)$/', '$1', $required_version); 95 } 96 97 return (boolean) version_compare($current_version, $required_version, $operator); 98 } 76 99 } 77 100
Note: See TracChangeset
for help on using the changeset viewer.