mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 13:30:25 +02:00
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
This commit is contained in:
@@ -619,6 +619,34 @@ function phpbb_email_hash($email)
|
||||
return sprintf('%u', crc32(strtolower($email))) . strlen($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
|
||||
*
|
||||
|
Reference in New Issue
Block a user