Changeset 26591
- Timestamp:
- Jan 9, 2014, 10:22:13 PM (10 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r26461 r26591 2090 2090 } 2091 2091 2092 /** 2093 * Compare two versions with version_compare after having converted 2094 * single chars to their decimal values. 2095 * Needed because version_compare does not understand versions like '2.5.c'. 2096 * @since 2.6 2097 * 2098 * @param string $a 2099 * @param string $b 2100 * @param string $op 2101 */ 2102 function safe_version_compare($a, $b, $op=null) 2103 { 2104 $replace_chars = create_function('$m', 'return ord(strtolower($m[1]));'); 2105 2106 // add dot before groups of letters (version_compare does the same thing) 2107 $a = preg_replace('#([0-9]+)([a-z]+)#i', '$1.$2', $a); 2108 $b = preg_replace('#([0-9]+)([a-z]+)#i', '$1.$2', $b); 2109 2110 // apply ord() to any single letter 2111 $a = preg_replace_callback('#\b([a-z]{1})\b#i', $replace_chars, $a); 2112 $b = preg_replace_callback('#\b([a-z]{1})\b#i', $replace_chars, $b); 2113 2114 if (empty($op)) 2115 { 2116 return version_compare($a, $b); 2117 } 2118 else 2119 { 2120 return version_compare($a, $b, $op); 2121 } 2122 } 2123 2092 2124 ?> -
trunk/include/functions_plugins.inc.php
r26461 r26591 79 79 80 80 if ( $version == 'auto' or $current_version == 'auto' 81 or version_compare($current_version, $version, '<')81 or safe_version_compare($current_version, $version, '<') 82 82 ) 83 83 { … … 145 145 146 146 if ( $version == 'auto' or $current_version == 'auto' 147 or version_compare($current_version, $version, '<')147 or safe_version_compare($current_version, $version, '<') 148 148 ) 149 149 {
Note: See TracChangeset
for help on using the changeset viewer.