Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorMichal Čihař <mcihar@suse.cz>2013-07-12 12:39:14 +0400
committerMichal Čihař <mcihar@suse.cz>2013-07-12 12:54:01 +0400
commitfc163bb51273f6a7a66e04c26d75158e8b78c739 (patch)
tree06dc8b3ea0102edc17602d6ce4fb0eb6305be587 /setup
parente11f562be4c205895701b46bb82bdb978531c265 (diff)
Move version parsing to Util class
Diffstat (limited to 'setup')
-rw-r--r--setup/lib/index.lib.php53
1 files changed, 2 insertions, 51 deletions
diff --git a/setup/lib/index.lib.php b/setup/lib/index.lib.php
index 4a7ab40dab..1d930becff 100644
--- a/setup/lib/index.lib.php
+++ b/setup/lib/index.lib.php
@@ -123,7 +123,7 @@ function PMA_version_check()
$version = $version_data->version;
$date = $version_data->date;
- $version_upstream = version_to_int($version);
+ $version_upstream = PMA_Util::versionToInt($version);
if ($version_upstream === false) {
messages_set(
'error',
@@ -134,7 +134,7 @@ function PMA_version_check()
return;
}
- $version_local = version_to_int($GLOBALS['PMA_Config']->get('PMA_VERSION'));
+ $version_local = PMA_Util::versionToInt($GLOBALS['PMA_Config']->get('PMA_VERSION'));
if ($version_local === false) {
messages_set(
'error',
@@ -174,55 +174,6 @@ function PMA_version_check()
}
/**
- * Calculates numerical equivalent of phpMyAdmin version string
- *
- * @param string $version version
- *
- * @return mixed false on failure, integer on success
- */
-function version_to_int($version)
-{
- $matches = array();
- if (!preg_match('/^(\d+)\.(\d+)\.(\d+)((\.|-(pl|rc|dev|beta|alpha))(\d+)?(-dev)?)?$/', $version, $matches)) {
- return false;
- }
- if (!empty($matches[6])) {
- switch ($matches[6]) {
- case 'pl':
- $added = 60;
- break;
- case 'rc':
- $added = 30;
- break;
- case 'beta':
- $added = 20;
- break;
- case 'alpha':
- $added = 10;
- break;
- case 'dev':
- $added = 0;
- break;
- default:
- messages_set(
- 'notice',
- 'version_match',
- __('Version check'),
- 'Unknown version part: ' . htmlspecialchars($matches[6])
- );
- $added = 0;
- break;
- }
- } else {
- $added = 50; // for final
- }
- if (!empty($matches[7])) {
- $added = $added + $matches[7];
- }
- return $matches[1] * 1000000 + $matches[2] * 10000 + $matches[3] * 100 + $added;
-}
-
-/**
* Checks whether config file is readable/writable
*
* @param bool &$is_readable