diff options
author | Andreas Fischer <bantu@phpbb.com> | 2011-07-13 02:33:29 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2011-07-13 02:33:29 +0200 |
commit | f926acf1b870a6dddcdfb25ee77bb25ec58e3ec0 (patch) | |
tree | 0a43869d32cd2faf46ee00e7b3858811293db726 | |
parent | e4707a8be75263e610b00b3d600144e797f576d9 (diff) | |
download | forums-f926acf1b870a6dddcdfb25ee77bb25ec58e3ec0.tar forums-f926acf1b870a6dddcdfb25ee77bb25ec58e3ec0.tar.gz forums-f926acf1b870a6dddcdfb25ee77bb25ec58e3ec0.tar.bz2 forums-f926acf1b870a6dddcdfb25ee77bb25ec58e3ec0.tar.xz forums-f926acf1b870a6dddcdfb25ee77bb25ec58e3ec0.zip |
[ticket/10263] Add wrapper for version_compare() that allows the use of A and B
Add wrapper function for version_compare() that allows using uppercase A and B
for alpha and beta release version strings.
PHPBB3-10263
-rw-r--r-- | phpBB/includes/functions.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b1c1c14d0c..a926095004 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -599,6 +599,34 @@ function phpbb_email_hash($email) } /** +* Wrapper for version_compare() that allows using uppercase A and B +* for alpha and beta releases. +* +* See http://www.php.net/manual/en/function.version-compare.php +* +* @param string $version1 First version number +* @param string $version2 Second version number +* @param string $operator Comparison operator (optional) +* +* @return mixed Integer (-1, 0, 1) if comparison operator is specified. +* Boolean (true, false) otherwise. +*/ +function phpbb_version_compare($version1, $version2, $operator = null) +{ + $version1 = strtolower($version1); + $version2 = strtolower($version2); + + if (is_null($operator)) + { + return version_compare($version1, $version2); + } + else + { + return version_compare($version1, $version2, $operator); + } +} + +/** * Global function for chmodding directories and files for internal use * * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. |