The branch, master has been updated via 846ce15039403ae5db9da04fff4302c00850a1d0 (commit) from f7ffcf89752a742c29dcb411b2006bf334867093 (commit)
- Log ----------------------------------------------------------------- commit 846ce15039403ae5db9da04fff4302c00850a1d0 Author: Madhura Jayaratne madhuracj@users.sourceforge.net Date: Tue Apr 13 13:54:25 2010 +0200
[engines] Fix parsing of PBXT status.
-----------------------------------------------------------------------
Summary of changes: ChangeLog | 1 + libraries/StorageEngine.class.php | 17 ++++++++++++++++- libraries/common.lib.php | 23 ++++++++++++++++++++++- libraries/engines/pbxt.lib.php | 14 ++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 9e868eb..5577727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -66,6 +66,7 @@ $Id$ + patch #2984337 [interface] Convert loading of export/import to jQuery ready event, thanks to sutharshan. - [edit] CURRENT_TIMESTAMP is also valid for datetime fields. +- patch #2985068 [engines] Fix parsing of PBXT status, thanks to Madhura Jayaratne.
3.3.3.0 (not yet released) - patch #2982480 [navi] Do not group if there would be one table in group, diff --git a/libraries/StorageEngine.class.php b/libraries/StorageEngine.class.php index d03f40a..af0da1a 100644 --- a/libraries/StorageEngine.class.php +++ b/libraries/StorageEngine.class.php @@ -178,7 +178,7 @@ class PMA_StorageEngine . ' <td class="value">'; switch ($details['type']) { case PMA_ENGINE_DETAILS_TYPE_SIZE: - $parsed_size = PMA_formatByteDown($details['value']); + $parsed_size = $this->resolveTypeSize($details['value']); $ret .= $parsed_size[0] . ' ' . $parsed_size[1]; unset($parsed_size); break; @@ -204,6 +204,21 @@ class PMA_StorageEngine return $ret; }
+ /** + * returns the engine specific handling for + * PMA_ENGINE_DETAILS_TYPE_SIZE type variables. + * + * This function should be overridden when + * PMA_ENGINE_DETAILS_TYPE_SIZE type needs to be + * handled differently for a particular engine. + * + * @return string the formatted value and its unit + */ + function resolveTypeSize($value) + { + return PMA_formatByteDown($value); + } + /** * returns array with detailed info about engine specific server variables * diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 97e7f85..fea6840 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1271,7 +1271,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view PMA_profilingCheckbox($sql_query); } $inline_edit = "<script type="text/javascript">\n" . - "//<![CDATA[\n" . + "//<![CDATA[\n" . "document.write('[<a href="#" title="" . PMA_escapeJsString(__('Inline edit of this query')) . "" id="inline_edit">" . @@ -1504,6 +1504,27 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false) } // end of the 'PMA_formatNumber' function
/** + * Returns the number of bytes when a formatted size is given + * + * @param double $value the value that should be converted to bytes + * @uses PMA_pow() + * @return integer The number of bytes corresponding to the formatted size given + */ +function PMA_getBytes($value) +{ + $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); + } + return $return_value; +}// end of the 'PMA_getBytes' function + +/** * Writes localised date * * @param string the current timestamp diff --git a/libraries/engines/pbxt.lib.php b/libraries/engines/pbxt.lib.php index 777068a..db40713 100644 --- a/libraries/engines/pbxt.lib.php +++ b/libraries/engines/pbxt.lib.php @@ -81,6 +81,20 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine ), ); } + + /** + * returns the pbxt engine specific handling for + * PMA_ENGINE_DETAILS_TYPE_SIZE variables. + * + * @return string the formatted value and its unit + */ + function resolveTypeSize($value) + { + if (preg_match('/^[0-9]+[a-zA-Z]+$/', $value)){ + $value = PMA_getBytes($value); + } + return PMA_formatByteDown($value); + } }
?>
hooks/post-receive