The branch, master has been updated
via 05e4e16b8a70d5a9d1f21a659f19ee5f55bfba36 (commit)
from da979369c859557a6ab5510f399fe2b14bc19103 (commit)
- Log -----------------------------------------------------------------
commit 05e4e16b8a70d5a9d1f21a659f19ee5f55bfba36
Author: Marc Delisle <marc(a)infomarc.info>
Date: Tue Apr 13 08:51:07 2010 -0400
Improve function and variables names
-----------------------------------------------------------------------
Summary of changes:
libraries/common.lib.php | 20 ++++++++++----------
libraries/engines/pbxt.lib.php | 10 +++++++---
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index e4a00d2..f8dcc60 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -1506,23 +1506,23 @@ function PMA_formatNumber($value, $length = 3, $comma = 0,
$only_down = false)
/**
* Returns the number of bytes when a formatted size is given
*
- * @param double $value the value that should be converted to bytes
+ * @param string $size the size expression (for example 8MB)
* @uses PMA_pow()
- * @return integer The number of bytes corresponding to the formatted size given
+ * @return integer The numerical part of the expression (for example 8)
*/
-function PMA_getBytes($value)
+function PMA_extractValueFromFormattedSize($formatted_size)
{
$return_value = -1;
- if (preg_match('/^[0-9]+GB$/', $value)) {
- $return_value = substr($value, 0, -2) * PMA_pow(1024, 3);
- } elseif (preg_match('/^[0-9]+MB$/', $value)) {
- $return_value = substr($value, 0, -2) * PMA_pow(1024, 2);
- } elseif (preg_match('/^[0-9]+K$/', $value)) {
- $return_value = substr($value, 0, -1) * PMA_pow(1024, 1);
+ if (preg_match('/^[0-9]+GB$/', $formatted_size)) {
+ $return_value = substr($formatted_size, 0, -2) * PMA_pow(1024, 3);
+ } elseif (preg_match('/^[0-9]+MB$/', $formatted_size)) {
+ $return_value = substr($formatted_size, 0, -2) * PMA_pow(1024, 2);
+ } elseif (preg_match('/^[0-9]+K$/', $formatted_size)) {
+ $return_value = substr($formatted_size, 0, -1) * PMA_pow(1024, 1);
}
return $return_value;
-}// end of the 'PMA_getBytes' function
+}// end of the 'PMA_extractValueFromFormattedSize' function
/**
* Writes localised date
diff --git a/libraries/engines/pbxt.lib.php b/libraries/engines/pbxt.lib.php
index db40713..0642539 100644
--- a/libraries/engines/pbxt.lib.php
+++ b/libraries/engines/pbxt.lib.php
@@ -86,12 +86,16 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine
* returns the pbxt engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE variables.
*
+ * @param string $formatted_size the size expression (for example 8MB)
+ *
* @return string the formatted value and its unit
*/
- function resolveTypeSize($value)
+ function resolveTypeSize($formatted_size)
{
- if (preg_match('/^[0-9]+[a-zA-Z]+$/', $value)){
- $value = PMA_getBytes($value);
+ if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)){
+ $value = PMA_extractValueFromFormattedSize($formatted_size);
+ } else {
+ $value = $formatted_size;
}
return PMA_formatByteDown($value);
}
hooks/post-receive
--
phpMyAdmin