Git
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2011
- 8 participants
- 476 discussions

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12955-ga2fc059
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via a2fc059f985b681b72c4f6e43ef680c0901ed833 (commit)
from 1369bf2c4330ebc57da869428ae747a2903642cb (commit)
- Log -----------------------------------------------------------------
commit a2fc059f985b681b72c4f6e43ef680c0901ed833
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:39:45 2011 +0200
Fix syntax error
-----------------------------------------------------------------------
Summary of changes:
libraries/header_http.inc.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libraries/header_http.inc.php b/libraries/header_http.inc.php
index c30316d..3b32915 100644
--- a/libraries/header_http.inc.php
+++ b/libraries/header_http.inc.php
@@ -24,7 +24,7 @@ if (!$GLOBALS['cfg']['AllowThirdPartyFraming']) {
header('X-Frame-Options: SAMEORIGIN');
header('X-Content-Security-Policy: allow \'self\'; options inline-script eval-script; frame-ancestors \'self\'; img-src \'self\' data:; script-src \'self\' www.phpmyadmin.net');
}
-PMA_no_cache_header()
+PMA_no_cache_header();
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
// Define the charset to be used
header('Content-Type: text/html; charset=utf-8');
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12954-g1369bf2
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via 1369bf2c4330ebc57da869428ae747a2903642cb (commit)
via b4a2dc7196347d891a1b2d0a397052c1a860c3d6 (commit)
via bbaeb8922bcc7ee70232c375358b7fe530a11313 (commit)
via 6196970dc26de011646a581044dbf05d95400c67 (commit)
via 2283b016bb597ab70e557ae0f2ac18c64b473faa (commit)
via 6ef6ab3d79e74dcd58de6207d867e20a67403701 (commit)
via cb337bbb02b41f4b99123dc6b9035a4ca4e0282c (commit)
via 7281d04793978b1954128ef6f74ecddfc46f547b (commit)
via 1a5154bd876edf2b703c7eebfa6650a4f242c33d (commit)
via d6c2dfb51b1a2977ad03033cdfe5c74709313f9c (commit)
via eeb54e007b4d51269e6d3a31578bb92ac5bae21c (commit)
via 045f59c78a7aa74efa002b17044996309d93d41d (commit)
via 1031bf2df83d0fc8e1a5790d6ff64448d4e4579b (commit)
via 5b568db10fa5629ac5eea30de71b9e1dcc6e7fa7 (commit)
via e7db079b819461bed60cdc69a4bb972e704cc630 (commit)
via aa5156463bf75cfaf3a0a49deabe8cf03ae8c379 (commit)
via 34da1ea053e35723a2d22e25360bbb6ab3866e49 (commit)
via c79fc30debdfc23c5d65b8a8c43f16d0899cee2e (commit)
via b68145bf88e607734a73bee845486635393c3d03 (commit)
via 7afe37b0a535fa7069ac26d0e415442aada65bf6 (commit)
via 69a69a5fb85742c026cb3b42cbde8c63939057b8 (commit)
via 5d05da19f20f098bb71fad429f7ca56944a27d85 (commit)
via b9f1fe6bfa858f4a9ed6bef78da379e61ddf277c (commit)
via 350157c5523d6e72f4b326c1bd8b9f31b8a5d22d (commit)
via 66f9667a61d2fdc269cd07a5bb2ed990ab2c46cf (commit)
via 17689a2df4a4d1239bfba8911f6badbe36ce13be (commit)
from b9a7ac74251c490c67dae063e3cf4bb637cce288 (commit)
- Log -----------------------------------------------------------------
commit 1369bf2c4330ebc57da869428ae747a2903642cb
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:38:59 2011 +0200
Document weirdness
commit b4a2dc7196347d891a1b2d0a397052c1a860c3d6
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:38:07 2011 +0200
Use new function for download headers
commit bbaeb8922bcc7ee70232c375358b7fe530a11313
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:37:42 2011 +0200
Use new function for download headers
commit 6196970dc26de011646a581044dbf05d95400c67
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:36:01 2011 +0200
Use new function for no cache headers
commit 2283b016bb597ab70e557ae0f2ac18c64b473faa
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:35:36 2011 +0200
Use HTTP/1.1 for all browsers
commit 6ef6ab3d79e74dcd58de6207d867e20a67403701
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:33:11 2011 +0200
Add some comments
commit cb337bbb02b41f4b99123dc6b9035a4ca4e0282c
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:32:02 2011 +0200
Use new function for no cache headers
commit 7281d04793978b1954128ef6f74ecddfc46f547b
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:31:32 2011 +0200
Factor out no caching headers
commit 1a5154bd876edf2b703c7eebfa6650a4f242c33d
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:29:56 2011 +0200
Use new function for download headers
commit d6c2dfb51b1a2977ad03033cdfe5c74709313f9c
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:28:23 2011 +0200
Use new function for download headers
commit eeb54e007b4d51269e6d3a31578bb92ac5bae21c
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:27:44 2011 +0200
Use new function for download headers
commit 045f59c78a7aa74efa002b17044996309d93d41d
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:26:47 2011 +0200
Use new function for download headers
commit 1031bf2df83d0fc8e1a5790d6ff64448d4e4579b
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:25:45 2011 +0200
Use new function for download headers
commit 5b568db10fa5629ac5eea30de71b9e1dcc6e7fa7
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:24:57 2011 +0200
Use new function for download headers
commit e7db079b819461bed60cdc69a4bb972e704cc630
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:24:15 2011 +0200
Use predefined PHP constant for date instead of manually defining format
commit aa5156463bf75cfaf3a0a49deabe8cf03ae8c379
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:22:41 2011 +0200
Allow spaces in filename
commit 34da1ea053e35723a2d22e25360bbb6ab3866e49
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:22:05 2011 +0200
Use new function for download headers
commit c79fc30debdfc23c5d65b8a8c43f16d0899cee2e
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:21:27 2011 +0200
Use new function for download headers
commit b68145bf88e607734a73bee845486635393c3d03
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:21:01 2011 +0200
Use new function for download headers
commit 7afe37b0a535fa7069ac26d0e415442aada65bf6
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:20:32 2011 +0200
Use new function for download headers
commit 69a69a5fb85742c026cb3b42cbde8c63939057b8
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:19:53 2011 +0200
Use new function for download headers
commit 5d05da19f20f098bb71fad429f7ca56944a27d85
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:19:07 2011 +0200
Use new function for download headers
commit b9f1fe6bfa858f4a9ed6bef78da379e61ddf277c
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:18:32 2011 +0200
Include no caching headers
commit 350157c5523d6e72f4b326c1bd8b9f31b8a5d22d
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:17:18 2011 +0200
Use generic function for download headers
commit 66f9667a61d2fdc269cd07a5bb2ed990ab2c46cf
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:17:07 2011 +0200
Generic function for sending download headers
commit 17689a2df4a4d1239bfba8911f6badbe36ce13be
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:12:09 2011 +0200
Coding style
-----------------------------------------------------------------------
Summary of changes:
bs_disp_as_mime_type.php | 9 +----
export.php | 20 +----------
file_echo.php | 29 ++++++---------
import_status.php | 3 +-
libraries/core.lib.php | 43 +++++++++++++++++++++-
libraries/gis/pma_gis_visualization.php | 11 +-----
libraries/header_http.inc.php | 5 +--
libraries/schema/Dia_Relation_Schema.class.php | 3 +-
libraries/schema/Eps_Relation_Schema.class.php | 3 +-
libraries/schema/Pdf_Relation_Schema.class.php | 4 +--
libraries/schema/Svg_Relation_Schema.class.php | 3 +-
libraries/schema/Visio_Relation_Schema.class.php | 3 +-
prefs_manage.php | 4 +--
setup/config.php | 3 +-
show_config_errors.php | 5 +--
tbl_get_field.php | 14 +-------
tbl_tracking.php | 25 ++++---------
transformation_wrapper.php | 11 +++---
webapp.php | 3 +-
19 files changed, 83 insertions(+), 118 deletions(-)
diff --git a/bs_disp_as_mime_type.php b/bs_disp_as_mime_type.php
index 9ec0ec5..fd75c4d 100644
--- a/bs_disp_as_mime_type.php
+++ b/bs_disp_as_mime_type.php
@@ -43,14 +43,7 @@ if ($fHnd === false) {
$f_size = $hdrs['Content-Length'];
-header("Expires: 0");
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-header("Cache-Control: no-store, no-cache, must-revalidate");
-header("Cache-Control: post-check=0, pre-check=0", false);
-header("Pragma: no-cache");
-header("Content-type: $c_type");
-header('Content-length: ' . $f_size);
-header("Content-disposition: attachment; filename=" . basename($filename));
+PMA_download_header(basename($filename), $c_type, true, $f_size);
$pos = 0;
$content = "";
diff --git a/export.php b/export.php
index d7c2f87..3678924 100644
--- a/export.php
+++ b/export.php
@@ -347,25 +347,7 @@ if (!$save_on_server) {
// this was reported to happen under Plesk)
@ini_set('url_rewriter.tags','');
- header('Content-Type: ' . $mime_type);
- header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- // Tested behavior of
- // IE 5.50.4807.2300
- // IE 6.0.2800.1106 (small glitch, asks twice when I click Open)
- // IE 6.0.2900.2180
- // Firefox 1.0.6
- // in http and https
- header('Content-Disposition: attachment; filename="' . $filename . '"');
- if (PMA_USR_BROWSER_AGENT == 'IE') {
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
- } else {
- header('Pragma: no-cache');
- // test case: exporting a database into a .gz file with Safari
- // would produce files not having the current time
- // (added this header for Safari but should not harm other browsers)
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- }
+ PMA_download_header($filename, $mime_type);
} else {
// HTML
if ($export_type == 'database') {
diff --git a/file_echo.php b/file_echo.php
index da8baa0..d2f7257 100644
--- a/file_echo.php
+++ b/file_echo.php
@@ -1,7 +1,8 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
- * "Echo" service to allow force downloading of exported charts (png or svg) and server status monitor settings
+ * "Echo" service to allow force downloading of exported charts (png or svg)
+ * and server status monitor settings
*
* @package phpMyAdmin
*/
@@ -11,23 +12,27 @@ require_once './libraries/common.inc.php';
if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
$allowed = Array( 'image/png'=>'png', 'image/svg+xml'=>'svg');
- if (! isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
+ if (! isset($allowed[$_REQUEST['type']])) {
+ exit('Invalid export type');
+ }
- if (! preg_match("/(".implode("|",$allowed).")$/i", $_REQUEST['filename']))
+ if (! preg_match("/(".implode("|",$allowed).")$/i", $_REQUEST['filename'])) {
$_REQUEST['filename'] .= '.' . $allowed[$_REQUEST['type']];
+ }
- downloadHeader($_REQUEST['filename'],$_REQUEST['type']);
+ PMA_download_header($_REQUEST['filename'], $_REQUEST['type']);
- if ($allowed[$_REQUEST['type']] != 'svg')
+ if ($allowed[$_REQUEST['type']] != 'svg') {
echo base64_decode(substr($_REQUEST['image'], strpos($_REQUEST['image'],',') + 1));
- else
+ } else {
echo $_REQUEST['image'];
+ }
exit();
}
if(isset($_REQUEST['monitorconfig'])) {
- downloadHeader('monitor.cfg','application/force-download');
+ PMA_download_header('monitor.cfg', 'application/force-download');
echo urldecode($_REQUEST['monitorconfig']);
exit();
}
@@ -36,14 +41,4 @@ if(isset($_REQUEST['import'])) {
echo '<html><body>' . file_get_contents($_FILES['file']['tmp_name']) . '</body></html>';
exit();
}
-
-exit('Invalid request');
-
-function downloadHeader($file,$type) {
- header("Cache-Control: public");
- header("Content-Description: File Transfer");
- header("Content-Disposition: attachment; filename=".$file);
- header("Content-Type: ".$type);
- header("Content-Transfer-Encoding: binary");
-}
?>
diff --git a/import_status.php b/import_status.php
index 7c77e31..75a3361 100644
--- a/import_status.php
+++ b/import_status.php
@@ -9,8 +9,7 @@ require_once './libraries/common.inc.php';
require_once './libraries/display_import_ajax.lib.php';
// AJAX requests can't be cached!
-header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
-header("Expires: Sat, 11 Jan 1991 06:30:00 GMT"); // Date in the past
+PMA_no_cache_header();
// $GLOBALS["message"] is used for asking for an import message
if (isset($GLOBALS["message"]) && $GLOBALS["message"]) {
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index bb542ba..fd8c39a 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -224,7 +224,7 @@ function PMA_fatalError($error_message, $message_args = null)
}
require('./libraries/error.inc.php');
-
+
if (!defined('TESTSUITE')) {
exit;
}
@@ -538,6 +538,47 @@ function PMA_sendHeaderLocation($uri)
}
/**
+ * Outputs headers to prevent caching in browser (and on the way).
+ */
+function PMA_no_cache_header()
+{
+ header('Expires: ' . date(DATE_RFC1123)); // rfc2616 - Section 14.21
+ header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
+ if (PMA_USR_BROWSER_AGENT == 'IE') {
+ /* FIXME: Why is this speecial case for IE needed? */
+ header('Pragma: public');
+ } else {
+ header('Pragma: no-cache'); // HTTP/1.0
+ // test case: exporting a database into a .gz file with Safari
+ // would produce files not having the current time
+ // (added this header for Safari but should not harm other browsers)
+ header('Last-Modified: ' . date(DATE_RFC1123));
+ }
+}
+
+
+/**
+ * Sends header indicating file download.
+ *
+ * @param $filename string Filename to include in headers.
+ * @param $mimetype string MIME type to include in headers.
+ * @return nothing
+ */
+function PMA_download_header($filename, $mimetype, $avoid_cache = true, $length = 0) {
+ if ($avoid_cache) {
+ PMA_no_cache_header();
+ }
+ header('Content-Description: File Transfer');
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
+ header('Content-Type: ' . $mimetype);
+ header('Content-Transfer-Encoding: binary');
+ if ($length > 0) {
+ header('Content-Length: ' . $length);
+ }
+}
+
+
+/**
* Returns value of an element in $array given by $path.
* $path is a string describing position of an element in an associative array,
* eg. Servers/1/host refers to $array[Servers][1][host]
diff --git a/libraries/gis/pma_gis_visualization.php b/libraries/gis/pma_gis_visualization.php
index d8da0d7..2817a23 100644
--- a/libraries/gis/pma_gis_visualization.php
+++ b/libraries/gis/pma_gis_visualization.php
@@ -134,16 +134,7 @@ class PMA_GIS_Visualization
ob_clean();
- header('Content-type: ' . $type);
- header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Content-Disposition: Attachment;filename=' . $file_name);
- if (PMA_USR_BROWSER_AGENT == 'IE') {
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
- } else {
- header('Pragma: no-cache');
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- }
+ PMA_download_header($file_name, $type);
}
/**
diff --git a/libraries/header_http.inc.php b/libraries/header_http.inc.php
index f9d7d71..c30316d 100644
--- a/libraries/header_http.inc.php
+++ b/libraries/header_http.inc.php
@@ -24,10 +24,7 @@ if (!$GLOBALS['cfg']['AllowThirdPartyFraming']) {
header('X-Frame-Options: SAMEORIGIN');
header('X-Content-Security-Policy: allow \'self\'; options inline-script eval-script; frame-ancestors \'self\'; img-src \'self\' data:; script-src \'self\' www.phpmyadmin.net');
}
-header('Expires: ' . $GLOBALS['now']); // rfc2616 - Section 14.21
-header('Last-Modified: ' . $GLOBALS['now']);
-header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
-header('Pragma: no-cache'); // HTTP/1.0
+PMA_no_cache_header()
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
// Define the charset to be used
header('Content-Type: text/html; charset=utf-8');
diff --git a/libraries/schema/Dia_Relation_Schema.class.php b/libraries/schema/Dia_Relation_Schema.class.php
index bccf214..46e07d3 100644
--- a/libraries/schema/Dia_Relation_Schema.class.php
+++ b/libraries/schema/Dia_Relation_Schema.class.php
@@ -170,8 +170,7 @@ class PMA_DIA extends XMLWriter
if(ob_get_clean()){
ob_end_clean();
}
- header('Content-type: application/x-dia-diagram');
- header('Content-Disposition: attachment; filename="'.$fileName.'.dia"');
+ PMA_download_header($fileName . '.dia', 'application/x-dia-diagram');
$output = $this->flush();
print $output;
}
diff --git a/libraries/schema/Eps_Relation_Schema.class.php b/libraries/schema/Eps_Relation_Schema.class.php
index 50ea7e3..91e4bfa 100644
--- a/libraries/schema/Eps_Relation_Schema.class.php
+++ b/libraries/schema/Eps_Relation_Schema.class.php
@@ -333,8 +333,7 @@ class PMA_EPS
// if(ob_get_clean()){
//ob_end_clean();
//}
- header('Content-type: image/x-eps');
- header('Content-Disposition: attachment; filename="'.$fileName.'.eps"');
+ PMA_download_header($fileName . '.eps', 'image/x-eps');
$output = $this->stringCommands;
print $output;
}
diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php
index abdcf6c..68efc28 100644
--- a/libraries/schema/Pdf_Relation_Schema.class.php
+++ b/libraries/schema/Pdf_Relation_Schema.class.php
@@ -1068,9 +1068,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
}
// instead of $pdf->Output():
$pdfData = $pdf->getPDFData();
- header('Content-Type: application/pdf');
- header('Content-Length: '.strlen($pdfData).'');
- header('Content-disposition: attachment; filename="'.$filename.'"');
+ PMA_download_header($filename, 'application/pdf');
echo $pdfData;
}
diff --git a/libraries/schema/Svg_Relation_Schema.class.php b/libraries/schema/Svg_Relation_Schema.class.php
index c845efe..71f93c6 100644
--- a/libraries/schema/Svg_Relation_Schema.class.php
+++ b/libraries/schema/Svg_Relation_Schema.class.php
@@ -168,8 +168,7 @@ class PMA_SVG extends XMLWriter
function showOutput($fileName)
{
//ob_get_clean();
- header('Content-type: image/svg+xml');
- header('Content-Disposition: attachment; filename="'.$fileName.'.svg"');
+ PMA_download_header($fileName . '.svg', 'image/svg+xml');
$output = $this->flush();
print $output;
}
diff --git a/libraries/schema/Visio_Relation_Schema.class.php b/libraries/schema/Visio_Relation_Schema.class.php
index 011e73e..aa18c06 100644
--- a/libraries/schema/Visio_Relation_Schema.class.php
+++ b/libraries/schema/Visio_Relation_Schema.class.php
@@ -155,8 +155,7 @@ class PMA_VISIO extends XMLWriter
//if(ob_get_clean()){
//ob_end_clean();
//}
- header('Content-type: application/visio');
- header('Content-Disposition: attachment; filename="'.$fileName.'.vdx"');
+ PMA_download_header($fileName . '.vdx', 'application/visio');
$output = $this->flush();
print $output;
}
diff --git a/prefs_manage.php b/prefs_manage.php
index ec1b481..000cce4 100644
--- a/prefs_manage.php
+++ b/prefs_manage.php
@@ -24,9 +24,7 @@ $error = '';
if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == 'text_file') {
// export to JSON file
$filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
- header('Content-Type: application/json');
- header('Content-Disposition: attachment; filename="' . $filename . '"');
- header('Expires: ' . date(DATE_RFC1123));
+ PMA_download_header($filename, 'application/json');
$settings = PMA_load_userprefs();
echo json_encode($settings['config_data']);
return;
diff --git a/setup/config.php b/setup/config.php
index 5333cb0..b90d24c 100644
--- a/setup/config.php
+++ b/setup/config.php
@@ -38,8 +38,7 @@ if (PMA_ifSetOr($_POST['submit_clear'], '')) {
//
// Output generated config file
//
- header('Content-Type: text/plain');
- header('Content-Disposition: attachment; filename="config.inc.php"');
+ PMA_download_header('config.inc.php', 'text/plain');
echo ConfigGenerator::getConfigFile();
exit;
} elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
diff --git a/show_config_errors.php b/show_config_errors.php
index 09a286f..e163c42 100644
--- a/show_config_errors.php
+++ b/show_config_errors.php
@@ -7,10 +7,7 @@
*/
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
-header('Expires: ' . $GLOBALS['now']); // rfc2616 - Section 14.21
-header('Last-Modified: ' . $GLOBALS['now']);
-header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
-header('Pragma: no-cache'); // HTTP/1.0
+PMA_no_cache_header();
header('Content-Type: text/html; charset=utf-8');
require './libraries/vendor_config.php';
diff --git a/tbl_get_field.php b/tbl_get_field.php
index a58eb51..8c6c163 100644
--- a/tbl_get_field.php
+++ b/tbl_get_field.php
@@ -37,18 +37,6 @@ if ($result === false) {
/* Avoid corrupting data */
@ini_set('url_rewriter.tags', '');
-header('Content-Type: ' . PMA_detectMIME($result));
-header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
-header('Content-Disposition: attachment; filename="' . $table . '-' . $transform_key . '.bin"');
-if (PMA_USR_BROWSER_AGENT == 'IE') {
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
-} else {
- header('Pragma: no-cache');
- // test case: exporting a database into a .gz file with Safari
- // would produce files not having the current time
- // (added this header for Safari but should not harm other browsers)
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
-}
+PMA_download_header($table . '-' . $transform_key . '.bin', PMA_detectMIME($result));
echo $result;
?>
diff --git a/tbl_tracking.php b/tbl_tracking.php
index e308066..445976f 100644
--- a/tbl_tracking.php
+++ b/tbl_tracking.php
@@ -112,16 +112,7 @@ if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldumpfil
$dump .= $entry['statement'];
}
$filename = 'log_' . htmlspecialchars($_REQUEST['table']) . '.sql';
- header('Content-Type: text/x-sql');
- header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Content-Disposition: attachment; filename="' . $filename . '"');
- if (PMA_USR_BROWSER_AGENT == 'IE') {
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
- } else {
- header('Pragma: no-cache');
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- }
+ PMA_download_header($filename, 'text/x-sql');
echo $dump;
exit();
@@ -370,14 +361,14 @@ if (isset($_REQUEST['snapshot'])) {
if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_REQUEST['delete_dmlog']))) {
if (isset($_REQUEST['delete_ddlog'])) {
-
+
// Delete ddlog row data
$delete_id = $_REQUEST['delete_ddlog'];
-
+
// Only in case of valable id
if ($delete_id == (int)$delete_id) {
unset($data['ddlog'][$delete_id]);
-
+
if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DDL', $data['ddlog']))
$msg = PMA_Message::success(__('Tracking data definition successfully deleted'));
else
@@ -387,14 +378,14 @@ if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_R
}
if (isset($_REQUEST['delete_dmlog'])) {
-
+
// Delete dmlog row data
$delete_id = $_REQUEST['delete_dmlog'];
-
+
// Only in case of valable id
if ($delete_id == (int)$delete_id) {
unset($data['dmlog'][$delete_id]);
-
+
if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DML', $data['dmlog']))
$msg = PMA_Message::success(__('Tracking data manipulation successfully deleted'));
else
@@ -403,7 +394,7 @@ if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_R
}
}
}
-
+
if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) {
?>
<h3><?php echo __('Tracking report');?> [<a href="tbl_tracking.php?<?php echo $url_query;?>"><?php echo __('Close');?></a>]</h3>
diff --git a/transformation_wrapper.php b/transformation_wrapper.php
index f229bd3..577a435 100644
--- a/transformation_wrapper.php
+++ b/transformation_wrapper.php
@@ -61,16 +61,17 @@ if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
require_once './libraries/header_http.inc.php';
// [MIME]
if (isset($ct) && !empty($ct)) {
- $content_type = 'Content-Type: ' . $ct;
+ $mime_type = $ct;
} else {
- $content_type = 'Content-Type: ' . (isset($mime_map[$transform_key]['mimetype']) ? str_replace('_', '/', $mime_map[$transform_key]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : '');
+ $mime_type = (isset($mime_map[$transform_key]['mimetype']) ? str_replace('_', '/', $mime_map[$transform_key]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : '');
}
-header($content_type);
-if (isset($cn) && !empty($cn)) {
- header('Content-Disposition: attachment; filename=' . $cn);
+if (empty($cn)) {
+ $cn = 'download.bin';
}
+PMA_download_header($mime_type, $cn);
+
if (! isset($resize)) {
echo $row[$transform_key];
} else {
diff --git a/webapp.php b/webapp.php
index cdc0a87..8295efd 100644
--- a/webapp.php
+++ b/webapp.php
@@ -44,8 +44,7 @@ foreach ($parameters as $key => $value) {
$ini_file .= $key . '=' . $value . "\n";
}
-header('Content-Type: application/webapp');
-header('Content-Disposition: attachment; filename="' . $name . '"');
+PMA_download_header($name, 'application/webapp', false);
$zip = new zipfile;
$zip->setDoWrite();
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12928-gb9a7ac7
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via b9a7ac74251c490c67dae063e3cf4bb637cce288 (commit)
from fc7a273edabc88a3b28d0fa6affcf5916435100f (commit)
- Log -----------------------------------------------------------------
commit b9a7ac74251c490c67dae063e3cf4bb637cce288
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 14:06:27 2011 +0200
Avoid skiping authentication and token check
-----------------------------------------------------------------------
Summary of changes:
file_echo.php | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/file_echo.php b/file_echo.php
index 95689a4..da8baa0 100644
--- a/file_echo.php
+++ b/file_echo.php
@@ -5,30 +5,27 @@
*
* @package phpMyAdmin
*/
-
-
-define('PMA_MINIMUM_COMMON', true);
require_once './libraries/common.inc.php';
if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
$allowed = Array( 'image/png'=>'png', 'image/svg+xml'=>'svg');
-
+
if (! isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
-
+
if (! preg_match("/(".implode("|",$allowed).")$/i", $_REQUEST['filename']))
$_REQUEST['filename'] .= '.' . $allowed[$_REQUEST['type']];
-
+
downloadHeader($_REQUEST['filename'],$_REQUEST['type']);
if ($allowed[$_REQUEST['type']] != 'svg')
echo base64_decode(substr($_REQUEST['image'], strpos($_REQUEST['image'],',') + 1));
else
echo $_REQUEST['image'];
-
+
exit();
}
-
+
if(isset($_REQUEST['monitorconfig'])) {
downloadHeader('monitor.cfg','application/force-download');
echo urldecode($_REQUEST['monitorconfig']);
@@ -38,7 +35,7 @@ if(isset($_REQUEST['monitorconfig'])) {
if(isset($_REQUEST['import'])) {
echo '<html><body>' . file_get_contents($_FILES['file']['tmp_name']) . '</body></html>';
exit();
-}
+}
exit('Invalid request');
@@ -49,4 +46,4 @@ function downloadHeader($file,$type) {
header("Content-Type: ".$type);
header("Content-Transfer-Encoding: binary");
}
-?>
\ No newline at end of file
+?>
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12926-g262cced
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via 262cced72f89788a664bbd93d11d945d2428050e (commit)
via 41bbe32b12650470306915002f2d0ce4d6ca07bc (commit)
via 218d31aefc471e1b9db45bb3484a6d5a378e94bc (commit)
via 63dd549550997d4f430e54837bbdcf259948450f (commit)
via 5ec242bc149ba1e9ac8ce9499bd8fe17ef0ef75b (commit)
via 30e303f214e723dbee4c5498984bce77db688383 (commit)
via b04ca6294ac151c8d71bdcb6ca8320473f6a906a (commit)
via 1a5c8ccbf725480833f2362aa88ae469dccee46e (commit)
via a2b6df6fb7b5a8df7891076c094bfa7e8cd41c91 (commit)
via 3224527e0dbc51d5b81844a7254a9f902360ea88 (commit)
via 00172039455698a7e798a440cb29e3ea53bfe425 (commit)
via 29168e1a0abe3ccb548022b97b3c8509ae7ec6e9 (commit)
via b0290ca1bf58700c71654120daaee62d9d76a069 (commit)
via 05dd085aeb0334d1e9ee68037efb563866892164 (commit)
via 5fb7f9cd1716ae747a6e898ee6e92c864d4da6dc (commit)
via 01e185831ebe86886f686edfc95c0e642c95843c (commit)
via a4b916e6cd0e25225d6a261d6227b4e46e33f886 (commit)
via 8fb2eacb666a67ada3163f69bec5463d9482fde3 (commit)
via 74ef217ffd7c17682a47e54c40f17864a9157b56 (commit)
via bbd1d9f26ef45ffa90354ce47023ec8c9d427a05 (commit)
via 48d35cc3330f5af396b9478f84897a3e064b77fe (commit)
via f740cfb2bc7db3293d8fa2f6af008a413915d81c (commit)
via baa40842ed4a3ce04bc2d26287d63a01a638e5fd (commit)
via 04613d5b1f4c2b118902e22f4bfa6382f2cd9931 (commit)
via 6d7244eeea5a38c7215b8ef3cb87995b10dcb612 (commit)
from 0d9a0cb42bb864be0e69579e4e342d801288258d (commit)
- Log -----------------------------------------------------------------
commit 262cced72f89788a664bbd93d11d945d2428050e
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:59:28 2011 +0200
Coding style
commit 41bbe32b12650470306915002f2d0ce4d6ca07bc
Merge: 0d9a0cb42bb864be0e69579e4e342d801288258d 218d31aefc471e1b9db45bb3484a6d5a378e94bc
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:58:20 2011 +0200
Merge remote-tracking branch 'tyron/master'
Conflicts:
js/functions.js
commit 218d31aefc471e1b9db45bb3484a6d5a378e94bc
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Thu Aug 4 11:16:41 2011 +0300
Advisor Fixes
commit 63dd549550997d4f430e54837bbdcf259948450f
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Thu Aug 4 10:43:57 2011 +0300
- Status variables, new filter: 'Show unformatted values'
- Advisory System v0.1
- A simple rules engine implementation (advisor.lib.php)
- 51 performance rules based on the mysqltuner 2.0 rules, heavily improved and some newly added (advisory_rules.txt)
- 'Advisory' Tab displaying the recommendations
commit 5ec242bc149ba1e9ac8ce9499bd8fe17ef0ef75b
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Aug 2 11:25:26 2011 +0300
Small improvements:
- Byte value also for query_cache_limit
- In Status and Server variables, '_' and ' ' can be used interchangably, but only worked for the first occurence
- For analysing queries from slow query log, database name is passed on and selected prior to analyzing the query
- Timespan format also for Uptime
commit 30e303f214e723dbee4c5498984bce77db688383
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Sun Jul 31 16:13:58 2011 +0300
Reapplied Marcs newline removal in messages
commit b04ca6294ac151c8d71bdcb6ca8320473f6a906a
Merge: 1a5c8ccbf725480833f2362aa88ae469dccee46e e3b91b7a0bfcb6bc525c9cfb27c8fc7570457b95
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Sun Jul 31 16:00:15 2011 +0300
Merge remote-tracking branch 'origin/master'
Conflicts:
server_status.php
commit 1a5c8ccbf725480833f2362aa88ae469dccee46e
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Sun Jul 31 15:58:15 2011 +0300
Added notice for users of < MySQL 5.1.6 that table logging ist not available
commit a2b6df6fb7b5a8df7891076c094bfa7e8cd41c91
Merge: 3224527e0dbc51d5b81844a7254a9f902360ea88 fdcad5b0642765275958e6459609d02faa70a2f6
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Fri Jul 29 18:18:26 2011 +0300
Merge remote-tracking branch 'origin/master'
commit 3224527e0dbc51d5b81844a7254a9f902360ea88
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Fri Jul 29 10:11:01 2011 +0300
Avoid js-code injection
commit 00172039455698a7e798a440cb29e3ea53bfe425
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Thu Jul 28 19:59:17 2011 +0300
Chart Grid importing and exporting feature.
commit 29168e1a0abe3ccb548022b97b3c8509ae7ec6e9
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Wed Jul 27 17:38:15 2011 +0300
Monitor: Chart title and series names now editable
commit b0290ca1bf58700c71654120daaee62d9d76a069
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Wed Jul 27 13:16:59 2011 +0300
Collapsible navigation frame: Fix for expand link disappeared after page load
commit 05dd085aeb0334d1e9ee68037efb563866892164
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Wed Jul 27 12:57:02 2011 +0300
Icons for collapsible frame
commit 5fb7f9cd1716ae747a6e898ee6e92c864d4da6dc
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Wed Jul 27 12:56:40 2011 +0300
Feature idea: Collapsible navigation frame
commit 01e185831ebe86886f686edfc95c0e642c95843c
Merge: a4b916e6cd0e25225d6a261d6227b4e46e33f886 ad4975b82d6beb67d78c0e64092ef29f98a257e3
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Wed Jul 27 11:18:46 2011 +0300
Merge remote-tracking branch 'origin/master'
Conflicts:
js/functions.js
js/server_status.js
server_status.php
commit a4b916e6cd0e25225d6a261d6227b4e46e33f886
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Wed Jul 27 11:16:28 2011 +0300
drizzle adjustment
commit 8fb2eacb666a67ada3163f69bec5463d9482fde3
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 26 16:25:52 2011 +0300
drizzle support
commit 74ef217ffd7c17682a47e54c40f17864a9157b56
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 26 16:03:17 2011 +0300
Query Analyzer Dialog:
- Show all explains
- Mark bad explain values as red
commit bbd1d9f26ef45ffa90354ce47023ec8c9d427a05
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 26 13:35:35 2011 +0300
Added documentation link to profiling status names
commit 48d35cc3330f5af396b9478f84897a3e064b77fe
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 26 12:47:54 2011 +0300
Monitor fixes:
- Long INSERT and UPDATE queries are also truncated for slow_log queries
- Truncated queries have a byte count appended instead of "[Array]"
commit f740cfb2bc7db3293d8fa2f6af008a413915d81c
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 26 12:36:32 2011 +0300
Fixes on Monitor:
- Removing chart didn't remove div element
- Loading from slow_log never returned any results
- slow_log query_time and lock_time wrongly calculated
- Grouping by ignoring variables, now also sums up all the count columns for slow query log results
- Wrong query profiling information
commit baa40842ed4a3ce04bc2d26287d63a01a638e5fd
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 26 12:33:11 2011 +0300
Better profiling durations formatting
commit 04613d5b1f4c2b118902e22f4bfa6382f2cd9931
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Mon Jul 25 23:44:55 2011 +0300
Fixed slow log as data source
commit 6d7244eeea5a38c7215b8ef3cb87995b10dcb612
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Mon Jul 25 22:10:52 2011 +0300
- Live charting: Error message on invalid server response
- Fixed bugged CPU chart not displaying anything
-----------------------------------------------------------------------
Summary of changes:
chart_export.php => file_echo.php | 36 +-
js/common.js | 66 +++
js/functions.js | 18 +-
js/highcharts/exporting.js | 5 +-
js/jquery/jquery.sortableTable.js | 2 +-
js/messages.php | 29 +-
js/server_status.js | 618 +++++++++++++++-----
js/server_variables.js | 2 +-
libraries/advisor.lib.php | 198 +++++++
libraries/advisory_rules.txt | 427 ++++++++++++++
libraries/header.inc.php | 1 +
libraries/server_variables_doc.php | 3 +-
navigation.php | 1 +
server_status.php | 188 +++++--
sql.php | 2 +-
themes/original/css/theme_right.css.php | 17 +-
themes/pmahomme/css/theme_left.css.php | 7 +
themes/pmahomme/css/theme_right.css.php | 27 +-
.../img/frame-collapse.png} | Bin 4006 -> 3862 bytes
themes/pmahomme/img/frame-expand.png | Bin 0 -> 1130 bytes
20 files changed, 1423 insertions(+), 224 deletions(-)
rename chart_export.php => file_echo.php (55%)
create mode 100644 libraries/advisor.lib.php
create mode 100644 libraries/advisory_rules.txt
copy themes/{original/img/bd_spatial.png => pmahomme/img/frame-collapse.png} (67%)
create mode 100644 themes/pmahomme/img/frame-expand.png
diff --git a/chart_export.php b/file_echo.php
similarity index 55%
rename from chart_export.php
rename to file_echo.php
index c05332a..95689a4 100644
--- a/chart_export.php
+++ b/file_echo.php
@@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
- * "Echo" service to allow force downloading of exported charts (png or svg)
+ * "Echo" service to allow force downloading of exported charts (png or svg) and server status monitor settings
*
* @package phpMyAdmin
*/
@@ -11,24 +11,42 @@ define('PMA_MINIMUM_COMMON', true);
require_once './libraries/common.inc.php';
-if (isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
+if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
$allowed = Array( 'image/png'=>'png', 'image/svg+xml'=>'svg');
if (! isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
if (! preg_match("/(".implode("|",$allowed).")$/i", $_REQUEST['filename']))
$_REQUEST['filename'] .= '.' . $allowed[$_REQUEST['type']];
+
+ downloadHeader($_REQUEST['filename'],$_REQUEST['type']);
- header("Cache-Control: public");
- header("Content-Description: File Transfer");
- header("Content-Disposition: attachment; filename=".$_REQUEST['filename']);
- header("Content-Type: ".$_REQUEST['type']);
- header("Content-Transfer-Encoding: binary");
-
if ($allowed[$_REQUEST['type']] != 'svg')
echo base64_decode(substr($_REQUEST['image'], strpos($_REQUEST['image'],',') + 1));
else
echo $_REQUEST['image'];
+
+ exit();
+}
-} else exit('Invalid request');
+if(isset($_REQUEST['monitorconfig'])) {
+ downloadHeader('monitor.cfg','application/force-download');
+ echo urldecode($_REQUEST['monitorconfig']);
+ exit();
+}
+
+if(isset($_REQUEST['import'])) {
+ echo '<html><body>' . file_get_contents($_FILES['file']['tmp_name']) . '</body></html>';
+ exit();
+}
+
+exit('Invalid request');
+
+function downloadHeader($file,$type) {
+ header("Cache-Control: public");
+ header("Content-Description: File Transfer");
+ header("Content-Disposition: attachment; filename=".$file);
+ header("Content-Type: ".$type);
+ header("Content-Transfer-Encoding: binary");
+}
?>
\ No newline at end of file
diff --git a/js/common.js b/js/common.js
index b595108..06b1609 100644
--- a/js/common.js
+++ b/js/common.js
@@ -14,6 +14,8 @@ var querywindow = '';
*/
var query_to_load = '';
+var leftFrameWidth = -1;
+
/**
* sets current selected db
*
@@ -363,3 +365,67 @@ function updateTableTitle( table_link_id, new_title ) {
return false;
}
+
+(function($) {
+ $.fn.extend({
+ dom: function () {
+ var $this = $(this);
+ var getDom = function(o) {
+ if( !o || (!o.contentWindow && !o.contentDocument) ) {
+ return null;
+ }
+
+ var doc = (o.contentWindow || o.contentDocument);
+
+ return doc.document || doc;
+ };
+
+ var dom = getDom($this[0]);
+
+ return dom === null ? $this : $(dom);
+ }
+ });
+})(jQuery);
+
+$(document).ready(function() {
+ $('frame#frame_navigation').load(function() {
+ $('frame#frame_navigation').dom().find('div#frameCollapse').show().click(toggleNavigation);
+ });
+ $('frame#frame_content').load(function() {
+ $('frame#frame_content').dom().find('div#frameExpand').click(toggleNavigation);
+ });
+});
+
+function toggleNavigation() {
+ if(leftFrameWidth == -1) leftFrameWidth = $('frame#frame_navigation').width();
+
+ var newWidth = leftFrameWidth - $('frame#frame_navigation').width();
+ var $frameset = $('frameset');
+
+ if(newWidth == 0) {
+ $('frame#frame_navigation').dom().find('body').css('width',leftFrameWidth + 'px');
+ $('frame#frame_navigation').dom().find('body').css('overflow','hidden');
+ } else {
+ $('frame#frame_content').dom().find('div#frameExpand').hide();
+ }
+
+ $('frame#frame_navigation').animate(
+ { width: newWidth },
+ { step: function(now, fx) {
+ $frameset.attr('cols',fx.now + ',*');
+ },
+ complete: function() {
+ if(newWidth != 0) {
+ $('frame#frame_navigation').dom().find('body').css('width','');
+ $('frame#frame_navigation').dom().find('body').css('overflow','');
+ } else {
+ $('frame#frame_content').dom().find('div#frameExpand').show();
+ }
+ }
+ }
+ );
+}
+
+function currentWidth() {
+ return $('frame#frame_navigation').width();
+}
\ No newline at end of file
diff --git a/js/functions.js b/js/functions.js
index 287195d..b6b7692 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -29,6 +29,12 @@ var codemirror_editor = false;
*/
var chart_activeTimeouts = new Object();
+if(window.parent) {
+ $(document).ready(function() {
+ if(window.parent.currentWidth() == 0)
+ $('div#frameExpand').show();
+ });
+}
/**
* Add a hidden field to the form to indicate that this will be an
@@ -1611,13 +1617,15 @@ function PMA_createProfilingChart(data, options) {
// Formats a profiling duration nicely. Used in PMA_createProfilingChart() and server_status.js
function PMA_prettyProfilingNum(num, acc) {
if (!acc) {
- acc = 1;
+ acc = 2;
}
acc = Math.pow(10,acc);
- if (num*1000 < 0.1) {
- num = Math.round(acc*(num*1000*1000))/acc + 'µ'
+ if (num * 1000 < 0.1) {
+ num = Math.round(acc * (num * 1000 * 1000)) / acc + 'µ';
} else if (num < 0.1) {
- num = Math.round(acc*(num*1000))/acc + 'm'
+ num = Math.round(acc * (num * 1000)) / acc + 'm';
+ } else {
+ num = Math.round(acc * num) / acc;
}
return num + 's';
@@ -2018,7 +2026,7 @@ $(document).ready(function() {
$("#result_query .notice").remove();
$("#result_query").prepend((data.message));
$("#copyTable").find("select[name='target_db'] option[value="+data.db+"]").attr('selected', 'selected');
-
+
//Refresh navigation frame when the table is coppied
if (window.parent && window.parent.frame_navigation) {
window.parent.frame_navigation.location.reload();
diff --git a/js/highcharts/exporting.js b/js/highcharts/exporting.js
index cb04357..6ac3a87 100644
--- a/js/highcharts/exporting.js
+++ b/js/highcharts/exporting.js
@@ -5,6 +5,9 @@
* (c) 2010 Torstein Hønsi
*
* License: www.highcharts.com/license
+ *
+ * Please Note: This file has been adjusted for use in phpMyAdmin,
+ * to allow chart exporting without the batik library
*/
// JSLint options:
@@ -104,7 +107,7 @@ defaultOptions.exporting = {
//enabled: true,
//filename: 'chart',
type: 'image/png',
- url: 'chart_export.php',
+ url: 'file_echo.php',
width: 800,
buttons: {
exportButton: {
diff --git a/js/jquery/jquery.sortableTable.js b/js/jquery/jquery.sortableTable.js
index 2dd1ede..1f4fc91 100644
--- a/js/jquery/jquery.sortableTable.js
+++ b/js/jquery/jquery.sortableTable.js
@@ -49,7 +49,7 @@ $('table').sortableTable('destroy') - removes all events from the table
},
destroy : function( ) {
$(this).data('sortableTable').destroy();
- },
+ }
};
if ( methods[method] ) {
diff --git a/js/messages.php b/js/messages.php
index 357e745..4d9be93 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -98,12 +98,28 @@ $js_messages['strMiB'] = __('MiB');
$js_messages['strKiB'] = __('KiB');
$js_messages['strAverageLoad'] = __('Average load');
+$js_messages['strTotalMemory'] = __('Total memory');
+$js_messages['strCachedMemory'] = __('Cached memory');
+$js_messages['strBufferedMemory'] = __('Buffered memory');
+$js_messages['strFreeMemory'] = __('Free memory');
+$js_messages['strUsedMemory'] = __('Used memory');
+
+$js_messages['strTotalSwap'] = __('Total Swap');
+$js_messages['strCachedSwap'] = __('Cached Swap');
+$js_messages['strUsedSwap'] = __('Used Swap');
+$js_messages['strFreeSwap'] = __('Free Swap');
+
+$js_messages['strBytesSent'] = __('Bytes sent');
+$js_messages['strBytesReceived'] = __('Bytes received');
+$js_messages['strConnections'] = __('Connections');
+$js_messages['strProcesses'] = __('Processes');
+
/* l10n: Questions is the name of a MySQL Status variable */
$js_messages['strQuestions'] = __('Questions');
$js_messages['strTraffic'] = __('Traffic');
$js_messages['strSettings'] = __('Settings');
$js_messages['strRemoveChart'] = __('Remove chart');
-$js_messages['strEditChart'] = __('Edit labels and series');
+$js_messages['strEditChart'] = __('Edit title and labels');
$js_messages['strAddChart'] = __('Add chart to grid');
$js_messages['strClose'] = __('Close');
$js_messages['strAddOneSeriesWarning'] = __('Please add at least one variable to the series');
@@ -156,6 +172,17 @@ $js_messages['strIgnoreWhereAndGroup'] = __('Group queries, ignoring variable da
$js_messages['strSumRows'] = __('Sum of grouped rows:');
$js_messages['strTotal'] = __('Total:');
+$js_messages['strLoadingLogs'] = __('Loading logs');
+$js_messages['strRefreshFailed'] = __('Monitor refresh failed');
+$js_messages['strInvalidResponseExplanation'] = __('While requesting new chart data the server returned an invalid response. This is most likely because your session expired. Reloading the page and reentering your credentials should help.');
+$js_messages['strReloadPage'] = __('Reload page');
+
+$js_messages['strAffectedRows'] = __('Affected rows: ');
+
+$js_messages['strFailedParsingConfig'] = __('Failed parsing config file. It doesn\'t seem to be valid JSON code');
+$js_messages['strFailedBuildingGrid'] = __('Failed building chart grid with imported config. Resetting to default config...');
+$js_messages['strImport'] = __('Import');
+
/* For inline query editing */
$js_messages['strGo'] = __('Go');
$js_messages['strCancel'] = __('Cancel');
diff --git a/js/server_status.js b/js/server_status.js
index d8f3788..60a3490 100644
--- a/js/server_status.js
+++ b/js/server_status.js
@@ -217,8 +217,9 @@ $(function() {
{ x: curVal.x, y: (curVal.y_received - lastVal.y_received) / 1024 },
true,
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
- );
- }
+ );
+ },
+ error: function() { serverResponseError(); }
}
}
@@ -259,8 +260,9 @@ $(function() {
{ x: curVal.x, y: curVal.y_proc },
true,
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
- );
- }
+ );
+ },
+ error: function() { serverResponseError(); }
}
};
@@ -295,7 +297,8 @@ $(function() {
true,
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
);
- }
+ },
+ error: function() { serverResponseError(); }
}
};
} else {
@@ -348,7 +351,7 @@ $(function() {
});
$('#filterText').keyup(function(e) {
- word = $(this).val().replace('_',' ');
+ word = $(this).val().replace(/_/g,' ');
if(word.length == 0) textFilter = null;
else textFilter = new RegExp("(^|_)" + word,'i');
@@ -362,6 +365,11 @@ $(function() {
categoryFilter = $(this).val();
filterVariables();
});
+
+ $('input#dontFormat').change(function() {
+ $('#serverstatusvariables td.value span.original').toggle(this.checked);
+ $('#serverstatusvariables td.value span.formatted').toggle(! this.checked);
+ });
/* Adjust DOM / Add handlers to the tabs */
function initTab(tab,data) {
@@ -545,7 +553,55 @@ $(function() {
return pointInfo;
}
+ /**** Server config advisor ****/
+ $('a[href="#openAdvisorInstructions"]').click(function() {
+ $('#advisorInstructionsDialog').dialog();
+ });
+
+ $('a[href="#startAnalyzer"]').click(function() {
+ var $cnt = $('#statustabs_advisor .tabInnerContent');
+ $cnt.html('<img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">');
+
+ $.get('server_status.php?'+url_query, { ajax_request: true, advisor: true },function(data) {
+ var $tbody, $tr, str, even = true;
+
+ data = $.parseJSON(data);
+ $cnt.html('<p><b>Possible performance issues</b></p>');
+ if(data.fired.length > 0) {
+ $cnt.append('<table class="data" id="rulesFired" border="0"><thead><tr><th>Issue</th><th>Recommendation</th></tr></thead><tbody></tbody></table>');
+ $tbody = $cnt.find('table#rulesFired');
+ $.each(data.fired, function(key,value) {
+ $tbody.append($tr = $('<tr class="linkElem noclick ' + (even ? 'even' : 'odd') + '"><td>' + value.issue + '</td>' +
+ '<td>' + value.recommendation + ' </td></tr>'));
+ even = !even;
+
+ $tr.data('rule',value);
+ $tr.click(function() {
+ var rule = $(this).data('rule');
+ $('div#emptyDialog').attr('title','Rule details');
+ $('div#emptyDialog').html(
+ '<p><b>Issue:</b><br />' + rule.issue + '</p>' +
+ '<p><b>Recommendation:</b><br />' + rule.recommendation + '</p>' +
+ '<p><b>Justification:</b><br />' + rule.justification + '</p>' +
+ '<p><b>Used variable / formula:</b><br />' + rule.formula + '</p>' +
+ '<p><b>Test:</b><br />' + rule.test + '</p>'
+ );
+ $('div#emptyDialog').dialog({
+ width: 600,
+ buttons: {
+ 'Close' : function() {
+ $(this).dialog('close');
+ }
+ }
+ });
+ });
+ });
+ }
+ });
+
+ return false;
+ });
/**** Monitor charting implementation ****/
@@ -555,15 +611,10 @@ $(function() {
var newChart = null;
var chartSpacing;
- // Runtime parameter of the monitor
+ // Runtime parameter of the monitor, is being fully set in initGrid()
var runtime = {
// Holds all visible charts in the grid
charts: null,
- // Current max points per chart (needed for auto calculation)
- gridMaxPoints: 20,
- // displayed time frame
- xmin: -1,
- xmax: -1,
// Stores the timeout handler so it can be cleared
refreshTimeout: null,
// Stores the GET request to refresh the charts
@@ -573,13 +624,18 @@ $(function() {
// To play/pause the monitor
redrawCharts: false,
// Object that contains a list of nodes that need to be retrieved from the server for chart updates
- dataList: []
+ dataList: [],
+ // Current max points per chart (needed for auto calculation)
+ gridMaxPoints: 20,
+ // displayed time frame
+ xmin: -1,
+ xmax: -1
};
-
+
var monitorSettings = null;
var defaultMonitorSettings = {
- columns: 4,
+ columns: 3,
chartSize: { width: 295, height: 250 },
// Max points in each chart. Settings it to 'auto' sets gridMaxPoints to (chartwidth - 40) / 12
gridMaxPoints: 'auto',
@@ -593,20 +649,20 @@ $(function() {
var presetCharts = {
'cpu-WINNT': {
title: PMA_messages['strSystemCPUUsage'],
- nodes: [{ dataType: 'cpu', name: 'loadavg', unit: '%'}]
+ nodes: [{ dataType: 'cpu', name: PMA_messages['strAverageLoad'], dataPoint: 'loadavg', unit: '%'}]
},
'memory-WINNT': {
title: PMA_messages['strSystemMemory'],
nodes: [
- { dataType: 'memory', name: 'MemTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strTotalMemory'], dataPoint: 'MemTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
]
},
'swap-WINNT': {
title: PMA_messages['strSystemSwap'],
nodes: [
- { dataType: 'memory', name: 'SwapTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strTotalSwap'], dataPoint: 'SwapTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strUsedSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
]
},
'cpu-Linux': {
@@ -615,25 +671,17 @@ $(function() {
{ dataType: 'cpu',
name: PMA_messages['strAverageLoad'],
unit: '%',
- transformFn: function(cur, prev) {
- console.log('cpu-linux chart, transformFn()');
- console.log(cur);
- console.log(prev);
- if(prev == null) return undefined;
- var diff_total = cur.busy + cur.idle - (prev.busy + prev.idle);
- var diff_idle = cur.idle - prev.idle;
- return 100*(diff_total - diff_idle) / diff_total;
- }
+ transformFn: 'cpu-linux'
}
]
},
'memory-Linux': {
title: PMA_messages['strSystemMemory'],
nodes: [
- { dataType: 'memory', name: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'Cached', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'Buffers', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'MemFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strCachedMemory'], dataPoint: 'Cached', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strBufferedMemory'], dataPoint: 'Buffers', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strFreeMemory'], dataPoint:'MemFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
],
settings: {
chart: {
@@ -650,9 +698,9 @@ $(function() {
'swap-Linux': {
title: PMA_messages['strSystemSwap'],
nodes: [
- { dataType: 'memory', name: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'SwapCached', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
- { dataType: 'memory', name: 'SwapFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strTotalSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strCachedSwap'], dataPoint: 'SwapCached', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
+ { dataType: 'memory', name: PMA_messages['strFreeSwap'], dataPoint: 'SwapFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] },
],
settings: {
chart: {
@@ -671,18 +719,18 @@ $(function() {
// Default setting
defaultChartGrid = {
'c0': { title: PMA_messages['strQuestions'],
- nodes: [{ dataType: 'statusvar', name: 'Questions', display: 'differential' }]
- },
- 'c1': {
+ nodes: [{ dataType: 'statusvar', name: PMA_messages['strQuestions'], dataPoint: 'Questions', display: 'differential' }]
+ },
+ 'c1': {
title: PMA_messages['strChartConnectionsTitle'],
- nodes: [ { dataType: 'statusvar', name: 'Connections', display: 'differential' },
- { dataType: 'proc', name: 'Processes'} ]
- },
- 'c2': {
+ nodes: [ { dataType: 'statusvar', name: PMA_messages['strConnections'], dataPoint: 'Connections', display: 'differential' },
+ { dataType: 'proc', name: PMA_messages['strProcesses'], dataPoint: 'processes'} ]
+ },
+ 'c2': {
title: PMA_messages['strTraffic'],
nodes: [
- { dataType: 'statusvar', name: 'Bytes_sent', display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] },
- { dataType: 'statusvar', name: 'Bytes_received', display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] }
+ { dataType: 'statusvar', name: PMA_messages['strBytesSent'], dataPoint: 'Bytes_sent', display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] },
+ { dataType: 'statusvar', name: PMA_messages['strBytesReceived'], dataPoint: 'Bytes_received', display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] }
]
}
};
@@ -706,7 +754,7 @@ $(function() {
menuItems: [{
textKey: 'editChart',
onclick: function() {
- alert('tbi');
+ editChart(this);
}
}, {
textKey: 'removeChart',
@@ -746,9 +794,6 @@ $(function() {
height: 24
},
events: {
- start: function() {
- // console.log('start.');
- },
// Drop event. The drag child element is moved into the drop element
// and vice versa. So the parameters are switched.
drop: function(drag, drop, pos) {
@@ -922,15 +967,15 @@ $(function() {
saveMonitor(); // Save settings
$(this).dialog("close");
- }
-
+ };
+
dlgButtons[PMA_messages['strClose']] = function() {
newChart = null;
$('span#clearSeriesLink').hide();
$('#seriesPreview').html('');
$(this).dialog("close");
- }
-
+ };
+
$('div#addChartDialog').dialog({
width:'auto',
height:'auto',
@@ -941,6 +986,102 @@ $(function() {
return false;
});
+
+ $('a[href="#exportMonitorConfig"]').click(function() {
+ var gridCopy = {};
+
+ $.each(runtime.charts, function(key, elem) {
+ gridCopy[key] = {};
+ gridCopy[key].nodes = elem.nodes;
+ gridCopy[key].settings = elem.settings;
+ gridCopy[key].title = elem.title;
+ });
+
+ var exportData = {
+ monitorCharts: gridCopy,
+ monitorSettings: monitorSettings
+ };
+ var $form;
+
+ $('body').append($form = $('<form method="post" action="file_echo.php?'+url_query+'&filename=1" style="display:none;"></form>'));
+
+ $form.append('<input type="hidden" name="monitorconfig" value="' + encodeURI($.toJSON(exportData)) + '">');
+ $form.submit();
+ $form.remove();
+ });
+
+ $('a[href="#importMonitorConfig"]').click(function() {
+ $('div#emptyDialog').attr('title','Import monitor configuration');
+ $('div#emptyDialog').html('Please select the file you want to import:<br/><form action="file_echo.php?'+url_query+'&import=1" method="post" enctype="multipart/form-data">'+
+ '<input type="file" name="file"> <input type="hidden" name="import" value="1"> </form>');
+
+ var dlgBtns = {};
+
+ dlgBtns[PMA_messages['strImport']] = function() {
+ var $iframe, $form;
+ $('body').append($iframe = $('<iframe id="monitorConfigUpload" style="display:none;"></iframe>'));
+ var d = $iframe[0].contentWindow.document;
+ d.open(); d.close();
+ mew = d;
+
+ $iframe.load(function() {
+ var json;
+
+ // Try loading config
+ try {
+ json = $.secureEvalJSON($('body',$('iframe#monitorConfigUpload')[0].contentWindow.document).html());
+ } catch (err) {
+ alert(PMA_messages['strFailedParsingConfig']);
+ $('div#emptyDialog').dialog('close');
+ return;
+ }
+
+ // Basic check, is this a monitor config json?
+ if(!json || ! json.monitorCharts || ! json.monitorCharts) {
+ alert(PMA_messages['strFailedParsingConfig']);
+ $('div#emptyDialog').dialog('close');
+ return;
+ }
+
+ // If json ok, try applying config
+ try {
+ window.localStorage['monitorCharts'] = $.toJSON(json.monitorCharts);
+ window.localStorage['monitorSettings'] = $.toJSON(json.monitorSettings);
+ rebuildGrid();
+ } catch(err) {
+ alert(PMA_messages['strFailedBuildingGrid']);
+ // If an exception is thrown, load default again
+ window.localStorage.removeItem('monitorCharts');
+ window.localStorage.removeItem('monitorSettings');
+ rebuildGrid();
+ }
+
+ $('div#emptyDialog').dialog('close');
+ });
+
+ $("body", d).append($form=$('div#emptyDialog').find('form'));
+ $form.submit();
+ $('div#emptyDialog').append('<img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">');
+ };
+
+ dlgBtns[PMA_messages['strCancel']] = function() {
+ $(this).dialog('close');
+ }
+
+
+ $('div#emptyDialog').dialog({
+ width: 'auto',
+ height: 'auto',
+ buttons: dlgBtns
+ });
+ });
+
+ $('a[href="#clearMonitorConfig"]').click(function() {
+ window.localStorage.removeItem('monitorCharts');
+ window.localStorage.removeItem('monitorSettings');
+ $(this).hide();
+ rebuildGrid();
+ });
$('a[href="#pauseCharts"]').click(function() {
runtime.redrawCharts = ! runtime.redrawCharts;
@@ -948,7 +1089,7 @@ $(function() {
$(this).html('<img src="themes/dot.gif" class="icon ic_play" alt="" /> ' + PMA_messages['strResumeMonitor']);
else {
$(this).html('<img src="themes/dot.gif" class="icon ic_pause" alt="" /> ' + PMA_messages['strPauseMonitor']);
- if(runtime.charts == null) {
+ if(! runtime.charts) {
initGrid();
$('a[href="#settingsPopup"]').show();
}
@@ -1067,9 +1208,9 @@ $(function() {
});
}
);
- }
-
-
+ };
+
+
loadLogVars();
return false;
@@ -1133,11 +1274,12 @@ $(function() {
var serie = {
dataType:'statusvar',
+ dataPoint: $('input#variableInput').attr('value'),
name: $('input#variableInput').attr('value'),
display: $('input[name="differentialValue"]').attr('checked') ? 'differential' : ''
};
- if(serie.name == 'Processes') serie.dataType='proc';
+ if(serie.dataPoint == 'Processes') serie.dataType='proc';
if($('input[name="useDivisor"]').attr('checked'))
serie.valueDivisor = parseInt($('input[name="valueDivisor"]').attr('value'));
@@ -1150,7 +1292,7 @@ $(function() {
var str = serie.display == 'differential' ? ', ' + PMA_messages['strDifferential'] : '';
str += serie.valueDivisor ? (', ' + $.sprintf(PMA_messages['strDividedBy'], serie.valueDivisor)) : '';
- $('#seriesPreview').append('- ' + serie.name + str + '<br>');
+ $('#seriesPreview').append('- ' + serie.dataPoint + str + '<br>');
newChart.nodes.push(serie);
@@ -1209,7 +1351,7 @@ $(function() {
height: $('table#chartGrid tr:nth-child(2) td:nth-child(2)').offset().top - $('table#chartGrid tr:nth-child(1) td:nth-child(1)').offset().top
}
$('table#chartGrid').html('');
-
+
/* Add all charts - in correct order */
var keys = [];
$.each(runtime.charts, function(key, value) {
@@ -1228,11 +1370,57 @@ $(function() {
// Empty cells should keep their size so you can drop onto them
$('table#chartGrid tr td').css('width',chartSize().width + 'px');
-
-
+
buildRequiredDataList();
refreshChartGrid();
}
+
+ function destroyGrid() {
+ if(runtime.charts)
+ $.each(runtime.charts, function(key, value) {
+ try {
+ value.chart.destroy();
+ } catch(err) {}
+ });
+ try {
+ runtime.refreshRequest.abort();
+ } catch(err) {}
+ try {
+ clearTimeout(runtime.refreshTimeout);
+ } catch(err) {}
+
+ $('table#chartGrid').html('');
+
+ runtime.charts = null;
+ runtime.chartAI = 0;
+ monitorSettings = null;
+ }
+
+ function rebuildGrid() {
+ var oldData = null;
+ if(runtime.charts) {
+ oldData = {};
+ $.each(runtime.charts, function(key, chartObj) {
+ for(var i=0; i < chartObj.nodes.length; i++) {
+ oldData[chartObj.nodes[i].dataPoint] = [];
+ for(var j=0; j < chartObj.chart.series[i].data.length; j++)
+ oldData[chartObj.nodes[i].dataPoint].push([chartObj.chart.series[i].data[j].x, chartObj.chart.series[i].data[j].y]);
+ }
+ });
+ }
+
+ destroyGrid();
+ initGrid();
+
+ if(oldData) {
+ $.each(runtime.charts, function(key, chartObj) {
+ for(var j=0; j < chartObj.nodes.length; j++) {
+ if(oldData[chartObj.nodes[j].dataPoint])
+ chartObj.chart.series[j].setData(oldData[chartObj.nodes[j].dataPoint]);
+ }
+ });
+ }
+ }
function chartSize() {
var wdt = $('div#logTable').innerWidth() / monitorSettings.columns - (monitorSettings.columns - 1) * chartSpacing.width;
@@ -1284,8 +1472,8 @@ $(function() {
$('#logAnalyseDialog').find('dateStart,dateEnd').datepicker('destroy');
$(this).dialog("close");
- }
-
+ };
+
dlgBtns[PMA_messages['strFromGeneralLog']] = function() {
var dateStart = Date.parse($('#logAnalyseDialog input[name="dateStart"]').attr('value')) || min;
var dateEnd = Date.parse($('#logAnalyseDialog input[name="dateEnd"]').attr('value')) || max;
@@ -1301,8 +1489,8 @@ $(function() {
$('#logAnalyseDialog').find('dateStart,dateEnd').datepicker('destroy');
$(this).dialog("close");
- }
-
+ };
+
$('#logAnalyseDialog').dialog({
width: 'auto',
height: 'auto',
@@ -1358,7 +1546,7 @@ $(function() {
chartObj.chart = PMA_createChart(settings);
chartObj.numPoints = 0;
-
+
if(initialize != true) {
runtime.charts['c'+runtime.chartAI] = chartObj;
buildRequiredDataList();
@@ -1370,11 +1558,59 @@ $(function() {
runtime.chartAI++;
}
+ function editChart(chartObj) {
+ var htmlnode = chartObj.options.chart.renderTo;
+ if(! htmlnode ) return;
+
+ var chart=null;
+ var chartKey=null;
+ $.each(runtime.charts, function(key, value) {
+ if(value.chart.options.chart.renderTo == htmlnode) {
+ chart = value;
+ chartKey = key;
+ return false;
+ }
+ });
+
+ if(chart == null) return;
+
+ var htmlStr = '<p><b>Chart title: </b> <br/> <input type="text" size="35" name="chartTitle" value="' + chart.title + '" />';
+ htmlStr += '</p><p><b>Series:</b> </p><ol>';
+ for(var i=0; i<chart.nodes.length; i++) {
+ htmlStr += '<li><i>' + chart.nodes[i].dataPoint +': </i><br/><input type="text" name="chartSerie-' + i + '" value=" ' + chart.nodes[i].name + '" /></li>';
+ }
+
+ dlgBtns = {};
+ dlgBtns['Save'] = function() {
+ runtime.charts[chartKey].title = $('div#emptyDialog input[name="chartTitle"]').attr('value');
+ runtime.charts[chartKey].chart.setTitle({ text: runtime.charts[chartKey].title });
+
+ $('div#emptyDialog input[name*="chartSerie"]').each(function() {
+ var idx = $(this).attr('name').split('-')[1];
+ runtime.charts[chartKey].nodes[idx].name = $(this).attr('value');
+ runtime.charts[chartKey].chart.series[idx].name = $(this).attr('value');
+ });
+
+ $(this).dialog('close');
+ saveMonitor();
+ };
+ dlgBtns['Cancel'] = function() {
+ $(this).dialog('close');
+ };
+
+ $('div#emptyDialog').attr('title','Edit chart');
+ $('div#emptyDialog').html(htmlStr+'</ol>');
+ $('div#emptyDialog').dialog({
+ width: 'auto',
+ height: 'auto',
+ buttons: dlgBtns
+ });
+ }
+
function removeChart(chartObj) {
var htmlnode = chartObj.options.chart.renderTo;
if(! htmlnode ) return;
-
-
+
$.each(runtime.charts, function(key, value) {
if(value.chart.options.chart.renderTo == htmlnode) {
delete runtime.charts[key];
@@ -1388,7 +1624,7 @@ $(function() {
// which throws an error when the chart is destroyed
setTimeout(function() {
chartObj.destroy();
- $('li#' + htmlnode).remove();
+ $('div#' + htmlnode).remove();
},10);
saveMonitor(); // Save settings
@@ -1397,10 +1633,15 @@ $(function() {
function refreshChartGrid() {
/* Send to server */
runtime.refreshRequest = $.post('server_status.php?'+url_query, { ajax_request: true, chart_data: 1, type: 'chartgrid', requiredData: $.toJSON(runtime.dataList) },function(data) {
- var chartData = $.parseJSON(data);
+ var chartData;
+ try {
+ chartData = $.parseJSON(data);
+ } catch(err) {
+ return serverResponseError();
+ }
var value, i=0;
var diff;
-
+
/* Update values in each graph */
$.each(runtime.charts, function(orderKey, elem) {
var key = elem.chartID;
@@ -1429,12 +1670,13 @@ $(function() {
value = value / elem.nodes[j].valueDivisor;
if(elem.nodes[j].transformFn) {
- value = elem.nodes[j].transformFn(
- chartData[key][j],
- (oldChartData == null) ? null : oldChartData[key][j]
+ value = chartValueTransform(
+ elem.nodes[j].transformFn,
+ chartData[key][j],
+ (oldChartData == null ? null : oldChartData[key][j])
);
}
-
+
if(value != undefined)
elem.chart.series[j].addPoint(
{ x: chartData.x, y: value },
@@ -1455,6 +1697,17 @@ $(function() {
runtime.refreshTimeout = setTimeout(refreshChartGrid, monitorSettings.gridRefresh);
});
}
+
+ function chartValueTransform(name,cur,prev) {
+ switch(name) {
+ case 'cpu-linux':
+ if(prev == null) return undefined;
+ var diff_total = cur.busy + cur.idle - (prev.busy + prev.idle);
+ var diff_idle = cur.idle - prev.idle;
+ return 100*(diff_total - diff_idle) / diff_total;
+ }
+ return undefined;
+ }
/* Build list of nodes that need to be retrieved */
function buildRequiredDataList() {
@@ -1476,10 +1729,10 @@ $(function() {
opts.removeVariables = false;
if(! opts.limitTypes)
opts.limitTypes = false;
+
+ $('#emptyDialog').html(PMA_messages['strAnalysingLogs'] + ' <img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">');
- $('#loadingLogsDialog').html(PMA_messages['strAnalysingLogs'] + ' <img class="ajaxIcon" src="' + pmaThemeImage + 'ajax_clock_small.gif" alt="">');
-
- $('#loadingLogsDialog').dialog({
+ $('#emptyDialog').dialog({
width: 'auto',
height: 'auto',
buttons: {
@@ -1502,18 +1755,24 @@ $(function() {
removeVariables: opts.removeVariables,
limitTypes: opts.limitTypes
},
- function(data) {
- var logData = $.parseJSON(data);
-
+ function(data) {
+ var logData;
+ try {
+ logData = $.parseJSON(data);
+ } catch(err) {
+ return serverResponseError();
+ }
+
if(logData.rows.length != 0) {
runtime.logDataCols = buildLogTable(logData);
/* Show some stats in the dialog */
- $('#loadingLogsDialog').html('<p>' + PMA_messages['strLogDataLoaded'] + '</p>');
+ $('#emptyDialog').attr('title', PMA_messages['strLoadingLogs']);
+ $('#emptyDialog').html('<p>' + PMA_messages['strLogDataLoaded'] + '</p>');
$.each(logData.sum, function(key, value) {
key = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();
if(key == 'Total') key = '<b>' + key + '</b>';
- $('#loadingLogsDialog').append(key + ': ' + value + '<br/>');
+ $('#emptyDialog').append(key + ': ' + value + '<br/>');
});
/* Add filter options if more than a bunch of rows there to filter */
@@ -1551,19 +1810,19 @@ $(function() {
dlgBtns[PMA_messages['strJumpToTable']] = function() {
$(this).dialog("close");
$(document).scrollTop($('div#logTable').offset().top);
- }
-
- $('#loadingLogsDialog').dialog( "option", "buttons", dlgBtns);
-
+ };
+
+ $('#emptyDialog').dialog( "option", "buttons", dlgBtns);
+
} else {
- $('#loadingLogsDialog').html('<p>' + PMA_messages['strNoDataFound'] + '</p>');
-
+ $('#emptyDialog').html('<p>' + PMA_messages['strNoDataFound'] + '</p>');
+
var dlgBtns = {};
- dlgBtns[PMA_messages['strClose']] = function() {
- $(this).dialog("close");
- }
-
- $('#loadingLogsDialog').dialog( "option", "buttons", dlgBtns );
+ dlgBtns[PMA_messages['strClose']] = function() {
+ $(this).dialog("close");
+ };
+
+ $('#emptyDialog').dialog( "option", "buttons", dlgBtns );
}
}
);
@@ -1574,19 +1833,30 @@ $(function() {
if(val.length == 0) textFilter = null;
else textFilter = new RegExp(val, 'i');
-
- var rowSum = 0, totalSum = 0;
-
- var i=0, q;
+
+ var rowSum = 0, totalSum = 0, i=0, q;
var noVars = $('div#logTable input#noWHEREData').attr('checked');
var equalsFilter = /([^=]+)=(\d+|((\'|"|).*?[^\\])\4((\s+)|$))/gi;
var functionFilter = /([a-z0-9_]+)\(.+?\)/gi;
var filteredQueries = {};
var filteredQueriesLines = {};
- var hide = false;
+ var hide = false, rowData;
var queryColumnName = runtime.logDataCols[runtime.logDataCols.length - 2];
var sumColumnName = runtime.logDataCols[runtime.logDataCols.length - 1];
-
+
+ var isSlowLog = opts.src == 'slow';
+ var columnSums = {};
+
+ var countRow = function(query, row) {
+ var cells = row.match(/<td>(.*?)<\/td>/gi);
+ if(!columnSums[query]) columnSums[query] = [0,0,0,0];
+
+ columnSums[query][0] += timeToSec(cells[2].replace(/(<td>|<\/td>)/gi,''));
+ columnSums[query][1] += timeToSec(cells[3].replace(/(<td>|<\/td>)/gi,''));
+ columnSums[query][2] += parseInt(cells[4].replace(/(<td>|<\/td>)/gi,''));
+ columnSums[query][3] += parseInt(cells[5].replace(/(<td>|<\/td>)/gi,''));
+ };
+
// We just assume the sql text is always in the second last column, and that the total count is right of it
$('div#logTable table tbody tr td:nth-child(' + (runtime.logDataCols.length - 1) + ')').each(function() {
if(varFilterChange && $(this).html().match(/^SELECT/i)) {
@@ -1604,10 +1874,23 @@ $(function() {
filteredQueriesLines[q] = i;
$(this).text(q);
}
-
+ if(isSlowLog) countRow(q, $(this).parent().html());
+
+ // Restore original columns
} else {
- $(this).text($(this).parent().data('query')[queryColumnName]);
- $(this).next().text($(this).parent().data('query')[sumColumnName]);
+ rowData = $(this).parent().data('query');
+
+ // SQL Text
+ $(this).text(rowData[queryColumnName]);
+ // #
+ $(this).next().text(rowData[sumColumnName]);
+ // Slow log columns
+ if(isSlowLog) {
+ $(this).parent().children('td:nth-child(3)').text(rowData['query_time']);
+ $(this).parent().children('td:nth-child(4)').text(rowData['lock_time']);
+ $(this).parent().children('td:nth-child(5)').text(rowData['rows_sent']);
+ $(this).parent().children('td:nth-child(6)').text(rowData['rows_examined']);
+ }
}
}
@@ -1633,22 +1916,29 @@ $(function() {
hide = false;
i++;
});
-
+
+ // Update count values of grouped entries
if(varFilterChange) {
if(noVars) {
+ var numCol, row, $table = $('div#logTable table tbody');
$.each(filteredQueriesLines, function(key,value) {
- if(filteredQueries[value] <= 1) return;
-
- var numCol = $('div#logTable table tbody tr:nth-child(' + (value+1) + ')')
- .children(':nth-child(' + (runtime.logDataCols.length) + ')');
-
+ if(filteredQueries[key] <= 1) return;
+
+ row = $table.children('tr:nth-child(' + (value+1) + ')');
+ numCol = row.children(':nth-child(' + (runtime.logDataCols.length) + ')');
numCol.text(filteredQueries[key]);
+
+ if(isSlowLog) {
+ row.children('td:nth-child(3)').text(secToTime(columnSums[key][0]));
+ row.children('td:nth-child(4)').text(secToTime(columnSums[key][1]));
+ row.children('td:nth-child(5)').text(columnSums[key][2]);
+ row.children('td:nth-child(6)').text(columnSums[key][3]);
+ }
});
}
-
- $('div#logTable table').trigger("update");
- setTimeout(function() {
-
+
+ $('div#logTable table').trigger("update");
+ setTimeout(function() {
$('div#logTable table').trigger('sorton',[[[runtime.logDataCols.length - 1,1]]]);
}, 0);
}
@@ -1667,7 +1957,25 @@ $(function() {
removeVariables: true,
limitTypes: true
});*/
-
+
+ function timeToSec(timeStr) {
+ var time = timeStr.split(':');
+ return parseInt(time[0]*3600) + parseInt(time[1]*60) + parseInt(time[2]);
+ }
+
+ function secToTime(timeInt) {
+ hours = Math.floor(timeInt / 3600);
+ timeInt -= hours*3600;
+ minutes = Math.floor(timeInt / 60);
+ timeInt -= minutes*60;
+
+ if(hours < 10) hours = '0' + hours;
+ if(minutes < 10) minutes = '0' + minutes;
+ if(timeInt < 10) timeInt = '0' + timeInt;
+
+ return hours + ':' + minutes + ':' + timeInt;
+ }
+
function buildLogTable(data) {
var rows = data.rows;
var cols = new Array();
@@ -1682,8 +1990,8 @@ $(function() {
return value.replace(/(\[.*?\])+/g,'');
}
return value;
- }
-
+ };
+
for(var i=0; i < rows.length; i++) {
if(i == 0) {
$.each(rows[0],function(key, value) {
@@ -1701,7 +2009,7 @@ $(function() {
for(var j=0; j < cols.length; j++) {
// Assuming the query column is the second last
if(j == cols.length - 2 && rows[i][cols[j]].match(/^SELECT/i)) {
- $tRow.append($tCell=$('<td class="analyzableQuery">' + formatValue(cols[j], rows[i][cols[j]]) + '</td>'));
+ $tRow.append($tCell=$('<td class="linkElem">' + formatValue(cols[j], rows[i][cols[j]]) + '</td>'));
$tCell.click(queryAnalyzer);
} else
$tRow.append('<td>' + formatValue(cols[j], rows[i][cols[j]]) + '</td>');
@@ -1718,13 +2026,17 @@ $(function() {
function queryAnalyzer() {
- var query = $(this).parent().data('query')[cols[cols.length-2]];
+ var query = $(this).parent().data('query').argument || $(this).parent().data('query').sql_text;
+ var db = $(this).parent().data('query').db || '';
/* A very basic SQL Formatter. Totally fails in the cases of
- - Any string appearance containing a MySQL Keyword, surrounded by whitespaces
+ - Any string appearance containing a MySQL Keyword, surrounded by whitespaces, e.g. WHERE bar = "This where the formatter fails"
- Subqueries too probably
*/
- // .* selector doesn't includde whitespace, [^] doesn't work in IE8, thus we use [^\0] since the zero-byte char (hopefully) doesn't appear in table names ;)
+
+ // Matches the columns to be selected
+ // .* selector doesn't include whitespace and we have no PCRE_DOTALL modifier, (.|\s)+ crashes Chrome (reported and confirmed),
+ // [^]+ results in JS error in IE8, thus we use [^\0]+ for matching each column since the zero-byte char (hopefully) doesn't appear in column names ;)
var sLists = query.match(/SELECT\s+[^\0]+\s+FROM\s+/gi);
if(sLists) {
for(var i=0; i < sLists.length; i++) {
@@ -1752,7 +2064,8 @@ $(function() {
$.post('server_status.php?'+url_query, {
ajax_request: true,
query_analyzer: true,
- query: codemirror_editor.getValue()
+ query: codemirror_editor.getValue(),
+ database: db
}, function(data) {
data = $.parseJSON(data);
var totalTime = 0;
@@ -1765,15 +2078,40 @@ $(function() {
// Float sux, I'll use table :(
$('div#queryAnalyzerDialog div.placeHolder')
.html('<table width="100%" border="0"><tr><td class="explain"></td><td class="chart"></td></tr></table>');
+
+ var explain = '<b>Explain output</b> '+explain_docu;
+ if(data.explain.length > 1) {
+ explain += ' (';
+ for(var i=0; i < data.explain.length; i++) {
+ if(i > 0) explain += ', ';
+ explain += '<a href="#showExplain-' + i + '">' + i + '</a>';
+ }
+ explain += ')';
+ }
+ explain +='<p></p>';
+ for(var i=0; i < data.explain.length; i++) {
+ explain += '<div class="explain-' + i + '"' + (i>0? 'style="display:none;"' : '' ) + '>';
+ $.each(data.explain[i], function(key,value) {
+ value = (value==null)?'null':value;
+
+ if(key == 'type' && value.toLowerCase() == 'all') value = '<span class="attention">' + value +'</span>';
+ if(key == 'Extra') value = value.replace(/(using (temporary|filesort))/gi,'<span class="attention">$1</span>');
+ explain += key+': ' + value + '<br />';
+ });
+ explain += '</div>';
+ }
+
+ // Since there is such a nice free space below the explain, lets put it here for now
+ explain += '<p><b>' + PMA_messages['strAffectedRows'] + '</b> ' + data.affectedRows;
- var explain = '<b>Explain output</b><p></p>';
- $.each(data.explain, function(key,value) {
- value = (value==null)?'null':value;
-
- explain += key+': ' + value + '<br />';
- });
$('div#queryAnalyzerDialog div.placeHolder td.explain').append(explain);
-
+
+ $('div#queryAnalyzerDialog div.placeHolder a[href*="#showExplain"]').click(function() {
+ var id = $(this).attr('href').split('-')[1];
+ $(this).parent().find('div[class*="explain"]').hide();
+ $(this).parent().find('div[class*="explain-' + id + '"]').show();
+ });
+
if(data.profiling) {
var chartData = [];
var numberTable = '<table class="queryNums"><thead><tr><th>Status</th><th>Time</th></tr></thead><tbody>';
@@ -1789,9 +2127,9 @@ $(function() {
}
numberTable += '<tr><td><b>Total time:</b></td><td>' + PMA_prettyProfilingNum(totalTime,2) + '</td></tr>';
numberTable += '</tbody></table>';
-
- $('div#queryAnalyzerDialog div.placeHolder td.chart').append('<b>Profiling results</b> (<a href="#showNums">Table</a> | <a href="#showChart">Chart</a>)<br/>' + numberTable + ' <div id="queryProfiling"></div>');
-
+
+ $('div#queryAnalyzerDialog div.placeHolder td.chart').append('<b>Profiling results ' + profiling_docu + '</b> (<a href="#showNums">Table</a>, <a href="#showChart">Chart</a>)<br/>' + numberTable + ' <div id="queryProfiling"></div>');
+
$('div#queryAnalyzerDialog div.placeHolder a[href="#showNums"]').click(function() {
$('div#queryAnalyzerDialog div#queryProfiling').hide();
$('div#queryAnalyzerDialog table.queryNums').show();
@@ -1883,10 +2221,14 @@ $(function() {
$('a[href="#clearMonitorConfig"]').show();
}
- $('a[href="#clearMonitorConfig"]').click(function() {
- window.localStorage.removeItem('monitorCharts');
- window.localStorage.removeItem('monitorSettings');
- $(this).hide();
- });
-
+ function serverResponseError() {
+ var btns = {};
+ btns[PMA_messages['strReloadPage']] = function() {
+ window.location.reload();
+ };
+ $('#emptyDialog').attr('title',PMA_messages['strRefreshFailed']);
+ $('#emptyDialog').html('<img class="icon ic_s_attention" src="themes/dot.gif" alt=""> ' + PMA_messages['strInvalidResponseExplanation'])
+ $('#emptyDialog').dialog({ buttons: btns });
+ }
+
});
diff --git a/js/server_variables.js b/js/server_variables.js
index e9bc1cf..8776440 100644
--- a/js/server_variables.js
+++ b/js/server_variables.js
@@ -129,7 +129,7 @@ $(function() {
$('#filterText').keyup(function(e) {
if($(this).val().length==0) textFilter=null;
- else textFilter = new RegExp("(^| )"+$(this).val().replace('_',' '),'i');
+ else textFilter = new RegExp("(^| )"+$(this).val().replace(/_/g,' '),'i');
filterVariables();
});
diff --git a/libraries/advisor.lib.php b/libraries/advisor.lib.php
new file mode 100644
index 0000000..165f068
--- /dev/null
+++ b/libraries/advisor.lib.php
@@ -0,0 +1,198 @@
+<?php
+
+class Advisor {
+ var $variables;
+ var $parseResult;
+ var $runResult;
+
+ function run() {
+ // HowTo: A simple Advisory system in 3 easy steps.
+
+ // Step 1: Get some variables to evaluate on
+ $this->variables = array_merge(PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1), PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1));
+ // Step 2: Read and parse the list of rules
+ $this->parseResult = $this->parseRulesFile();
+ // Step 3: Feed the variables to the rules and let them fire. Sets $runResult
+ $this->runRules();
+
+ /* echo '<br/><hr>';
+ echo 'Total rules: '.count($this->parseResult['rules']).' <br><br>';
+ echo '<b>Possible performance issues</b><br/>';
+ foreach($this->runResult['fired'] as $rule) {
+ echo $rule['issue'].'<br />';
+ }
+ echo '<br/><b>Rules not checked due to unmet preconditions</b><br/>';
+ foreach($this->runResult['unchecked'] as $rule) {
+ echo $rule['name'].'<br />';
+ }
+ echo '<br/><b>Rules that didn\'t fire</b><br/>';
+ foreach($this->runResult['notfired'] as $rule) {
+ echo $rule['name'].'<br />';
+ }
+
+ if($this->runResult['errors'])
+ echo 'There were errors while testing the rules.';
+ */
+ return $this->runResult;
+ }
+
+ function runRules() {
+ $this->runResult = array( 'fired' => array(), 'notfired' => array(), 'unchecked'=> array(), 'errors' => array() );
+
+ foreach($this->parseResult['rules'] as $rule) {
+ $this->variables['value'] = 0;
+ $precond = true;
+
+ if(isset($rule['precondition'])) {
+ try {
+ $precond = $this->ruleExprEvaluate($rule['precondition']);
+ } catch (Exception $e) {
+ $this->runResult['errors'][] = 'Failed evaluating precondition for rule \''.$rule['name'].'\'. PHP threw following error: '.$e->getMessage();
+ continue;
+ }
+ }
+
+ if(! $precond)
+ $this->addRule('unchecked', $rule);
+ else {
+ try {
+ $value = $this->ruleExprEvaluate($rule['formula']);
+ } catch(Exception $e) {
+ $this->runResult['errors'][] = 'Failed calculating value for rule \''.$rule['name'].'\'. PHP threw following error: '.$e->getMessage();
+ continue;
+ }
+
+ $this->variables['value'] = $value;
+
+ try {
+ if($this->ruleExprEvaluate($rule['test']))
+ $this->addRule('fired', $rule);
+ else $this->addRule('notfired', $rule);
+ } catch(Exception $e) {
+ $this->runResult['errors'][] = 'Failed running test for rule \''.$rule['name'].'\'. PHP threw following error: '.$e->getMessage();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function addRule($type, $rule) {
+ switch($type) {
+ case 'notfired':
+ case 'fired':
+ $jst = preg_split('/\s*\|\s*/',$rule['justification'],2);
+ if(count($jst) > 1) {
+ $jst[0] = preg_replace('/%( |,|\.|$)/','%%\1',$jst[0]);
+ try {
+ $str = $this->ruleExprEvaluate('sprintf("'.$jst[0].'",'.$jst[1].')',strlen('sprintf("'.$jst[0].'"'));
+ } catch (Exception $e) {
+ $this->runResult['errors'][] = 'Failed formattingstring for rule \''.$rule['name'].'\'. PHP threw following error: '.$e->getMessage();
+ return;
+ }
+
+ $rule['justification'] = $str;
+ }
+ break;
+ }
+
+ $this->runResult[$type][] = $rule;
+ }
+
+ // Runs a code expression, replacing variable names with their respective values
+ // ignoreUntil: if > 0, it doesn't replace any variables until that string position, but still evaluates the whole expr
+ function ruleExprEvaluate($expr, $ignoreUntil) {
+ if($ignoreUntil > 0) {
+ $exprIgnore = substr($expr,0,$ignoreUntil);
+ $expr = substr($expr,$ignoreUntil);
+ }
+ $old=$expr;
+ $expr = preg_replace('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie','1',$expr); //isset($this->runResult[\'fired\']
+ $expr = preg_replace('/\b(\w+)\b/e','isset($this->variables[\'\1\']) ? (!is_numeric($this->variables[\'\1\']) ? \'"\'.$this->variables[\'\1\'].\'"\' : $this->variables[\'\1\']) : \'\1\'', $expr);
+ if($ignoreUntil > 0){
+ $expr = $exprIgnore . $expr;
+ }
+ $value = 0;
+ $err = 0;
+ ob_start();
+ eval('$value = '.$expr.';');
+ $err = ob_get_contents();
+ ob_end_clean();
+ if($err) throw new Exception(strip_tags($err) . '<br />Executed code: $value = '.$expr.';');
+ return $value;
+ }
+
+ function parseRulesFile() {
+ $file = file('libraries/advisory_rules.txt');
+ $errors = array();
+ $rules = array();
+ $ruleSyntax = array('name','formula','test','issue','recommendation','justification');
+ $numRules = count($ruleSyntax);
+ $numLines = count($file);
+ $j = -1;
+ $ruleLine = -1;
+
+ for($i = 0; $i<$numLines; $i++) {
+ $line = $file[$i];
+ if($line[0] == '#' || $line[0] == "\n") continue;
+
+ // Reading new rule
+ if(substr($line, 0, 4) == 'rule') {
+ if($ruleLine > 0) { $errors[] = 'Invalid rule declaration on line '.($i+1). ', expected line '.$ruleSyntax[$ruleLine++].' of previous rule' ; continue; }
+ $ruleLine = 1;
+ if(preg_match("/rule\s'(.*)'( \[(.*)\])?$/",$line,$match)) {
+ $j++;
+ $rules[$j] = array( 'name' => $match[1]);
+ if(isset($match[3])) $rules[$j]['precondition'] = $match[3];
+ } else {
+ $errors[] = 'Invalid rule declaration on line '.($i+1);
+ }
+ continue;
+ } else {
+ if($ruleLine == -1) $errors[] = 'Unexpected characters on line '.($i+1);
+ }
+
+ // Reading rule lines
+ if($ruleLine > 0) {
+ if(!isset($line[0])) continue; // Empty lines are ok
+ // Non tabbed lines are not
+ if($line[0] != "\t") { $errors[] = 'Unexpected character on line '.($i+1).'. Expected tab, but found \''.$line[0].'\''; continue; }
+ $rules[$j][$ruleSyntax[$ruleLine++]] = chop(substr($line,1));
+ }
+
+ // Rule complete
+ if($ruleLine == $numRules) {
+ $ruleLine = -1;
+ }
+ }
+
+ return array('rules' => $rules, 'errors' => $errors);
+ }
+}
+
+function PMA_bytime($num, $precision) {
+ $per = '';
+ if ($num >= 1) { # per second
+ $per = "per second";
+ }
+ elseif ($num*60 >= 1) { # per minute
+ $num = $num*60;
+ $per = "per minute";
+ }
+ elseif ($num*60*60 >=1 ) { # per hour
+ $num = $num*60*60;
+ $per = "per hour";
+ }
+ else {
+ $num = $num*60*60*24;
+ $per = "per day";
+ }
+
+ $num = round($num, $precision);
+
+ if($num == 0) $num = '<'.pow(10,-$precision);
+
+ return "$num $per";
+}
+
+?>
\ No newline at end of file
diff --git a/libraries/advisory_rules.txt b/libraries/advisory_rules.txt
new file mode 100644
index 0000000..309c1c1
--- /dev/null
+++ b/libraries/advisory_rules.txt
@@ -0,0 +1,427 @@
+# phpMyAdmin Advisory rules file
+# Use only UNIX style newlines
+# This file is being parsed by advisor.lib.php, which should handle syntax errors correctly.
+# However, PHP Warnings and the like are being consumed by the phpMyAdmin error handler, so those won't show up
+# E.g.: Justification line is empty because you used an unescape percent sign, sprintf() returns an empty string and no warning/error is shown
+#
+# Rule Syntax:
+# 'rule' identifier[the name of the rule] eexpr [an optional precondition]
+# expr [variable or value calculation used for the test]
+# expr [test, if evaluted to 'true' it fires the rule. Use 'value' to insert the calculated value (without quotes)]
+# string [the issue (what is the problem?)]
+# string [the recommendation (how do i fix it?)]
+# formatted-string '|' comma-seperated-expr [the justification (result of the calculated value / why did this rule fire?)]
+
+# comma-seperated-expr: expr(,expr)*
+# eexpr: [expr] - expr enclosed in []
+# expr: a php code literal with extras:
+# - variable names are replaced with their respective values
+# - fired('name of rule') is replaced with true/false when given rule has been fired. Note however that this is a very simple rules engine. Rules are only checked in sequential order as they are written down here. If given rule has not been checked yet, fired() will always evaluate to false
+# - 'value' is replaced with the calculated value. If it is a string, it will be put within single quotes
+# - other than that you may use any php function, initialized variable or constant
+#
+# identifier: A string enclosed in single quotes
+# string: A quoteless string, may contain HTML. Variable names enclosed in curly braces are replaced with links to directly edit this variable. e.g. {tmp_table_size}
+# formatted-string: You may use classic php sprintf() string formatting here, the arguments must be appended after a trailing pipe (|) as mentioned in above syntax
+# percent signs (%) are automatically escaped (%%) in the following cases: When followed by a space, dot or comma and at the end of the line)
+#
+# Comments start with #
+#
+
+
+# Queries
+
+rule 'Uptime below one day'
+ Uptime
+ value < 86400
+ Uptime is less than 1 day, performance tuning may not be accurate.
+ To have more accurate averages it is recommended to let the server run for longer than a day before running this analyzer
+ The uptime is only %s | PMA_timespanFormat(Uptime)
+
+rule 'Questions below 1,000'
+ Questions
+ value < 1000
+ Fewer than 1,000 questions have been run against this server. The recommendations may not be accurate.
+ Let the server run for a longer time until it has executed a greater amount of queries.
+ Current amount of Questions: %s | Questions
+
+rule '% slow queries' [Questions > 0]
+ Slow_queries / Questions * 100
+ value >= 5
+ There is a lot of slow queries compared to the overall amount of Queries.
+ You might want to increase {long_query_time} or optimize the queries listed in the slow query log
+ The slow query rate should be below 5%, your value is %s%. | round(value,2)
+
+rule 'slow query rate' [Questions > 0]
+ (Slow_queries / Questions * 100) / Uptime
+ value * 60 * 60 > 1
+ There is a high percentage of slow queries compared to the server uptime.
+ You might want to increase {long_query_time} or optimize the queries listed in the slow query log
+ You have a slow query rate of %s per hour, you should have less than 1% per hour. | PMA_bytime(value,2)
+
+rule 'Long query time'
+ long_query_time
+ value >= 10
+ long_query_time is set to 10 seconds or more, thus only slow queries that take above 10 seconds are logged.
+ It is suggested to set {long_query_time} to a lower value, depending on your enviroment. Usually a value of 1-5 seconds is suggested.
+ long_query_time is currently set to %ss. | value
+
+rule 'Slow query logging'
+ log_slow_queries
+ value == 'OFF'
+ The slow query log is disabled.
+ Enable slow query logging by setting {log_slow_queries} to 'ON'. This will help troubleshooting badly performing queries.
+ log_slow_queries is set to 'OFF'
+
+#
+# versions
+rule 'Release Series'
+ version
+ !PMA_DRIZZLE && substr(value,0,3) != "5.1"
+ The MySQL server version less then 5.1.
+ You should upgrade, as MySQL 5.1 has improved performance, and MySQL 5.5 even more so.
+ Current version: %s | value
+
+rule 'Minor Version'
+ version
+ !PMA_DRIZZLE && substr(value,4,2) < 30
+ Version less then 5.1.30 (the first GA release of 5.1).
+ You should upgrade, as recent versions of MySQL 5.1 have improved performance and MySQL 5.5 even more so.
+ Current version: %s | value
+
+rule 'Distribution'
+ version_comment
+ preg_match('/source/i',value)
+ Version is compiled from source, not a MySQL official binary. If you did not compile from source, you may be using a package modified by a distribution.
+ The MySQL manual only is accurate for official MySQL binaries, not any package distributions (such as RedHat, Debian/Ubuntu etc).
+ 'source' found in version_comment
+
+rule 'Distribution'
+ version_comment
+ preg_match('/percona/i',value)
+ The MySQL manual only is accurate for official MySQL binaries.
+ Percona documentation is at http://www.percona.com/docs/wiki/
+ 'percona' found in version_comment
+
+rule 'MySQL Architecture'
+ system_memory
+ value > 3072 && !preg_match('/64/',version_compile_machine)
+ MySQL is not compiled as a 64-bit package, though your memory capacity is above 3 GiB.
+ MySQL might not be able to access all of your memory. You might want to consider installing the 64-bit version of MySQL.
+ Available memory on this host: %s | implode(' ',PMA_formatByteDown(value*1024*1024, 2, 2))
+
+#
+# Query cache
+
+# Lame: 'ON' == 0 is true, so you need to compare 'ON' == '0'
+rule 'Query cache disabled'
+ query_cache_size
+ value == 0 || query_cache_type == 'OFF' || query_cache_type == '0'
+ The query cache is not enabled.
+ The query cache is known to greatly improve performance if configured correctly. Enable it by setting {query_cache_size} to a 2 digit MiB value and setting {query_cache_type} to 'ON'
+ query_cache_size is set to 0 or query_cache_type is set to 'OFF'
+
+rule 'Query cache efficiency (%)' [Com_select + Qcache_hits > 0 && !fired('Query cache disabled')]
+ Qcache_hits / (Com_select + Qcache_hits) * 100
+ value < 20
+ Query cache not running efficiently, it has a low hit rate.
+ Consider increasing {query_cache_limit}.
+ The current query cache hit rate of %s% is below 20% | round(value,1)
+
+rule 'Query Cache usage' [!fired('Query cache disabled')]
+ 100 - Qcache_free_memory / query_cache_size * 100
+ value < 80
+ Less than 80% of the query cache is being utilized.
+ This might be caused by {query_cache_limit} being too low. Flushing the query cache might help as well.
+ The current ratio of free query cache memory to total query cache size is %s%. It should be above 80% | round(value,1)
+
+rule 'Query cache fragmentation' [!fired('Query cache disabled')]
+ Qcache_free_blocks / (Qcache_total_blocks / 2) * 100
+ value > 20
+ The query cache is considerably fragmented.
+ Severe fragementation is likely to (further) increase Qcache_lowmem_prunes. This might be caused by many Query cache low memory prunes due to {query_cache_size} being too small. For a immediate but short lived fix you can flush the query cache (might lock the query cache for a long time). Carefully adjusting {query_cache_min_res_unit} to a lower value might help too, e.g. you can set it to the average size of your queries in the cache using this formula: (query_cache_size � qcache_free_memory) / qcache_queries_in_cache
+ The cache is currently fragmented by %s% , with 100% fragmentation meaning that the query cache is an alternating pattern of free and used blocks. This value should be below 20%. | round(value,1)
+
+rule 'Query cache low memory prunes' [Qcache_inserts > 0 && !fired('Query cache disabled')]
+ Qcache_lowmem_prunes / Qcache_inserts * 100
+ value > 0.1
+ Cached queries are removed due to low query cache memory from the query cache.
+ You might want to increase {query_cache_size}, however keep in mind that the overhead of maintaining the cache is likely to increase with its size, so do this in small increments and monitor the results.
+ The ratio of removed queries to inserted queries is %s%. The lower this value is, the better (This rules firing limit: 0.1%) | round(value,1)
+
+rule 'Query cache max size' [!fired('Query cache disabled')]
+ query_cache_size
+ value > 1024 * 128
+ The query cache size is above 128 MiB. Big query caches may cause significant overhead that is required to maintain the cache.
+ Depending on your enviroment, it might be performance increasing to reduce this value.
+ Current query cache size: %s | implode(' ',PMA_formatByteDown(value, 2, 2))
+
+rule 'Query cache min result size' [!fired('Query cache disabled')]
+ value == 1024*1024
+ query_cache_limit
+ The max size of the result set in the query cache is the default of 1 MiB.
+ Changing {query_cache_limit} (usually by increasing) may increase efficiency. This variable determines the maximum size a query result may have to be inserted into the query cache. If there are many query results above 1 MiB that are well cacheable (many reads, little writes) then increasing {query_cache_limit} will increase efficiency. Whereas in the case of many query results being above 1 MiB that are not very well cacheable (often invalidated due to table updates) increasing {query_cache_limit} might reduce efficiency.
+ query_cache_limit is set to 1 MiB
+
+#
+# Sorts
+rule '% sorts that cause temporary tales' [Sort_scan + Sort_range > 0]
+ Sort_merge_passes / (Sort_scan + Sort_range) * 100
+ value > 10
+ Too many sorts are causing temporary tables.
+ Consider increasing sort_buffer_size and/or read_rnd_buffer_size, depending on your system memory limits
+ %s% of all sorts cause temporary tables, this value should be lower than 10%. | round(value,1)
+
+rule 'rate of sorts that cause temporary tables'
+ Sort_merge_passes / Uptime
+ value * 60 * 60 > 1
+ Too many sorts are causing temporary tables.
+ Consider increasing sort_buffer_size and/or read_rnd_buffer_size, depending on your system memory limits
+ Temporary tables average: %s, this value should be less than 1 per hour. | PMA_bytime(value,2)
+
+rule 'Sort rows'
+ Sort_rows / Uptime
+ value * 60 >= 1
+ There are lots of rows being sorted.
+ While there is nothing wrong with a high amount of row sorting, you might want to make sure that the queries which require a lot of sorting use indexed fields in the ORDER BY clause, as this will result in much faster sorting
+ Sorted rows average: %s | PMA_bytime(value,2)
+
+# Joins, scans
+rule 'rate of joins without indexes'
+ (Select_range_check + Select_scan + Select_full_join) / Uptime
+ value * 60 * 60 > 1
+ There are too many joins without indexes.
+ This means that joins are doing full table scans. Adding indexes for the fields being used in the join conditions will greatly speed up the table joins
+ Table joins average: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+rule 'rate of reading first index entry'
+ Handler_read_first / Uptime
+ value * 60 * 60 > 1
+ The rate of reading the first index entry is high.
+ This usually indicates frequent full index scans. Full index scans are faster than table scans but require lots of cpu cycles in big tables, if those tables that have or had high volumes of UPDATEs and DELETEs, running 'OPTIMIZE TABLE' might reduce the amount of and/or speed up full index scans. Other than that full index scans can only be reduced by rewriting queries.
+ Index scans average: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+rule 'rate of reading fixed position'
+ Handler_read_rnd / Uptime
+ value * 60 * 60 > 1
+ The rate of reading data from a fixed position is high.
+ This indicates many queries need to sort results and/or do a full table scan, including join queries that do not use indexes. Add indexes where applicable.
+ Rate of reading fixed position average: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+rule 'rate of reading next table row'
+ Handler_read_rnd_next / Uptime
+ value * 60 * 60 > 1
+ The rate of reading the next table row is high.
+ This indicates many queries are doing full table scans. Add indexes where applicable.
+ Rate of reading next table row: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+# temp tables
+rule 'tmp_table_size vs. max_heap_table_size'
+ tmp_table_size - max_heap_table_size
+ value !=0
+ tmp_table_size and max_heap_table_size are not the same.
+ If you have deliberatly changed one of either: The server uses the lower value of either to determine the maximum size of in-memory tables. So if you wish to increse the in-memory table limit you will have to increase the other value as well.
+ Current values are tmp_table_size: %s, max_heap_table_size: %s | implode(' ',PMA_formatByteDown(tmp_table_size, 2, 2)), implode(' ',PMA_formatByteDown(max_heap_table_size, 2, 2))
+
+rule '% temp disk tables' [Created_tmp_tables + Created_tmp_disk_tables > 0]
+ Created_tmp_disk_tables / (Created_tmp_tables + Created_tmp_disk_tables) * 100
+ value > 25
+ Many temporary tables are being written to disk instead of being kept in memory.
+ Increasing {max_heap_table_size} and {tmp_table_size} might help. However some temporary tables are always being written to disk, independent of the value of these variables. To elminiate these you will have to rewrite your queries to avoid those conditions (Within a temprorary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in the beginning of an <a href="http://www.facebook.com/note.php?note_id=10150111255065841&comments">Article by the Pythian Group</a>
+ %s% of all temporary tables are being written to disk, this value should be below 25% | round(value,1)
+
+rule 'temp disk rate'
+ Created_tmp_disk_tables / Uptime
+ value * 60 * 60 > 1
+ Many temporary tables are being written to disk instead of being kept in memory.
+ Increasing {max_heap_table_size} and {tmp_table_size} might help. However some temporary tables are always being written to disk, independent of the value of these variables. To elminiate these you will have to rewrite your queries to avoid those conditions (Within a temprorary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in in the <a href="http://dev.mysql.com/doc/refman/5.0/en/internal-temporary-tables.html">MySQL Documentation</a>
+ Rate of temporay tables being written to disk: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+# I couldn't find any source on the internet that suggests a direct relation between high counts of temporary tables and any of these variables.
+# Several independent Blog entries suggest (http://ronaldbradford.com/blog/more-on-understanding-sort_buffer_size-2010-… and http://www.xaprb.com/blog/2010/05/09/how-to-tune-mysqls-sort_buffer_size/)
+# that sort_buffer_size should be left as it is. And increasing read_buffer_size is only suggested when there are a lot of
+# table scans (http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_… and other sources) though
+# setting it too high is bad too (http://www.mysqlperformanceblog.com/2007/09/17/mysql-what-read_buffer_size-…)
+#rule 'temp table rate'
+# Created_tmp_tables / Uptime
+# value * 60 * 60 > 1
+# Many intermediate temporary tables are being created.
+# This may be caused by queries under certain conditions as mentioned in the <a href="http://dev.mysql.com/doc/refman/5.0/en/internal-temporary-tables.html">MySQL Documentation</a>. Consider increasing {sort_buffer_size} (sorting), {read_rnd_buffer_size} (random read buffer, ie, post-sort), {read_buffer_size} (sequential scan).
+
+#
+# MyISAM index cache
+rule 'MyISAM key buffer size'
+ key_buffer_size
+ value == 0
+ Key buffer is not initialized. No MyISAM indexes will be cached.
+ Set {key_buffer_size} depending on the size of your MyISAM indexes. 64M is a good start.
+ key_buffer_size is 0
+
+rule 'max % MyISAM key buffer ever used' [key_buffer_size > 0]
+ Key_blocks_used * key_cache_block_size / key_buffer_size * 100
+ value < 95
+ MyISAM key buffer (index cache) % used is low.
+ You may need to decrease the size of {key_buffer_size}, re-examine your tables to see if indexes have been removed, or examine queries and expectations about what indexes are being used.
+ max % MyISAM key buffer ever used: %s, this value should be above 95% | round(value,1)
+
+# Don't fire if above rule fired - we don't need the same advice twice
+rule '% MyISAM key buffer used' [key_buffer_size > 0 && !fired('max % MyISAM key buffer ever used')]
+ ( 1 - Key_blocks_unused * key_cache_block_size / key_buffer_size) * 100
+ value < 95
+ MyISAM key buffer (index cache) % used is low.
+ You may need to decrease the size of {key_buffer_size}, re-examine your tables to see if indexes have been removed, or examine queries and expectations about what indexes are being used.
+ % MyISAM key buffer used: %s, this value should be above 95% | round(value,1)
+
+rule '% index reads from memory' [Key_read_requests > 0]
+ 100 - (Key_reads / Key_read_requests * 100)
+ value < 95
+ The % of indexes that use the MyISAM key buffer is low.
+ You may need to increase {key_buffer_size}.
+ Index reads from memory: %s%, this value should be above 95% | round(value,1)
+
+#
+# other caches
+rule 'rate of table open'
+ Opened_tables / Uptime
+ value*60*60 > 10
+ The rate of opening tables is high.
+ Opening tables requires disk I/O which is costly. Increasing {table_open_cache} might avoid this.
+ Opened table rate: %s, this value should be less than 10 per hour | PMA_bytime(value,2)
+
+rule '% open files'
+ Open_files / open_files_limit * 100
+ value > 85
+ The number of open files is approaching the max number of open files. You may get a "Too many open files" error.
+ Consider increasing {open_files_limit}, and check the error log when restarting after changing open_files_limit.
+ The number of opened files is at %s% of the limit. It should be below 85% | round(value,1)
+
+rule 'rate of open files'
+ Open_files / Uptime
+ value * 60 * 60 > 5
+ The rate of opening files is high.
+ Consider increasing {open_files_limit}, and check the error log when restarting after changing open_files_limit.
+ Opened files rate: %s, this value should be less than 5 per hour | PMA_bytime(value,2)
+
+rule 'Immediate table locks %' [Table_locks_waited + Table_locks_immediate > 0]
+ Table_locks_immediate / (Table_locks_waited + Table_locks_immediate) * 100
+ value < 95
+ Too many table locks were not granted immediately.
+ Optimize queries and/or use InnoDB to reduce lock wait.
+ Immediate table locks: %s%, this value should be above 95% | round(value,1)
+
+rule 'Table lock wait rate'
+ Table_locks_waited / Uptime
+ value * 60 * 60 > 1
+ Too many table locks were not granted immediately.
+ Optimize queries and/or use InnoDB to reduce lock wait.
+ Table lock wait rate: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+rule 'thread cache'
+ thread_cache_size
+ value < 1
+ Thread cache is disabled, resulting in more overhead from new connections to MySQL.
+ Enable the thread cache by setting {thread_cache_size} > 0.
+ The thread cache is set to 0
+
+rule 'thread cache hit rate %' [thread_cache_size > 0]
+ 100 - Threads_created / Connections
+ value < 80
+ Thread cache is not efficient.
+ Increase {thread_cache_size}.
+ Thread cache hitrate: %s%, this value should be above 80% | round(value,1)
+
+rule 'Threads that are slow to launch' [slow_launch_time > 0]
+ Slow_launch_threads
+ value > 0
+ There are too many threads that are slow to launch.
+ This generally happens in case of general system overload as it is pretty simple operations. You might want to monitor your system load carefully.
+ %s thread(s) took longer than %s seconds to start, it should be 0 | value, slow_launch_time
+
+rule 'Slow launch time'
+ slow_launch_time
+ value > 2
+ Slow_launch_threads is above 2s
+ Set slow_launch_time to 1s or 2s to correctly count threads that are slow to launch
+ slow_launch_time is set to %s | value
+
+#
+#Connections
+rule '% connections used'
+ Max_used_connections / max_connections * 100
+ value > 80
+ The maximum amount of used connnections is getting close to the value of max_connections.
+ Increase max_connections, or decrease wait_timeout so that connections that do not close database handlers properly get killed sooner. Make sure the code closes database handlers properly.
+ Max_used_connections is at %s% of max_connections, it should be below 80% | round(value,1)
+
+rule '% aborted connections'
+ Aborted_connects / Connections * 100
+ value > 1
+ Too many connections are aborted.
+ Connections are usually aborted when they cannot be authorized. <a href="http://www.mysqlperformanceblog.com/2008/08/23/how-to-track-down-the-source…">This article</a> might help you track down the source.
+ %s% of all connections are aborted. This value should be below 1% | round(value,1)
+
+rule 'rate of aborted connections'
+ Aborted_connects / Uptime
+ value * 60 * 60 > 1
+ Too many connections are aborted
+ Connections are usually aborted when they cannot be authorized. <a href="http://www.mysqlperformanceblog.com/2008/08/23/how-to-track-down-the-source…">This article</a> might help you track down the source.
+ Aborted connections rate is at %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+rule '% aborted clients'
+ Aborted_clients / Connections * 100
+ value > 2
+ Too many clients are aborted.
+ Clients are usually aborted when they did not close their connection to MySQL properly. This can be due to network issues or code not closing a database handler properly. Check your network and code.
+ %s% of all clients are aborted. This value should be below 2% | round(value,1)
+
+rule 'rate of aborted clients'
+ Aborted_clients / Uptime
+ value * 60 * 60 > 1
+ Too many clients are aborted.
+ Clients are usually aborted when they did not close their connection to MySQL properly. This can be due to network issues or code not closing a database handler properly. Check your network and code.
+ Aborted client rate is at %s, this value should be less than 1 per hour | PMA_bytime(value,2)
+
+#
+# InnoDB
+rule 'Is InnoDB disabled?'
+ have_innodb
+ value != "YES"
+ You do not have InnoDB enabled.
+ InnoDB is usually the better choice for table engines.
+ have_innodb is set to 'value'
+
+rule '% InnoDB log size' [innodb_buffer_pool_size > 0]
+ innodb_log_file_size / innodb_buffer_pool_size * 100
+ value < 20
+ The InnoDB log file size is not an appropriate size, in relation to the InnoDB buffer pool.
+ Especiallay one a system with a lot of writes to InnoDB tables you shoud set innodb_log_file_size to 25% of {innodb_buffer_pool_size}. However the bigger this value, the longer the recovery time will be when database crashes, so this value should not be set much higher than 256 MiB. Please note however that you cannot simply change the value of this variable. You need to shutdown the server, remove the InnoDB log files, set the new value in my.cnf, start the server, then check the error logs if everything went fine. See also <a href="http://mysqldatabaseadministration.blogspot.com/2007/01/increase-innodblogf…">this blog entry</a>
+ Your InnoDB log size is at %s% in relation to the InnoDB buffer pool size, it should not be below 20% | round(value,1)
+
+rule 'Max InnoDB log size' [innodb_buffer_pool_size > 0 && innodb_log_file_size / innodb_buffer_pool_size * 100 < 30]
+ innodb_log_file_size / (1024 * 1024)
+ value >= 128
+ The InnoDB log file size is inadequately large.
+ It is usually sufficient to set innodb_log_file_size to 25% of the size of {innodb_buffer_pool_size}. A very innodb_log_file_size slows down the recovery time after a database crash considerably. See also <a href="http://www.mysqlperformanceblog.com/2006/07/03/choosing-proper-innodb_log_f…">this Article</a>. You need to shutdown the server, remove the InnoDB log files, set the new value in my.cnf, start the server, then check the error logs if everything went fine. See also <a href="http://mysqldatabaseadministration.blogspot.com/2007/01/increase-innodblogf…">this blog entry</a>
+ Your absolute InnoD log size is %s MiB | round(value,1)
+
+rule 'InnoDB buffer pool size' [system_memory > 0]
+ innodb_buffer_pool_size / system_memory * 100
+ value < 60
+ Your InnoDB buffer pool is fairly small.
+ The InnoDB buffer pool has a profound impact on perfomance for InnoDB tables. Assign all your remaining memory to this buffer. For database servers that use solely InnoDB as storage engine and have no other services (e.g. a web server) running, you may set this as high as 80% of your available memory. If that is not the case, you need to carefully assess the memory consumption of your other services and non-InnoDB-Tables and set this variable accordingly. If it is set too high, your system will start swapping, which decreases performance significantly. See also <a href="http://www.mysqlperformanceblog.com/2007/11/03/choosing-innodb_buffer_pool_…">this article</a>
+ You are currently using %s% of your memory for the InnoDB buffer pool. This rule fires if you are assigning less than 60%, however this might be perfectly adequate for your system if you don't have much InnoDB tables or other services running on the same machine.
+
+#
+# other
+rule 'MyISAM concurrent inserts'
+ concurrent_insert
+ value == 0
+ Enable concurrent_insert by setting it to 1
+ Setting {concurrent_insert} to 1 reduces contention between readers and writers for a given table. See also <a href="http://dev.mysql.com/doc/refman/5.0/en/concurrent-inserts.html">MySQL Documentation</a>
+ concurrent_insert is set to 0
+
+# INSERT DELAYED USAGE
+#Delayed_errors 0
+#Delayed_insert_threads 0
+#Delayed_writes 0
+#Not_flushed_delayed_rows
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
index a6ed8ed..ff63999 100644
--- a/libraries/header.inc.php
+++ b/libraries/header.inc.php
@@ -71,6 +71,7 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
</head>
<body>
+ <div id="frameExpand" style="display:none;"><img src="themes/pmahomme/img/frame-expand.png"></div>
<?php
// Include possible custom headers
diff --git a/libraries/server_variables_doc.php b/libraries/server_variables_doc.php
index d705d39..dbd19eb 100644
--- a/libraries/server_variables_doc.php
+++ b/libraries/server_variables_doc.php
@@ -970,7 +970,8 @@ $VARIABLE_DOC_LINKS['query_alloc_block_size'] = array(
$VARIABLE_DOC_LINKS['query_cache_limit'] = array(
'query_cache_limit',
'server-system-variables',
- 'sysvar');
+ 'sysvar',
+ 'byte');
$VARIABLE_DOC_LINKS['query_cache_min_res_unit'] = array(
'query_cache_min_res_unit',
'server-system-variables',
diff --git a/navigation.php b/navigation.php
index 0c5668b..f684d11 100644
--- a/navigation.php
+++ b/navigation.php
@@ -156,6 +156,7 @@ require_once './libraries/header_http.inc.php';
</head>
<body id="body_leftFrame">
+<div id="frameCollapse" style="display:none;"><img src="themes/pmahomme/img/frame-collapse.png"></div>
<?php
require './libraries/navigation_header.inc.php';
diff --git a/server_status.php b/server_status.php
index 877f0a5..d26e044 100644
--- a/server_status.php
+++ b/server_status.php
@@ -6,7 +6,7 @@
*
* @package phpMyAdmin
*/
-
+
/**
* no need for variables importing
* @ignore
@@ -88,8 +88,8 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
switch ($node['dataType']) {
case 'statusvar':
// Some white list filtering
- if (!preg_match('/[^a-zA-Z_]+/',$node['name']))
- $statusVars[] = $node['name'];
+ if (!preg_match('/[^a-zA-Z_]+/',$node['dataPoint']))
+ $statusVars[] = $node['dataPoint'];
break;
case 'proc':
@@ -121,7 +121,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if (!$memory)
$memory = $sysinfo->memory();
- $ret[$chart_id][$node_id]['y'] = $memory[$node['name']];
+ $ret[$chart_id][$node_id]['y'] = $memory[$node['dataPoint']];
break;
}
}
@@ -134,7 +134,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $node) {
if ($node['dataType'] == 'statusvar')
- $ret[$chart_id][$node_id]['y'] = $vars[$node['name']];
+ $ret[$chart_id][$node_id]['y'] = $vars[$node['dataPoint']];
}
}
@@ -145,28 +145,46 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
}
if (isset($_REQUEST['log_data'])) {
+ if(PMA_MYSQL_INT_VERSION < 50106) exit('""');
+
$start = intval($_REQUEST['time_start']);
$end = intval($_REQUEST['time_end']);
if ($_REQUEST['type'] == 'slow') {
- $q = 'SELECT SUM(query_time) AS TIME(query_time), SUM(lock_time) as lock_time, '.
- 'SUM(rows_sent) AS rows_sent, SUM(rows_examined) AS rows_examined, sql_text, COUNT(sql_text) AS \'#\' '.
- 'FROM `mysql`.`slow_log` WHERE event_time > FROM_UNIXTIME('.$start.') '.
- 'AND event_time < FROM_UNIXTIME('.$end.') GROUP BY sql_text';
-
+ $q = 'SELECT start_time, user_host, Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, '.
+ 'SUM(rows_sent) AS rows_sent, SUM(rows_examined) AS rows_examined, db, sql_text, COUNT(sql_text) AS \'#\' '.
+ 'FROM `mysql`.`slow_log` WHERE start_time > FROM_UNIXTIME('.$start.') '.
+ 'AND start_time < FROM_UNIXTIME('.$end.') GROUP BY sql_text';
+
$result = PMA_DBI_try_query($q);
$return = array('rows' => array(), 'sum' => array());
$type = '';
while ($row = PMA_DBI_fetch_assoc($result)) {
- $type = substr($row['sql_text'],0,strpos($row['sql_text'],' '));
- $return['sum'][$type]++;
+ $type = strtolower(substr($row['sql_text'],0,strpos($row['sql_text'],' ')));
+
+ switch($type) {
+ case 'insert':
+ case 'update':
+ // Cut off big inserts and updates, but append byte count therefor
+ if(strlen($row['sql_text']) > 220)
+ $row['sql_text'] = substr($row['sql_text'],0,200) . '... [' .
+ implode(' ',PMA_formatByteDown(strlen($row['sql_text']), 2, 2)).']';
+
+ break;
+ default:
+ break;
+ }
+
+ if(!isset($return['sum'][$type])) $return['sum'][$type] = 0;
+ $return['sum'][$type] += $row['#'];
$return['rows'][] = $row;
}
$return['sum']['TOTAL'] = array_sum($return['sum']);
-
+ $return['numRows'] = count($return['rows']);
+
PMA_DBI_free_result($result);
exit(json_encode($return));
@@ -220,10 +238,10 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
case 'update':
// Cut off big inserts and updates, but append byte count therefor
- if(strlen($row['argument']) > 180)
- $row['argument'] = substr($row['argument'],0,160) . '... [' .
- PMA_formatByteDown(strlen($row['argument']), 2).']';
-
+ if(strlen($row['argument']) > 220)
+ $row['argument'] = substr($row['argument'],0,200) . '... [' .
+ implode(' ',PMA_formatByteDown(strlen($row['argument'])), 2, 2).']';
+
break;
default: break;
@@ -258,21 +276,29 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if(isset($_REQUEST['query_analyzer'])) {
$return = array();
+
+ if(strlen($_REQUEST['database']))
+ PMA_DBI_select_db($_REQUEST['database']);
if ($profiling = PMA_profilingSupported())
PMA_DBI_query('SET PROFILING=1;');
// Do not cache query
$query = preg_replace('/^(\s*SELECT)/i','\\1 SQL_NO_CACHE',$_REQUEST['query']);
-
+
+ $result = PMA_DBI_try_query($query);
+ $return['affectedRows'] = $GLOBALS['cached_affected_rows'];
+
$result = PMA_DBI_try_query('EXPLAIN ' . $query);
- $return['explain'] = PMA_DBI_fetch_assoc($result);
-
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ $return['explain'][] = $row;
+ }
+
// In case an error happened
$return['error'] = PMA_DBI_getError();
-
+
PMA_DBI_free_result($result);
-
+
if($profiling) {
$return['profiling'] = array();
$result = PMA_DBI_try_query('SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq');
@@ -284,6 +310,12 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($return));
}
+
+ if(isset($_REQUEST['advisor'])) {
+ include('libraries/advisor.lib.php');
+ $advisor = new Advisor();
+ exit(json_encode($advisor->run()));
+ }
}
@@ -397,18 +429,11 @@ if (isset($server_status['Key_reads'])
// Threads_cache_hitrate
if (isset($server_status['Threads_created'])
- && isset($server_status['Connections'])
- && $server_status['Connections'] > 0) {
+ && isset($server_status['Connections'])
+ && $server_status['Connections'] > 0) {
+
$server_status['Threads_cache_hitrate_%'] =
- 100
- - $server_status['Threads_created']
- / $server_status['Connections']
- * 100;
-}
-
-// Format Uptime_since_flush_status : show as days, hours, minutes, seconds
-if (isset($server_status['Uptime_since_flush_status'])) {
- $server_status['Uptime_since_flush_status'] = PMA_timespanFormat($server_status['Uptime_since_flush_status']);
+ 100 - $server_status['Threads_created'] / $server_status['Connections'] * 100;
}
/**
@@ -546,8 +571,13 @@ foreach ($server_status as $name => $value) {
}
}
-// admin commands are not queries (e.g. they include COM_PING, which is excluded from $server_status['Questions'])
-unset($used_queries['Com_admin_commands']);
+if(PMA_DRIZZLE) {
+ $used_queries = PMA_DBI_fetch_result('SELECT * FROM data_dictionary.global_statements', 0, 1);
+ unset($used_queries['admin_commands']);
+} else {
+ // admin commands are not queries (e.g. they include COM_PING, which is excluded from $server_status['Questions'])
+ unset($used_queries['Com_admin_commands']);
+}
/* Ajax request refresh */
if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) {
@@ -598,6 +628,8 @@ server_time_diff = new Date().getTime() - <?php echo microtime(true)*1000; ?>;
server_os = '<?php echo PHP_OS; ?>';
is_superuser = <?php echo PMA_isSuperuser()?'true':'false'; ?>;
server_db_isLocal = <?php echo ($server_db_isLocal)?'true':'false'; ?>;
+profiling_docu = '<?php echo PMA_showMySQLDocu('general-thread-states','general-thread-states'); ?>';
+explain_docu = '<?php echo PMA_showMySQLDocu('explain-output', 'explain-output'); ?>';
</script>
<div id="serverstatus">
<h2><?php
@@ -617,6 +649,7 @@ echo __('Runtime Information');
<li><a href="#statustabs_queries"><?php echo __('Query statistics'); ?></a></li>
<li><a href="#statustabs_allvars"><?php echo __('All status variables'); ?></a></li>
<li><a href="#statustabs_charting"><?php echo __('Monitor'); ?></a></li>
+ <li><a href="#statustabs_advisor"><?php echo __('Advisor'); ?></a></li>
</ul>
<div id="statustabs_traffic">
@@ -689,6 +722,10 @@ echo __('Runtime Information');
?>
</select>
</div>
+ <div class="formelement">
+ <input type="checkbox" name="dontFormat" id="dontFormat">
+ <label for="dontFormat"><?php echo __('Show unformatted values'); ?></label>
+ </div>
</fieldset>
<div id="linkSuggestions" class="defaultLinks" style="display:none">
<p class="notice"><?php echo __('Related links:'); ?>
@@ -719,6 +756,21 @@ echo __('Runtime Information');
<div id="statustabs_charting">
<?php printMonitor(); ?>
</div>
+
+ <div id="statustabs_advisor">
+ <p><a href="#startAnalyzer">Start analyzer</a> | <a href="#openAdvisorInstructions">Instructions</a></p>
+ <div class="tabInnerContent">
+ </div>
+ <div id="advisorInstructionsDialog" style="display:none;">
+ <?php echo __('The Advisor system can provide recommendations on server variables by analyzing the server status variables.
+ Do note however that this system provides recommendations based on fairly simple calculations and by rule of thumb and
+ may not necessarily work for your system.
+ Prior to changing any of the configuration, be sure to know what you are changing and how to undo the change. Wrong tuning
+ can have a very negative effect on performance.
+ The best way to tune the system would be to change only one setting at a time, observe or benchmark your database, and
+ undo the change if there was no clearly measurable improvement.'); ?>
+ </div>
+ </div>
</div>
</div>
@@ -1272,7 +1324,7 @@ function printVariablesTable() {
<tr class="<?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_'.$allocationMap[$name]:''; ?>">
<th class="name"><?php echo htmlspecialchars(str_replace('_',' ',$name)) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?>
</th>
- <td class="value"><?php
+ <td class="value"><span class="formatted"><?php
if (isset($alerts[$name])) {
if ($value > $alerts[$name]) {
echo '<span class="attention">';
@@ -1282,6 +1334,8 @@ function printVariablesTable() {
}
if ('%' === substr($name, -1, 1)) {
echo PMA_formatNumber($value, 0, 2) . ' %';
+ } elseif (strpos($name,'Uptime')!==FALSE) {
+ echo PMA_timespanFormat($value);
} elseif (is_numeric($value) && $value == (int) $value && $value > 1000) {
echo PMA_formatNumber($value, 3, 1);
} elseif (is_numeric($value) && $value == (int) $value) {
@@ -1294,7 +1348,8 @@ function printVariablesTable() {
if (isset($alerts[$name])) {
echo '</span>';
}
- ?></td>
+ ?></span><span style="display:none;" class="original"><?php echo $value; ?></span>
+ </td>
<td class="descr">
<?php
if (isset($strShowStatus[$name ])) {
@@ -1349,13 +1404,14 @@ function printMonitor() {
<a href="#addNewChart">
<img src="themes/dot.gif" class="icon ic_b_chart" alt="" />
<?php echo __('Add chart'); ?>
- </a> |
- <a href="#rearrangeCharts"> <?php echo __('Rearrange/edit charts'); ?></a><br>
- <p>
- <?php echo __('Refresh rate:'); refreshList('gridChartRefresh'); ?><br>
- </p>
- <p>
- <?php echo __('Chart columns:'); ?>
+ </a>
+ <a href="#rearrangeCharts"><img class="icon ic_b_tblops" src="themes/dot.gif" width="16" height="16" alt=""> <?php echo __('Rearrange/edit charts'); ?></a>
+ <div class="clearfloat paddingtop"></div>
+ <div class="floatleft">
+ <?php echo __('Refresh rate').'<br />'; refreshList('gridChartRefresh', 5, Array(2,3,4,5,10,20,40,60,120,300,600,1200)); ?><br>
+ </div>
+ <div class="floatleft">
+ <?php echo __('Chart columns'); ?> <br />
<select name="chartColumns">
<option>1</option>
<option>2</option>
@@ -1368,25 +1424,42 @@ function printMonitor() {
<option>9</option>
<option>10</option>
</select>
- </p>
- <a href="#clearMonitorConfig"><?php echo __('Clear monitor config'); ?></a>
+ </div>
+
+ <div class="clearfloat paddingtop">
+ <b><?php echo __('Chart arrangement'); ?></b> <?php echo PMA_showHint(__('The arrangement of the charts is stored to the browsers local storage. You may want to export it if you have a complicated set up.')); ?><br/>
+ <a href="#importMonitorConfig"><?php echo __('Import'); ?></a> <a href="#exportMonitorConfig"><?php echo __('Export'); ?></a> <a href="#clearMonitorConfig"><?php echo __('Reset to default'); ?></a>
+ </div>
</div>
<div id="monitorInstructionsDialog" title="<?php echo __('Monitor Instructions'); ?>" style="display:none;">
<?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%'); ?>
- <p></p>
- <img class="ajaxIcon" src="<?php echo $GLOBALS['pmaThemeImage']; ?>ajax_clock_small.gif" alt="Loading">
- <div class="ajaxContent">
- </div>
- <div class="monitorUse" style="display:none;">
- <p></p>
- <?php echo __('<b>Using the monitor:</b><br/> Ok, you are good to go! Once you click \'Start monitor\' your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under \'Settings\', or remove any chart using the cog icon on each respective chart.<p>When you get to see a sudden spike in activity, select the relevant time span on any chart by holding down the left mouse button and panning over the chart. This will load statistics from the logs helping you find what caused the activity spike.</p>');
- ?>
+ <?php if(PMA_MYSQL_INT_VERSION < 50106) { ?>
<p>
<img class="icon ic_s_attention" src="themes/dot.gif" alt="">
- <?php echo __('<b>Please note:</b> Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.'); ?>
+ <?php
+ echo __('Unfortunately your Database server does not support logging to table, which is a requirement for analyzing the database logs with phpMyAdmin. Logging to table is supported by MySQL 5.1.6 and onwards. You may still use the server charting features however.');
+ ?>
</p>
+ <?php
+ } else {
+ ?>
+ <p></p>
+ <img class="ajaxIcon" src="<?php echo $GLOBALS['pmaThemeImage']; ?>ajax_clock_small.gif" alt="Loading">
+ <div class="ajaxContent"></div>
+ <div class="monitorUse" style="display:none;">
+ <p></p>
+ <?php
+ echo __('<b>Using the monitor:</b><br/> Ok, you are good to go! Once you click \'Start monitor\' your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under \'Settings\', or remove any chart using the cog icon on each respective chart. <p>To display queries from the logs, select the relevant time span on any chart by holding down the left mouse button and panning over the chart. Once confirmed, this will load a table of grouped queries, there you may click on any occuring SELECT statements to further analyze them.</p>');
+ ?>
+ <p>
+ <img class="icon ic_s_attention" src="themes/dot.gif" alt="">
+ <?php
+ echo __('<b>Please note:</b> Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.');
+ ?>
+ </p>
</div>
+ <?php } ?>
</div>
<div id="addChartDialog" title="Add chart" style="display:none;">
@@ -1453,8 +1526,9 @@ function printMonitor() {
</div>
</div>
</div>
-
- <div id="loadingLogsDialog" title="<?php echo __('Loading logs'); ?>" style="display:none;">
+
+ <!-- For generic use -->
+ <div id="emptyDialog" title="Dialog" style="display:none;">
</div>
<div id="logAnalyseDialog" title="<?php echo __('Log statistics'); ?>" style="display:none;">
diff --git a/sql.php b/sql.php
index 94a0b0d..07d54de 100644
--- a/sql.php
+++ b/sql.php
@@ -939,7 +939,7 @@ $(document).ready(makeProfilingChart);
echo '<div style="float: left;">';
echo '<table>' . "\n";
echo ' <tr>' . "\n";
- echo ' <th>' . __('Status') . '</th>' . "\n";
+ echo ' <th>' . __('Status') . PMA_showMySQLDocu('general-thread-states','general-thread-states') . '</th>' . "\n";
echo ' <th>' . __('Time') . '</th>' . "\n";
echo ' </tr>' . "\n";
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 1e1e2e5..710ec0d 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -286,6 +286,19 @@ th.headerSortDown img.sortableIcon { background-position: 0 -1528px; width: 11px
/******************************************************************************/
/* classes */
+.clearfloat {
+ clear: both;
+}
+
+.floatleft {
+ float: <?php echo $left; ?>;
+ margin-<?php echo $right; ?>: 1em;
+}
+
+.paddingtop {
+ padding-top: 1em;
+}
+
div.tools {
border: 1px solid #000000;
padding: 0.2em;
@@ -1142,10 +1155,6 @@ table#serverstatusconnections {
margin-<?php echo $left; ?>: 30px;
}
-.clearfloat {
- clear: both;
-}
-
table#serverstatusvariables {
width: 100%;
margin-bottom: 1em;
diff --git a/themes/pmahomme/css/theme_left.css.php b/themes/pmahomme/css/theme_left.css.php
index 8ed6707..ea50e51 100644
--- a/themes/pmahomme/css/theme_left.css.php
+++ b/themes/pmahomme/css/theme_left.css.php
@@ -109,6 +109,13 @@ button {
/******************************************************************************/
/* specific elements */
+div#frameCollapse {
+ position:absolute;
+ top: 50%;
+ right: 0;
+ cursor: pointer;
+}
+
div#pmalogo {
<?php //better echo $GLOBALS['cfg']['logoBGC']; ?>
}
diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php
index d2d78e8..582f9a8 100644
--- a/themes/pmahomme/css/theme_right.css.php
+++ b/themes/pmahomme/css/theme_right.css.php
@@ -466,6 +466,19 @@ th.headerSortDown img.sortableIcon { background-position: 0 0; }
/******************************************************************************/
/* classes */
+.clearfloat {
+ clear: both;
+}
+
+.floatleft {
+ float: <?php echo $left; ?>;
+ margin-<?php echo $right; ?>: 1em;
+}
+
+.paddingtop {
+ padding-top: 1em;
+}
+
div.tools {
/* border: 1px solid #000000; */
padding: 0.2em;
@@ -598,7 +611,7 @@ table [class=value] {
font-family: <?php echo $GLOBALS['cfg']['FontFamilyFixed']; ?>;
}
<?php } ?>
-.value .attention {
+.attention {
color: red;
font-weight: bold;
}
@@ -943,6 +956,13 @@ form.login label {
/******************************************************************************/
/* specific elements */
+div#frameExpand {
+ position:absolute;
+ top: 50%;
+ left: 0;
+ cursor: pointer;
+}
+
/* topmenu */
#topmenu a {
text-shadow:0px 1px 0px #fff;
@@ -1308,7 +1328,7 @@ div#tablestatistics table {
/* serverstatus */
-div#logTable table td.analyzableQuery:hover {
+.linkElem:hover {
text-decoration: underline;
color: #235a81;
cursor: pointer;
@@ -1359,9 +1379,6 @@ table#serverstatusqueriesdetails th {
min-width: 35px;
}
-.clearfloat {
- clear: both;
-}
table#serverstatusvariables {
width: 100%;
margin-bottom: 1em;
diff --git a/themes/original/img/bd_spatial.png b/themes/pmahomme/img/frame-collapse.png
similarity index 67%
copy from themes/original/img/bd_spatial.png
copy to themes/pmahomme/img/frame-collapse.png
index 40892d0..cee63be 100644
Binary files a/themes/original/img/bd_spatial.png and b/themes/pmahomme/img/frame-collapse.png differ
diff --git a/themes/pmahomme/img/frame-expand.png b/themes/pmahomme/img/frame-expand.png
new file mode 100644
index 0000000..c99c0d1
Binary files /dev/null and b/themes/pmahomme/img/frame-expand.png differ
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12901-g0d9a0cb
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via 0d9a0cb42bb864be0e69579e4e342d801288258d (commit)
from 4fb5b65fd2a2e740842fd0592ebd698d46f46c8b (commit)
- Log -----------------------------------------------------------------
commit 0d9a0cb42bb864be0e69579e4e342d801288258d
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:49:15 2011 +0200
Simplify logic
-----------------------------------------------------------------------
Summary of changes:
libraries/common.lib.php | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index fa95d86..bdbd124 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -80,21 +80,14 @@ function PMA_pow($base, $exp, $use_function = false)
*/
function PMA_getIcon($icon, $alternate = '', $force_text = false, $noSprite = false)
{
- $include_icon = false;
- $include_text = false;
+ // $cfg['PropertiesIconic'] is true or both
+ $include_icon = ($GLOBALS['cfg']['PropertiesIconic'] !== false);
+ // $cfg['PropertiesIconic'] is false or both
+ // OR we have no $include_icon
+ $include_text = ($force_text || true !== $GLOBALS['cfg']['PropertiesIconic']);
$alternate = htmlspecialchars($alternate);
$button = '';
- if ($GLOBALS['cfg']['PropertiesIconic']) {
- $include_icon = true;
- }
-
- if ($force_text || true !== $GLOBALS['cfg']['PropertiesIconic']) {
- // $cfg['PropertiesIconic'] is false or both
- // OR we have no $include_icon
- $include_text = true;
- }
-
// Always use a span (we rely on this in js/sql.js)
$button .= '<span class="nowrap">';
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12900-g4fb5b65
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via 4fb5b65fd2a2e740842fd0592ebd698d46f46c8b (commit)
from 7a07c42de50c1f23bec33fc82b98179e4c452f26 (commit)
- Log -----------------------------------------------------------------
commit 4fb5b65fd2a2e740842fd0592ebd698d46f46c8b
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:47:44 2011 +0200
Remove unused parameter $container from PMA_getIcon
-----------------------------------------------------------------------
Summary of changes:
db_operations.php | 2 +-
libraries/common.lib.php | 37 +++++++-------
libraries/display_tbl.lib.php | 20 ++++----
tbl_structure.php | 50 ++++++++++----------
.../common/PMA_buildActionTitles_test.php | 34 +++++++-------
test/libraries/common/PMA_getIcon_test.php | 23 ++-------
6 files changed, 76 insertions(+), 90 deletions(-)
diff --git a/db_operations.php b/db_operations.php
index 2382389..6b40947 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -359,7 +359,7 @@ if (!$is_information_schema) {
<?php echo PMA_generate_common_hidden_inputs($db); ?>
<fieldset>
<legend>
- <?php echo PMA_getIcon('b_comment.png', __('Database comment: '), false, true); ?>
+ <?php echo PMA_getIcon('b_comment.png', __('Database comment: '), true); ?>
</legend>
<input type="text" name="comment" class="textfield" size="30"
value="<?php
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index fec1c86..fa95d86 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -74,12 +74,11 @@ function PMA_pow($base, $exp, $use_function = false)
*
* @param string $icon name of icon file
* @param string $alternate alternate text
- * @param boolean $container include in container
* @param boolean $force_text whether to force alternate text to be displayed
* @param boolean $noSprite If true, the image source will be not replaced with a CSS Sprite
* @return html img tag
*/
-function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = false, $noSprite = false)
+function PMA_getIcon($icon, $alternate = '', $force_text = false, $noSprite = false)
{
$include_icon = false;
$include_text = false;
@@ -2889,23 +2888,23 @@ function PMA_selectUploadFile($import_list, $uploaddir) {
function PMA_buildActionTitles() {
$titles = array();
- $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'), true);
- $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'), true);
- $titles['Search'] = PMA_getIcon('b_select.png', __('Search'), true);
- $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'), true);
- $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'), true);
- $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'), true);
- $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'), true);
- $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
- $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'), true);
- $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'), true);
- $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'), true);
- $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
- $titles['NoEdit'] = PMA_getIcon('bd_edit.png', __('Edit'), true);
- $titles['Export'] = PMA_getIcon('b_export.png', __('Export'), true);
- $titles['NoExport'] = PMA_getIcon('bd_export.png', __('Export'), true);
- $titles['Execute'] = PMA_getIcon('b_nextpage.png', __('Execute'), true);
- $titles['NoExecute'] = PMA_getIcon('bd_nextpage.png', __('Execute'), true);
+ $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'));
+ $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'));
+ $titles['Search'] = PMA_getIcon('b_select.png', __('Search'));
+ $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'));
+ $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'));
+ $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'));
+ $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'));
+ $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'));
+ $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'));
+ $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'));
+ $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'));
+ $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'));
+ $titles['NoEdit'] = PMA_getIcon('bd_edit.png', __('Edit'));
+ $titles['Export'] = PMA_getIcon('b_export.png', __('Export'));
+ $titles['NoExport'] = PMA_getIcon('bd_export.png', __('Export'));
+ $titles['Execute'] = PMA_getIcon('b_nextpage.png', __('Execute'));
+ $titles['NoExecute'] = PMA_getIcon('bd_nextpage.png', __('Execute'));
return $titles;
}
diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php
index b29b36a..5243dff 100644
--- a/libraries/display_tbl.lib.php
+++ b/libraries/display_tbl.lib.php
@@ -1301,8 +1301,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$edit_url = 'tbl_change.php' . PMA_generate_common_url($_url_params + array('default_action' => 'update'));
$copy_url = 'tbl_change.php' . PMA_generate_common_url($_url_params + array('default_action' => 'insert'));
- $edit_str = PMA_getIcon('b_edit.png', __('Edit'), true);
- $copy_str = PMA_getIcon('b_insrow.png', __('Copy'), true);
+ $edit_str = PMA_getIcon('b_edit.png', __('Edit'));
+ $copy_str = PMA_getIcon('b_insrow.png', __('Copy'));
// Class definitions required for inline editing jQuery scripts
$edit_anchor_class = "edit_row_anchor";
@@ -1337,7 +1337,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$js_conf = 'DELETE FROM ' . PMA_jsFormat($db) . '.' . PMA_jsFormat($table)
. ' WHERE ' . PMA_jsFormat($where_clause, false)
. ($clause_is_unique ? '' : ' LIMIT 1');
- $del_str = PMA_getIcon('b_drop.png', __('Delete'), true);
+ $del_str = PMA_getIcon('b_drop.png', __('Delete'));
} elseif ($is_display['del_lnk'] == 'kp') { // kill process case
$_url_params = array(
@@ -1356,7 +1356,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$del_url = 'sql.php' . PMA_generate_common_url($_url_params);
$del_query = 'KILL ' . $row[0];
$js_conf = 'KILL ' . $row[0];
- $del_str = PMA_getIcon('b_drop.png', __('Kill'), true);
+ $del_str = PMA_getIcon('b_drop.png', __('Kill'));
} // end if (1.2.2)
// 1.3 Displays the links at left if required
@@ -2438,14 +2438,14 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) {
echo PMA_linkOrButton(
'sql.php' . $url_query,
- PMA_getIcon('b_print.png', __('Print view'), false, true),
+ PMA_getIcon('b_print.png', __('Print view')),
'', true, true, 'print_view') . "\n";
if ($_SESSION['tmp_user_values']['display_text']) {
$_url_params['display_text'] = 'F';
echo PMA_linkOrButton(
'sql.php' . PMA_generate_common_url($_url_params),
- PMA_getIcon('b_print.png', __('Print view (with full texts)'), false, true),
+ PMA_getIcon('b_print.png', __('Print view (with full texts)')),
'', true, true, 'print_view') . "\n";
unset($_url_params['display_text']);
}
@@ -2487,13 +2487,13 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) {
echo PMA_linkOrButton(
'tbl_export.php' . PMA_generate_common_url($_url_params),
- PMA_getIcon('b_tblexport.png', __('Export'), false, true),
+ PMA_getIcon('b_tblexport.png', __('Export')),
'', true, true, '') . "\n";
// show chart
echo PMA_linkOrButton(
'tbl_chart.php' . PMA_generate_common_url($_url_params),
- PMA_getIcon('b_chart.png', __('Display chart'), false, true),
+ PMA_getIcon('b_chart.png', __('Display chart')),
'', true, true, '') . "\n";
// show GIS chart
@@ -2508,7 +2508,7 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) {
if ($geometry_found) {
echo PMA_linkOrButton(
'tbl_gis_visualization.php' . PMA_generate_common_url($_url_params),
- PMA_getIcon('b_globe.gif', __('Visualize GIS data'), false, true),
+ PMA_getIcon('b_globe.gif', __('Visualize GIS data')),
'', true, true, '') . "\n";
}
}
@@ -2528,7 +2528,7 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) {
if (! isset($analyzed_sql[0]['queryflags']['procedure'])) {
echo PMA_linkOrButton(
'view_create.php' . $url_query,
- PMA_getIcon('b_views.png', __('Create view'), false, true),
+ PMA_getIcon('b_views.png', __('Create view')),
'', true, true, '') . "\n";
}
if ($header_shown) {
diff --git a/tbl_structure.php b/tbl_structure.php
index a4e9692..77e9b39 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -149,34 +149,34 @@ $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
*/
// action titles (image or string)
$titles = array();
-$titles['Change'] = PMA_getIcon('b_edit.png', __('Change'), true);
-$titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
-$titles['NoDrop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
-$titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true);
-$titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true);
-$titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true);
-$titles['Spatial'] = PMA_getIcon('b_spatial.png', __('Spatial'), true);
-$titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true);
-$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true);
-$titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true);
-$titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true);
-$titles['NoSpatial'] = PMA_getIcon('bd_spatial.png', __('Spatial'), true);
-$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true);
-$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true);
+$titles['Change'] = PMA_getIcon('b_edit.png', __('Change'));
+$titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'));
+$titles['NoDrop'] = PMA_getIcon('b_drop.png', __('Drop'));
+$titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'));
+$titles['Index'] = PMA_getIcon('b_index.png', __('Index'));
+$titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'));
+$titles['Spatial'] = PMA_getIcon('b_spatial.png', __('Spatial'));
+$titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'));
+$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'));
+$titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'));
+$titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'));
+$titles['NoSpatial'] = PMA_getIcon('bd_spatial.png', __('Spatial'));
+$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'));
+$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'));
// hidden action titles (image and string)
$hidden_titles = array();
-$hidden_titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), false, true);
-$hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Add primary key'), false, true);
-$hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Add primary key'), false, true);
-$hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add index'), false, true);
-$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), false, true);
-$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), false, true);
-$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), false, true);
-$hidden_titles['Spatial'] = PMA_getIcon('b_spatial.png', __('Add SPATIAL index'), false, true);
-$hidden_titles['NoSpatial'] = PMA_getIcon('bd_spatial.png', __('Add SPATIAL index'), false, true);
-$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), false, true);
-$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), false, true);
+$hidden_titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true);
+$hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Add primary key'), true);
+$hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Add primary key'), true);
+$hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add index'), true);
+$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), true);
+$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), true);
+$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), true);
+$hidden_titles['Spatial'] = PMA_getIcon('b_spatial.png', __('Add SPATIAL index'), true);
+$hidden_titles['NoSpatial'] = PMA_getIcon('bd_spatial.png', __('Add SPATIAL index'), true);
+$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), true);
+$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), true);
/**
* Displays the table structure ('show table' works correct since 3.23.03)
diff --git a/test/libraries/common/PMA_buildActionTitles_test.php b/test/libraries/common/PMA_buildActionTitles_test.php
index 6f23544..f6579da 100644
--- a/test/libraries/common/PMA_buildActionTitles_test.php
+++ b/test/libraries/common/PMA_buildActionTitles_test.php
@@ -24,23 +24,23 @@ class PMA_buildActionTitles_test extends PHPUnit_Framework_TestCase{
function testBuildActionTitles(){
$titles = array();
- $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'), true);
- $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'), true);
- $titles['Search'] = PMA_getIcon('b_select.png', __('Search'), true);
- $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'), true);
- $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'), true);
- $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'), true);
- $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'), true);
- $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
- $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'), true);
- $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'), true);
- $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'), true);
- $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
- $titles['NoEdit'] = PMA_getIcon('bd_edit.png', __('Edit'), true);
- $titles['Export'] = PMA_getIcon('b_export.png', __('Export'), true);
- $titles['NoExport'] = PMA_getIcon('bd_export.png', __('Export'), true);
- $titles['Execute'] = PMA_getIcon('b_nextpage.png', __('Execute'), true);
- $titles['NoExecute'] = PMA_getIcon('bd_nextpage.png', __('Execute'), true);
+ $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'));
+ $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'));
+ $titles['Search'] = PMA_getIcon('b_select.png', __('Search'));
+ $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'));
+ $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'));
+ $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'));
+ $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'));
+ $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'));
+ $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'));
+ $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'));
+ $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'));
+ $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'));
+ $titles['NoEdit'] = PMA_getIcon('bd_edit.png', __('Edit'));
+ $titles['Export'] = PMA_getIcon('b_export.png', __('Export'));
+ $titles['NoExport'] = PMA_getIcon('bd_export.png', __('Export'));
+ $titles['Execute'] = PMA_getIcon('b_nextpage.png', __('Execute'));
+ $titles['NoExecute'] = PMA_getIcon('bd_nextpage.png', __('Execute'));
$this->assertEquals($titles, PMA_buildActionTitles());
diff --git a/test/libraries/common/PMA_getIcon_test.php b/test/libraries/common/PMA_getIcon_test.php
index ab21651..7567207 100644
--- a/test/libraries/common/PMA_getIcon_test.php
+++ b/test/libraries/common/PMA_getIcon_test.php
@@ -21,17 +21,17 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase{
$this->assertEquals(
'<span class="nowrap"></span>',
- PMA_getIcon('b_comment.png')
+ PMA_getIcon('b_comment.png')
);
}
function testGetIconWithPropertiesIconic(){
-
+
$GLOBALS['cfg']['PropertiesIconic'] = true;
$this->assertEquals(
'<span class="nowrap"><img src="themes/dot.gif" title="" alt="" class="icon ic_b_comment" /></span>',
- PMA_getIcon('b_comment.png')
+ PMA_getIcon('b_comment.png')
);
}
@@ -47,20 +47,7 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase{
);
}
- function testGetIconWithContainer(){
-
- $GLOBALS['cfg']['PropertiesIconic'] = true;
- $alternate_text = 'alt_str';
-
- $this->assertEquals(
- '<span class="nowrap"><img src="themes/dot.gif" title="' . $alternate_text . '" alt="' . $alternate_text
- . '" class="icon ic_b_comment" /></span>',
- PMA_getIcon('b_comment.png', $alternate_text, true)
- );
-
- }
-
- function testGetIconWithContainerAndForceText(){
+ function testGetIconWithForceText(){
$GLOBALS['cfg']['PropertiesIconic'] = true;
$alternate_text = 'alt_str';
@@ -68,7 +55,7 @@ class PMA_getIcon_test extends PHPUnit_Framework_TestCase{
$this->assertEquals(
'<span class="nowrap"><img src="themes/dot.gif" title="' . $alternate_text . '" alt="' . $alternate_text
. '" class="icon ic_b_comment" /> ' . $alternate_text . '</span>',
- PMA_getIcon('b_comment.png', $alternate_text, true, true)
+ PMA_getIcon('b_comment.png', $alternate_text, true)
);
}
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin website branch, master, updated. 92bf2c50569e884caf3971ecd59b074d2e027104
by Herman van Rink 04 Aug '11
by Herman van Rink 04 Aug '11
04 Aug '11
The branch, master has been updated
via 92bf2c50569e884caf3971ecd59b074d2e027104 (commit)
from ed7fc69cfb5cfea1ed3086a303672813108ac474 (commit)
- Log -----------------------------------------------------------------
commit 92bf2c50569e884caf3971ecd59b074d2e027104
Author: Herman van Rink <rink(a)initfour.nl>
Date: Thu Aug 4 13:41:04 2011 +0200
Added CVE IDs
-----------------------------------------------------------------------
Summary of changes:
templates/security/PMASA-2011-11 | 1 +
templates/security/PMASA-2011-12 | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/templates/security/PMASA-2011-11 b/templates/security/PMASA-2011-11
index 8c1b162..f6f98fd 100644
--- a/templates/security/PMASA-2011-11
+++ b/templates/security/PMASA-2011-11
@@ -40,6 +40,7 @@ This issue was found by Norman Hippert from <a href="http://www.the-wildcat.de/"
</py:def>
<!--! CVE ID of the report, this is automatically added to references -->
+<py:def function="announcement_cve">CVE-2011-2718</py:def>
<py:def function="announcement_cwe">661 98</py:def>
diff --git a/templates/security/PMASA-2011-12 b/templates/security/PMASA-2011-12
index 7405881..3a958f2 100644
--- a/templates/security/PMASA-2011-12
+++ b/templates/security/PMASA-2011-12
@@ -49,6 +49,7 @@ This issue was found by Frans Pehrson from <a href="http://www.xxor.se">Xxor AB<
</py:def>
<!--! CVE ID of the report, this is automatically added to references -->
+<py:def function="announcement_cve">CVE-2011-2719</py:def>
<py:def function="announcement_cwe">661 473</py:def>
hooks/post-receive
--
phpMyAdmin website
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12899-g7a07c42
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via 7a07c42de50c1f23bec33fc82b98179e4c452f26 (commit)
via eae8396f1e10ce9fbbf5dd5755947e23130afe38 (commit)
from 269599e4767d95ee0ad8f770e56fe4677e0391ce (commit)
- Log -----------------------------------------------------------------
commit 7a07c42de50c1f23bec33fc82b98179e4c452f26
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:40:49 2011 +0200
Variable include_box is not used
commit eae8396f1e10ce9fbbf5dd5755947e23130afe38
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:39:11 2011 +0200
Factor out pow function detection
-----------------------------------------------------------------------
Summary of changes:
libraries/common.lib.php | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index d812262..fec1c86 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -7,6 +7,25 @@
*/
/**
+ * Detects which function to use for PMA_pow.
+ *
+ * @return string Function name.
+ */
+function PMA_detect_pow()
+{
+ if (function_exists('bcpow')) {
+ // BCMath Arbitrary Precision Mathematics Function
+ return 'bcpow';
+ } elseif (function_exists('gmp_pow')) {
+ // GMP Function
+ return 'gmp_pow';
+ } else {
+ // PHP function
+ return 'pow';
+ }
+}
+
+/**
* Exponential expression / raise number into power
*
* @param string $base base to raise
@@ -19,16 +38,7 @@ function PMA_pow($base, $exp, $use_function = false)
static $pow_function = null;
if (null == $pow_function) {
- if (function_exists('bcpow')) {
- // BCMath Arbitrary Precision Mathematics Function
- $pow_function = 'bcpow';
- } elseif (function_exists('gmp_pow')) {
- // GMP Function
- $pow_function = 'gmp_pow';
- } else {
- // PHP function
- $pow_function = 'pow';
- }
+ $pow_function = PMA_detect_pow();
}
if (! $use_function) {
@@ -73,7 +83,6 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f
{
$include_icon = false;
$include_text = false;
- $include_box = false;
$alternate = htmlspecialchars($alternate);
$button = '';
@@ -87,11 +96,6 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f
$include_text = true;
}
- if ($include_text && $include_icon && $container) {
- // we have icon, text and request for container
- $include_box = true;
- }
-
// Always use a span (we rely on this in js/sql.js)
$button .= '<span class="nowrap">';
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-12897-g269599e
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, master has been updated
via 269599e4767d95ee0ad8f770e56fe4677e0391ce (commit)
via ea99a180bff2ec9ab6ee9ad8374eecf06768a7c6 (commit)
from 8bd454a47f8c5b5bee2fc9f1c5c30ea5f0050576 (commit)
- Log -----------------------------------------------------------------
commit 269599e4767d95ee0ad8f770e56fe4677e0391ce
Merge: 8bd454a47f8c5b5bee2fc9f1c5c30ea5f0050576 ea99a180bff2ec9ab6ee9ad8374eecf06768a7c6
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:33:55 2011 +0200
Merge remote-tracking branch 'origin/QA_3_4'
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_4, updated. RELEASE_3_4_3_1-63-gea99a18
by Michal Čihař 04 Aug '11
by Michal Čihař 04 Aug '11
04 Aug '11
The branch, QA_3_4 has been updated
via ea99a180bff2ec9ab6ee9ad8374eecf06768a7c6 (commit)
from 68e21b05e46f144735faa849b80734d83812c7e6 (commit)
- Log -----------------------------------------------------------------
commit ea99a180bff2ec9ab6ee9ad8374eecf06768a7c6
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Thu Aug 4 13:30:09 2011 +0200
Update from master
-----------------------------------------------------------------------
Summary of changes:
po/ko.po | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/po/ko.po b/po/ko.po
index 0cfd870..6ac185e 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -105,7 +105,7 @@ msgstr "디스크 쓰기에 실패했습니다."
#: bs_disp_as_mime_type.php:41
msgid "Failed to open remote URL"
-msgstr ""
+msgstr "원격 URL 열기 실패했습니다"
#: changelog.php:32 license.php:28
#, php-format
@@ -113,6 +113,8 @@ msgid ""
"The %s file is not available on this system, please visit www.phpmyadmin.net "
"for more information."
msgstr ""
+"%s 파일은 사용할 수 없습니다. www.phpmyadmin.net에 방문하여 정보를 확인하세"
+"요."
#: db_create.php:58
#, php-format
@@ -626,13 +628,13 @@ msgstr ""
#: db_structure.php:393 db_structure.php:407 libraries/header.inc.php:138
#: libraries/tbl_info.inc.php:60 tbl_structure.php:206 test/theme.php:73
msgid "View"
-msgstr ""
+msgstr "뷰"
#: db_structure.php:444 libraries/db_structure.lib.php:40
#: libraries/server_links.inc.php:90 server_replication.php:31
#: server_replication.php:162 server_status.php:383
msgid "Replication"
-msgstr ""
+msgstr "복제"
#: db_structure.php:448
msgid "Sum"
hooks/post-receive
--
phpMyAdmin
1
0