diff options
author | Nils Adermann <naderman@naderman.de> | 2011-07-16 22:21:49 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-07-16 22:21:49 -0400 |
commit | 82fa4eff7ebcc10b808de9dacb7520ad0d2e1df1 (patch) | |
tree | e107bdad4072b3dd8c747f1aab4ba6e2df1db5f7 /phpBB/includes/functions.php | |
parent | 825d44fcc2b384729a8eb0c941c5d3509f967e4c (diff) | |
parent | 7f56c05f2450dbf33e48d2c1b9885353ddd58beb (diff) | |
download | forums-82fa4eff7ebcc10b808de9dacb7520ad0d2e1df1.tar forums-82fa4eff7ebcc10b808de9dacb7520ad0d2e1df1.tar.gz forums-82fa4eff7ebcc10b808de9dacb7520ad0d2e1df1.tar.bz2 forums-82fa4eff7ebcc10b808de9dacb7520ad0d2e1df1.tar.xz forums-82fa4eff7ebcc10b808de9dacb7520ad0d2e1df1.zip |
Merge remote-tracking branch 'github-bantu/ticket/10263' into develop-olympus
* github-bantu/ticket/10263:
[ticket/10263] Call phpbb_version_compare() from includes/acp/acp_main.php
[ticket/10263] Call phpbb_version_compare() from includes/acp/acp_update.php
[ticket/10263] Adding unit tests for phpbb_version_compare().
[ticket/10263] Add wrapper for version_compare() that allows the use of A and B
Diffstat (limited to 'phpBB/includes/functions.php')
-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 86eab4666f..83e56caedc 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -620,6 +620,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. |