Merge remote branch 'phpmyadmin/master'

This commit is contained in:
Ammar Yasir 2011-08-12 23:33:13 +05:30
commit 8dd9309fcb
88 changed files with 39374 additions and 36145 deletions

View File

@ -1086,9 +1086,9 @@ ALTER TABLE `pma_column_comments`
</dt>
<dd>
Since release 3.5.0 phpMyAdmin can be configured to remember several things
(table sorting
(sorted column
<a href="#cfg_RememberSorting" class="configrule">$cfg['RememberSorting']</a>
, etc.) for browsing tables.
, column order, and column visibility from a database table) for browsing tables.
Without configuring the storage, these features still can be used,
but the values will disappear after you logout.<br/><br/>
@ -1223,6 +1223,15 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
</ul>
</dd>
<dt><span id="cfg_Servers_MaxTableUiprefs">$cfg['Servers'][$i]['MaxTableUiprefs']</span> integer
</dt>
<dd>Maximum number of rows saved in <a
href="#cfg_Servers_table_uiprefs">$cfg['Servers'][$i]['table_uiprefs']</a> table.<br /><br />
When tables are dropped or renamed, table_uiprefs may contain invalid
data (referring to tables which no longer exist).<br />
We only keep this number of newest rows in table_uiprefs and automatically delete older rows.</dd>
<dt><span id="cfg_Servers_verbose_check">$cfg['Servers'][$i]['verbose_check']</span> boolean
</dt>
<dd>Because release 2.5.0 introduced the new MIME-transformation support, the
@ -1636,7 +1645,7 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
<dt id="cfg_ShowAll">$cfg['ShowAll'] boolean</dt>
<dd>Defines whether a user should be displayed a
&quot;show all (records)&quot; button in browse mode or not.</dd>
&quot;show all (rows)&quot; button in browse mode or not.</dd>
<dt id="cfg_MaxRows">$cfg['MaxRows'] integer</dt>
<dd>Number of rows displayed when browsing a result set. If the result set
@ -2079,11 +2088,9 @@ $cfg['TrustedProxies'] =
The name of the directory where temporary files can be stored.
<br /><br />
This is needed for native MS Excel export, see
<a href="#faq6_23"><abbr title="Frequently Asked Questions">FAQ</abbr>
6.23</a> and to work around limitations of
<tt>open_basedir</tt> for uploaded
files, see <a href="#faq1_11"><abbr title="Frequently Asked Questions">FAQ</abbr>
This is needed to work around limitations of <tt>open_basedir</tt>
for uploaded files, see
<a href="#faq1_11"><abbr title="Frequently Asked Questions">FAQ</abbr>
1.11</a>.
<br /><br />
@ -3232,7 +3239,7 @@ the <tt>mysql_upgrade</tt> command on the server.</p>
please upgrade to a plain revision.</p>
<h4 id="faq2_5">
<a href="#faq2_5">2.5 Each time I want to insert or change a record or drop a database
<a href="#faq2_5">2.5 Each time I want to insert or change a row or drop a database
or a table, an error 404 (page not found) is displayed or, with <abbr title="HyperText Transfer Protocol">HTTP</abbr> or
cookie authentication, I'm asked to log in again. What's wrong?</a></h4>
@ -3471,7 +3478,7 @@ have either the <a href="http://pecl.php.net/package/APC">APC</a> extension
can use it for the Edit and Delete links.</p>
<h4 id="faq3_11">
<a href="#faq3_11">3.11 The number of records for InnoDB tables is not correct.</a></h4>
<a href="#faq3_11">3.11 The number of rows for InnoDB tables is not correct.</a></h4>
<p> phpMyAdmin uses a quick method to get the row count, and this method
only returns an approximate count in the case of InnoDB tables. See
@ -5022,8 +5029,8 @@ Jakub Wilk, Thomas Michael Winningham, Vilius Zigmantas, &quot;Manuzhai&quot;.
<li><a href="http://www.wikipedia.org/wiki/Field_%28computer_science%29">Field</a>
- one part of divided data/columns.</li>
<li><a href="http://www.wikipedia.org/wiki/Foreign_key">foreign key</a>
- a field or group of fields in a database record that point to a key
field or group of fields forming a key of another database record in some
- a column or group of columns in a database row that point to a key
column or group of columns forming a key of another database row in some
(usually different) table.</li>
<li><a href="http://www.fpdf.org/">FPDF (FreePDF)</a>
- the free PDF library</li>
@ -5114,7 +5121,7 @@ Jakub Wilk, Thomas Michael Winningham, Vilius Zigmantas, &quot;Manuzhai&quot;.
Internet technologies.</li>
<li><a href="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</a>
- GZIP file format specification version 4.3</li>
<li><a href="http://www.wikipedia.org/wiki/Row_%28database%29">Row (record, tulpel)</a>
<li><a href="http://www.wikipedia.org/wiki/Row_%28database%29">Row (record, tuple)</a>
- represents a single, implicitly structured data item in a table.</li>
<li><a href="http://www.wikipedia.org/wiki/Server_%28computing%29">Server</a>
- a computer system that provides services to other computing

View File

@ -38,7 +38,7 @@
<arg line="${source_comma_sep}
xml
codesize,design,naming,unusedcode
--exclude test,build,PHPExcel,tcpdf,php-gettext
--exclude test,build,tcpdf,php-gettext
--reportfile ${basedir}/build/logs/pmd.xml" />
</exec>
</target>
@ -48,7 +48,6 @@
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml
--exclude test
--exclude build
--exclude libraries/PHPExcel
--exclude libraries/tcpdf
--exclude libraries/php-gettext
${source}" />
@ -60,17 +59,16 @@
<arg line="--log-csv ${basedir}/build/logs/phploc.csv
--exclude test
--exclude build
--exclude libraries/PHPExcel
--exclude libraries/tcpdf
--exclude libraries/php-gettext
${source}" />
</exec>
</target>
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding test, PHPExcel, tcpdf directories">
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding test, tcpdf directories">
<exec executable="phpcs">
<arg line="
--ignore=*/PHPExcel/*,*/php-gettext/*,*/tcpdf/*,*/canvg/*,*/codemirror/*,*/highcharts/*,*/openlayers/*,*/jquery/*,*/build/*
--ignore=*/php-gettext/*,*/tcpdf/*,*/canvg/*,*/codemirror/*,*/highcharts/*,*/openlayers/*,*/jquery/*,*/build/*
--report=checkstyle
--report-file=${basedir}/build/logs/checkstyle.xml
--standard=PEAR

View File

@ -237,7 +237,7 @@ if (!empty($local_import_file) && !empty($cfg['UploadDir'])) {
$local_import_file = PMA_securePath($local_import_file);
$import_file = PMA_userDir($cfg['UploadDir']) . $local_import_file;
} elseif (empty($import_file) || !is_uploaded_file($import_file)) {
} elseif (empty($import_file) || !is_uploaded_file($import_file)) {
$import_file = 'none';
}

View File

@ -353,22 +353,31 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* Send column preferences (column order and visibility) to the server.
*/
sendColPrefs: function() {
var post_params = {
ajax_request: true,
db: g.db,
table: g.table,
token: g.token,
server: g.server,
set_col_prefs: true,
table_create_time: g.tableCreateTime
};
if (g.colOrder.length > 0) {
$.extend(post_params, { col_order: g.colOrder.toString() });
if ($(g.t).is('.ajax')) { // only send preferences if AjaxEnable is true
var post_params = {
ajax_request: true,
db: g.db,
table: g.table,
token: g.token,
server: g.server,
set_col_prefs: true,
table_create_time: g.tableCreateTime
};
if (g.colOrder.length > 0) {
$.extend(post_params, { col_order: g.colOrder.toString() });
}
if (g.colVisib.length > 0) {
$.extend(post_params, { col_visib: g.colVisib.toString() });
}
$.post('sql.php', post_params, function(data) {
if (data.success != true) {
var $temp_div = $(document.createElement('div'));
$temp_div.html(data.error);
$temp_div.addClass("error");
PMA_ajaxShowMessage($temp_div);
}
});
}
if (g.colVisib.length > 0) {
$.extend(post_params, { col_visib: g.colVisib.toString() });
}
$.post('sql.php', post_params);
},
/**
@ -1500,6 +1509,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.cellEditHint = PMA_messages['strCellEditHint'];
g.saveCellWarning = PMA_messages['strSaveCellWarning'];
g.alertNonUnique = PMA_messages['strAlertNonUnique'];
g.gotoLinkText = PMA_messages['strGoToLink'];
// initialize cell editing configuration
g.saveCellsAtOnce = $('#save_cells_at_once').val();
@ -1560,6 +1570,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// attach to global div
$(g.gDiv).append(g.cEdit);
// add hint for grid editing feature when hovering "Edit" link in each table row
PMA_createqTip($(g.t).find('.edit_row_anchor a'), PMA_messages['strGridEditFeatureHint']);
}
}

View File

@ -90,6 +90,13 @@ $js_messages['strChartIssuedQueriesTitle'] = __('Questions (executed statements
$js_messages['strChartQueryPie'] = __('Query statistics');
/* server status monitor */
$js_messages['strIncompatibleMonitorConfig'] = __('Local monitor configuration icompatible');
$js_messages['strIncompatibleMonitorConfigDescription'] = __('The chart arrangement configuration in your browsers local storage is not compatible anymore to the newer version of the monitor dialog. It is very likely that your current configuration will not work anymore. Please reset your configuration to default in the <i>Settings</i> menu.');
$js_messages['strQueryCacheEfficiency'] = __('Query cache efficiency');
$js_messages['strQueryCacheUsage'] = __('Query cache usage');
$js_messages['strQueryCacheUsed'] = __('Query cache used');
$js_messages['strSystemCPUUsage'] = __('System CPU Usage');
$js_messages['strSystemMemory'] = __('System memory');
$js_messages['strSystemSwap'] = __('System swap');
@ -282,6 +289,8 @@ $js_messages['strColMarkHint'] = __('Click to mark/unmark');
$js_messages['strColVisibHint'] = __('Click the drop-down arrow<br />to toggle column\'s visibility');
$js_messages['strShowAllCol'] = __('Show all');
$js_messages['strAlertNonUnique'] = __('This table does not contain a unique column. Features related to the grid edit, checkbox, Edit, Copy and Delete links may not work after saving.');
$js_messages['strGridEditFeatureHint'] = __('You can also edit most columns<br />by clicking directly on their content.');
$js_messages['strGoToLink'] = __('Go to link');
/* password generation */
$js_messages['strGeneratePassword'] = __('Generate password');

View File

@ -662,17 +662,19 @@ $(function() {
return false;
});
});
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 });
}
});
// Needs to be global as server_status_monitor.js uses it too
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 });
}

View File

@ -16,6 +16,11 @@ $(function() {
// Holds about to created chart
var newChart = null;
var chartSpacing;
// Whenever the monitor object (runtime.charts) or the settings object (monitorSettings)
// changes in a way incompatible to the previous version, increase this number
// It will reset the users monitor and settings object in his localStorage to the default configuration
var monitorProtocolVersion = '1.0';
// Runtime parameter of the monitor, is being fully set in initGrid()
var runtime = {
@ -51,103 +56,158 @@ $(function() {
// Allows drag and drop rearrange and print/edit icons on charts
var editMode = false;
/* List of preconfigured charts that the user may select */
var presetCharts = {
'cpu-WINNT': {
title: PMA_messages['strSystemCPUUsage'],
nodes: [{ dataType: 'cpu', name: PMA_messages['strAverageLoad'], dataPoint: 'loadavg', unit: '%'}]
// Query cache efficiency
'qce': {
title: PMA_messages['strQueryCacheEfficiency'],
nodes: [ {
name: PMA_messages['strQueryCacheEfficiency'],
dataPoints: [{type: 'statusvar', name: 'Qcache_hits'}, {type: 'statusvar', name: 'Com_select'}],
unit: '%',
transformFn: 'qce'
} ]
},
'memory-WINNT': {
title: PMA_messages['strSystemMemory'],
nodes: [
{ 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: 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': {
title: PMA_messages['strSystemCPUUsage'],
nodes: [
{ dataType: 'cpu',
name: PMA_messages['strAverageLoad'],
unit: '%',
transformFn: 'cpu-linux'
}
]
},
'memory-Linux': {
title: PMA_messages['strSystemMemory'],
nodes: [
{ 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: {
type: 'area',
animation: false
},
plotOptions: {
area: {
stacking: 'percent'
}
}
}
},
'swap-Linux': {
title: PMA_messages['strSystemSwap'],
nodes: [
{ 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: {
type: 'area',
animation: false
},
plotOptions: {
area: {
stacking: 'percent'
}
}
}
// Query cache usage
'qcu': {
title: PMA_messages['strQueryCacheUsage'],
nodes: [ {
name: PMA_messages['strQueryCacheUsed'],
dataPoints: [{type: 'statusvar', name: 'Qcache_free_memory'}, {type: 'servervar', name: 'query_cache_size'}],
unit: '%',
transformFn: 'qcu'
} ]
}
};
/* Add OS specific system info charts to the preset chart list */
switch(server_os) {
case 'WINNT':
$.extend(presetCharts, {
'cpu': {
title: PMA_messages['strSystemCPUUsage'],
nodes: [ {
name: PMA_messages['strAverageLoad'],
dataPoints: [{ type: 'cpu', name: 'loadavg'}],
unit: '%'
} ]
},
'memory': {
title: PMA_messages['strSystemMemory'],
nodes: [ {
name: PMA_messages['strTotalMemory'],
dataPoints: [{ type: 'memory', name: 'MemTotal' }],
valueDivisor: 1024,
unit: PMA_messages['strMiB']
}, {
dataType: 'memory',
name: PMA_messages['strUsedMemory'],
dataPoints: [{ type: 'memory', name: 'MemUsed' }],
valueDivisor: 1024,
unit: PMA_messages['strMiB']
} ]
},
'swap': {
title: PMA_messages['strSystemSwap'],
nodes: [ {
name: PMA_messages['strTotalSwap'],
dataPoints: [{ type: 'memory', name: 'SwapTotal' }],
valueDivisor: 1024,
unit: PMA_messages['strMiB']
}, {
name: PMA_messages['strUsedSwap'],
dataPoints: [{ type: 'memory', name: 'SwapUsed' }],
valueDivisor: 1024,
unit: PMA_messages['strMiB']
} ]
}
});
break;
case 'Linux':
$.extend(presetCharts, {
'cpu': {
title: PMA_messages['strSystemCPUUsage'],
nodes: [ {
name: PMA_messages['strAverageLoad'],
dataPoints: [{ type: 'cpu', name: 'irrelevant' }],
unit: '%',
transformFn: 'cpu-linux'
} ]
},
'memory': {
title: PMA_messages['strSystemMemory'],
nodes: [
{ name: PMA_messages['strUsedMemory'], dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] },
{ name: PMA_messages['strCachedMemory'], dataPoints: [{ type: 'memory', name: 'Cached' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] },
{ name: PMA_messages['strBufferedMemory'], dataPoints: [{ type: 'memory', name: 'Buffers' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] },
{ name: PMA_messages['strFreeMemory'], dataPoints: [{ type: 'memory', name: 'MemFree' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }
],
settings: {
chart: {
type: 'area',
animation: false
},
plotOptions: {
area: {
stacking: 'percent'
}
}
}
},
'swap': {
title: PMA_messages['strSystemSwap'],
nodes: [
{ name: PMA_messages['strUsedSwap'], dataPoints: [{ type: 'memory', name: 'SwapUsed' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] },
{ name: PMA_messages['strCachedSwap'], dataPoints: [{ type: 'memory', name: 'SwapCached' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] },
{ name: PMA_messages['strFreeSwap'], dataPoints: [{ type: 'memory', name: 'SwapFree' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }
],
settings: {
chart: {
type: 'area',
animation: false
},
plotOptions: {
area: {
stacking: 'percent'
}
}
}
}
});
break;
}
// Default setting
// Default setting for the chart grid
defaultChartGrid = {
'c0': { title: PMA_messages['strQuestions'],
nodes: [{ dataType: 'statusvar', name: PMA_messages['strQuestions'], dataPoint: 'Questions', display: 'differential' }]
nodes: [{name: PMA_messages['strQuestions'], dataPoints: [{ type: 'statusvar', name: 'Questions' }], display: 'differential' }]
},
'c1': {
title: PMA_messages['strChartConnectionsTitle'],
nodes: [ { dataType: 'statusvar', name: PMA_messages['strConnections'], dataPoint: 'Connections', display: 'differential' },
{ dataType: 'proc', name: PMA_messages['strProcesses'], dataPoint: 'processes'} ]
nodes: [ { name: PMA_messages['strConnections'], dataPoints: [{ type: 'statusvar', name: 'Connections' }], display: 'differential' },
{ name: PMA_messages['strProcesses'], dataPoints: [{ type: 'proc', name: 'processes' }] } ]
},
'c2': {
title: PMA_messages['strTraffic'],
nodes: [
{ 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'] }
{ name: PMA_messages['strBytesSent'], dataPoints: [{ type: 'statusvar', name: 'Bytes_sent' }], display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] },
{ name: PMA_messages['strBytesReceived'], dataPoints: [{ type: 'statusvar', name: 'Bytes_received' }], display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] }
]
}
};
// Server is localhost => We can add cpu/memory/swap
// Server is localhost => We can add cpu/memory/swap to the default chart
if (server_db_isLocal) {
defaultChartGrid['c3'] = presetCharts['cpu-' + server_os];
defaultChartGrid['c4'] = presetCharts['memory-' + server_os];
defaultChartGrid['c5'] = presetCharts['swap-' + server_os];
defaultChartGrid['c3'] = presetCharts['cpu'];
defaultChartGrid['c4'] = presetCharts['memory'];
defaultChartGrid['c5'] = presetCharts['swap'];
}
/* Buttons that are on the top right corner of each chart */
var gridbuttons = {
cogButton: {
//enabled: true,
@ -368,9 +428,11 @@ $(function() {
dlgButtons[PMA_messages['strAddChart']] = function() {
var type = $('input[name="chartType"]:checked').val();
if (type == 'cpu' || type == 'memory' || type == 'swap') {
newChart = presetCharts[type + '-' + server_os];
if (type == 'preset') {
newChart = presetCharts[$('div#addChartDialog select[name="presetCharts"]').prop('value')];
} else {
// If user builds his own chart, it's being set/updated each time he adds a series
// So here we only warn if he didn't add a series yet
if (! newChart || ! newChart.nodes || newChart.nodes.length == 0) {
alert(PMA_messages['strAddOneSeriesWarning']);
return;
@ -395,6 +457,17 @@ $(function() {
$(this).dialog("close");
};
var $presetList = $('div#addChartDialog select[name="presetCharts"]');
if ($presetList.html().length == 0) {
$.each(presetCharts, function(key, value) {
$presetList.append('<option value="' + key + '">' + value.title + '</option>');
});
$presetList.change(function() {
$('input#chartPreset').trigger('click');
$('input[name="chartTitle"]').attr('value', presetCharts[$(this).prop('value')].title);
});
}
$('div#addChartDialog').dialog({
width: 'auto',
height: 'auto',
@ -500,6 +573,7 @@ $(function() {
$('a[href="#clearMonitorConfig"]').click(function() {
window.localStorage.removeItem('monitorCharts');
window.localStorage.removeItem('monitorSettings');
window.localStorage.removeItem('monitorVersion');
$(this).hide();
rebuildGrid();
});
@ -712,8 +786,7 @@ $(function() {
}
var serie = {
dataType: 'statusvar',
dataPoint: $('input#variableInput').attr('value'),
dataPoints: [{ type: 'statusvar', name: $('input#variableInput').attr('value') }],
name: $('input#variableInput').attr('value'),
display: $('input[name="differentialValue"]').attr('checked') ? 'differential' : ''
};
@ -733,7 +806,7 @@ $(function() {
var str = serie.display == 'differential' ? ', ' + PMA_messages['strDifferential'] : '';
str += serie.valueDivisor ? (', ' + $.sprintf(PMA_messages['strDividedBy'], serie.valueDivisor)) : '';
$('#seriesPreview').append('- ' + serie.dataPoint + str + '<br>');
$('#seriesPreview').append('- ' + serie.name + str + '<br>');
newChart.nodes.push(serie);
@ -769,6 +842,19 @@ $(function() {
}
$('a[href="#clearMonitorConfig"]').toggle(runtime.charts != null);
if (runtime.charts != null && monitorProtocolVersion != window.localStorage['monitorVersion']) {
$('div#emptyDialog').attr('title',PMA_messages['strIncompatibleMonitorConfig']);
$('div#emptyDialog').html(PMA_messages['strIncompatibleMonitorConfigDescription']);
var dlgBtns = {};
dlgBtns[PMA_messages['strClose']] = function() { $(this).dialog('close'); };
$('div#emptyDialog').dialog({
width: 400,
buttons: dlgBtns
});
}
}
if (runtime.charts == null) {
@ -1033,7 +1119,7 @@ $(function() {
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>';
htmlStr += '<li><i>' + chart.nodes[i].dataPoints[0].name + ': </i><br/><input type="text" name="chartSerie-' + i + '" value="' + chart.nodes[i].name + '" /></li>';
}
dlgBtns = {};
@ -1114,10 +1200,8 @@ $(function() {
if (! chartData[key]) {
return;
}
// Draw all points
// Draw all series
for (var j = 0; j < elem.nodes.length; j++) {
value = chartData[key][j].y;
// Update x-axis
if (i == 0 && j == 0) {
if (oldChartData == null) {
@ -1132,24 +1216,32 @@ $(function() {
elem.chart.xAxis[0].setExtremes(runtime.xmin, runtime.xmax, false);
// Calculate y value
if (elem.nodes[j].display == 'differential') {
if (oldChartData == null || oldChartData[key] == null) {
continue;
}
value -= oldChartData[key][j].y;
}
if (elem.nodes[j].valueDivisor) {
value = value / elem.nodes[j].valueDivisor;
}
/* Calculate y value */
// If transform function given, use it
if (elem.nodes[j].transformFn) {
value = chartValueTransform(
elem.nodes[j].transformFn,
chartData[key][j],
(oldChartData == null ? null : oldChartData[key][j])
// Check if first iteration (oldChartData==null), or if newly added chart oldChartData[key]==null
(oldChartData == null || oldChartData[key] == null ? null : oldChartData[key][j])
);
// Otherwise use original value and apply differential and divisor if given,
// in this case we have only one data point per series - located at chartData[key][j][0]
} else {
value = parseFloat(chartData[key][j][0].value);
if (elem.nodes[j].display == 'differential') {
if (oldChartData == null || oldChartData[key] == null) {
continue;
}
value -= oldChartData[key][j][0].value;
}
if (elem.nodes[j].valueDivisor) {
value = value / elem.nodes[j].valueDivisor;
}
}
// Set y value, if defined
@ -1177,28 +1269,54 @@ $(function() {
}
/* Function that supplies special value transform functions for chart values */
function chartValueTransform(name, cur, prev) {
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;
case 'cpu-linux':
if (prev == null) {
return undefined;
}
// cur and prev are datapoint arrays, but containing only 1 element for cpu-linux
cur = cur[0], prev = prev[0];
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;
// Query cache efficiency (%)
case 'qce':
if (prev == null) {
return undefined;
}
// cur[0].value is Qcache_hits, cur[1].value is Com_select
var diffQHits = cur[0].value - prev[0].value;
// No NaN please :-)
if (cur[1].value - prev[1].value == 0) return 0;
return diffQHits / (cur[1].value - prev[1].value + diffQHits) * 100;
// Query cache usage (%)
case 'qcu':
if (cur[1].value == 0) return 0;
// cur[0].value is Qcache_free_memory, cur[1].value is query_cache_size
return 100 - cur[0].value / cur[1].value * 100;
}
return undefined;
}
/* Build list of nodes that need to be retrieved from server */
/* Build list of nodes that need to be retrieved from server.
* It creates something like a stripped down version of the runtime.charts object.
*/
function buildRequiredDataList() {
runtime.dataList = {};
// Store an own id, because the property name is subject of reordering,
// thus destroying our mapping with runtime.charts <=> runtime.dataList
var chartID = 0;
$.each(runtime.charts, function(key, chart) {
runtime.dataList[chartID] = chart.nodes;
runtime.dataList[chartID] = [];
for(var i=0; i < chart.nodes.length; i++) {
runtime.dataList[chartID][i] = chart.nodes[i].dataPoints;
}
runtime.charts[key].chartID = chartID;
chartID++;
});
@ -1746,6 +1864,7 @@ $(function() {
if (window.localStorage) {
window.localStorage['monitorCharts'] = $.toJSON(gridCopy);
window.localStorage['monitorSettings'] = $.toJSON(monitorSettings);
window.localStorage['monitorVersion'] = monitorProtocolVersion;
}
$('a[href="#clearMonitorConfig"]').show();

View File

@ -1266,7 +1266,7 @@ class PMA_Table
" REPLACE INTO " . $pma_table .
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name) . "', '" .
PMA_sqlAddSlashes($this->name) . "', '" .
PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "')";
PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
@ -1276,6 +1276,28 @@ class PMA_Table
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
return $message;
}
// Remove some old rows in table_uiprefs if it exceeds the configured maximum rows
$sql_query = 'SELECT COUNT(*) FROM ' . $pma_table;
$rows_count = PMA_DBI_fetch_value($sql_query);
$max_rows = $GLOBALS['cfg']['Server']['MaxTableUiprefs'];
if ($rows_count > $max_rows) {
$num_rows_to_delete = $rows_count - $max_rows;
$sql_query =
' DELETE FROM ' . $pma_table .
' ORDER BY last_update ASC' .
' LIMIT ' . $num_rows_to_delete;
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(__('Failed to cleanup table UI preferences (see cfg["Server"]["MaxTableUiprefs"] documentation)'));
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
print_r($message);
return $message;
}
}
return true;
}

View File

@ -43,11 +43,11 @@ class Advisor
'errors' => array()
);
foreach($this->parseResult['rules'] as $rule) {
foreach ($this->parseResult['rules'] as $rule) {
$this->variables['value'] = 0;
$precond = true;
if(isset($rule['precondition'])) {
if (isset($rule['precondition'])) {
try {
$precond = $this->ruleExprEvaluate($rule['precondition']);
} catch (Exception $e) {
@ -56,9 +56,9 @@ class Advisor
}
}
if(! $precond)
if (! $precond) {
$this->addRule('unchecked', $rule);
else {
} else {
try {
$value = $this->ruleExprEvaluate($rule['formula']);
} catch(Exception $e) {
@ -87,7 +87,7 @@ class Advisor
function splitJustification($rule)
{
$jst = preg_split('/\s*\|\s*/', $rule['justification'], 2);
if(count($jst) > 1) {
if (count($jst) > 1) {
$jst[0] = preg_replace('/%( |,|\.|$)/','%%\1',$jst[0]);
return array($jst[0], $jst[1]);
}
@ -95,12 +95,13 @@ class Advisor
}
// Adds a rule to the result list
function addRule($type, $rule) {
function addRule($type, $rule)
{
switch($type) {
case 'notfired':
case 'fired':
$jst = Advisor::splitJustification($rule);
if(count($jst) > 1) {
if (count($jst) > 1) {
try {
/* Translate */
$jst[0] = _gettext($jst[0]);
@ -133,14 +134,15 @@ class Advisor
// 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 = 0) {
if($ignoreUntil > 0) {
function ruleExprEvaluate($expr, $ignoreUntil = 0)
{
if ($ignoreUntil > 0) {
$exprIgnore = substr($expr,0,$ignoreUntil);
$expr = substr($expr,$ignoreUntil);
}
$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){
if ($ignoreUntil > 0) {
$expr = $exprIgnore . $expr;
}
$value = 0;
@ -149,12 +151,15 @@ class Advisor
eval('$value = '.$expr.';');
$err = ob_get_contents();
ob_end_clean();
if($err) throw new Exception(strip_tags($err) . '<br />Executed code: $value = '.$expr.';');
if ($err) {
throw new Exception(strip_tags($err) . '<br />Executed code: $value = '.$expr.';');
}
return $value;
}
// Reads the rule file into an array, throwing errors messages on syntax errors
function parseRulesFile() {
function parseRulesFile()
{
$file = file('libraries/advisory_rules.txt');
$errors = array();
$rules = array();
@ -166,15 +171,17 @@ class Advisor
for ($i = 0; $i<$numLines; $i++) {
$line = $file[$i];
if($line[0] == '#' || $line[0] == "\n") continue;
if ($line[0] == '#' || $line[0] == "\n") {
continue;
}
// Reading new rule
if(substr($line, 0, 4) == 'rule') {
if($ruleLine > 0) {
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;
}
if(preg_match("/rule\s'(.*)'( \[(.*)\])?$/",$line,$match)) {
if (preg_match("/rule\s'(.*)'( \[(.*)\])?$/",$line,$match)) {
$ruleLine = 1;
$j++;
$rules[$j] = array( 'name' => $match[1]);
@ -184,19 +191,27 @@ class Advisor
}
continue;
} else {
if($ruleLine == -1) $errors[] = 'Unexpected characters on line '.($i+1);
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
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; }
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) {
if ($ruleLine == $numRules) {
$ruleLine = -1;
}
}
@ -210,23 +225,22 @@ function PMA_bytime($num, $precision)
$per = '';
if ($num >= 1) { # per second
$per = "per second";
}
elseif ($num*60 >= 1) { # per minute
} elseif ($num*60 >= 1) { # per minute
$num = $num*60;
$per = "per minute";
}
elseif ($num*60*60 >=1 ) { # per hour
} elseif ($num*60*60 >=1 ) { # per hour
$num = $num*60*60;
$per = "per hour";
}
else {
} else {
$num = $num*60*60*24;
$per = "per day";
}
$num = round($num, $precision);
if($num == 0) $num = '<'.pow(10,-$precision);
if ($num == 0) {
$num = '<'.pow(10,-$precision);
}
return "$num $per";
}

View File

@ -44,14 +44,14 @@ rule 'Questions below 1,000'
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]
rule 'Percentage of 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]
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.
@ -127,7 +127,7 @@ rule 'Query cache disabled'
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'. <b>Note:</b> If you are using memcached, ignore this recommendation.
query_cache_size is set to 0 or query_cache_type is set to 'OFF'
rule 'memcached usage' [!fired('Query cache disabled')]
rule 'Query cache usage' [!fired('Query cache disabled')]
Questions / Uptime
value > 100
Suboptimal caching method.
@ -178,14 +178,14 @@ rule 'Query cache min result size' [!fired('Query cache disabled')]
#
# Sorts
rule '% sorts that cause temporary tales' [Sort_scan + Sort_range > 0]
rule 'Percentage of sorts that cause temporary tables' [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'
rule 'Rate of sorts that cause temporary tables'
Sort_merge_passes / Uptime
value * 60 * 60 > 1
Too many sorts are causing temporary tables.
@ -200,32 +200,32 @@ rule 'Sort rows'
Sorted rows average: %s | PMA_bytime(value,2)
# Joins, scans
rule 'rate of joins without indexes'
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 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'
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'
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.
This indicates that 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'
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.
This indicates that 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
@ -236,14 +236,14 @@ rule 'tmp_table_size vs. max_heap_table_size'
If you have deliberately 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 increase 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]
rule 'Percentage of temp tables on disk' [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 eliminate these you will have to rewrite your queries to avoid those conditions (Within a temporary 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'
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.
@ -255,7 +255,7 @@ rule 'temp disk rate'
# 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_read_buffer_size and other sources) though
# setting it too high is bad too (http://www.mysqlperformanceblog.com/2007/09/17/mysql-what-read_buffer_size-value-is-optimal/).
#rule 'temp table rate'
#rule 'Temp table rate'
# Created_tmp_tables / Uptime
# value * 60 * 60 > 1
# Many intermediate temporary tables are being created.
@ -270,7 +270,7 @@ rule 'MyISAM key buffer size'
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]
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.
@ -278,14 +278,14 @@ rule 'max % MyISAM key buffer ever used' [key_buffer_size > 0]
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')]
rule 'Percentage of 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]
rule 'Percentage of 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.
@ -294,21 +294,21 @@ rule '% index reads from memory' [Key_read_requests > 0]
#
# other caches
rule 'rate of table open'
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'
rule 'Percentage of used open files limit'
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'
rule 'Rate of open files'
Open_files / Uptime
value * 60 * 60 > 5
The rate of opening files is high.
@ -329,14 +329,14 @@ rule 'Table lock wait rate'
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'
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]
rule 'Thread cache hit rate %' [thread_cache_size > 0]
100 - Threads_created / Connections
value < 80
Thread cache is not efficient.
@ -359,35 +359,35 @@ rule 'Slow launch time'
#
#Connections
rule '% connections used'
rule 'Percentage of used connections'
Max_used_connections / max_connections * 100
value > 80
The maximum amount of used connections 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'
rule 'Percentage of 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-of-aborted_connects/">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'
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-of-aborted_connects/">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'
rule 'Percentage of 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'
rule 'Rate of aborted clients'
Aborted_clients / Uptime
value * 60 * 60 > 1
Too many clients are aborted.
@ -403,7 +403,7 @@ rule 'Is InnoDB disabled?'
InnoDB is usually the better choice for table engines.
have_innodb is set to 'value'
rule '% InnoDB log size' [innodb_buffer_pool_size > 0]
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.

View File

@ -377,6 +377,19 @@ $cfg['Servers'][$i]['tracking'] = '';
*/
$cfg['Servers'][$i]['userconfig'] = '';
/**
* Maximum number of records saved in $cfg['Servers'][$i]['table_uiprefs'] table.
*
* In case where tables in databases is modified (e.g. dropped or renamed),
* table_uiprefs may contains invalid data (referring to tables which are not
* exist anymore).
* This configuration make sure that we only keep N (N = MaxTableUiprefs)
* newest record in table_uiprefs and automatically delete older records.
*
* @global integer $cfg['Servers'][$i]['userconfig'] = '';
*/
$cfg['Servers'][$i]['MaxTableUiprefs'] = 100;
/**
* set to false if you know that your pma_* tables are up to date.
* This prevents compatibility checks and thereby increases performance.

View File

@ -395,6 +395,8 @@ $strConfigServers_history_name = __('SQL query history table');
$strConfigServers_host_desc = __('Hostname where MySQL server is running');
$strConfigServers_host_name = __('Server hostname');
$strConfigServers_LogoutURL_name = __('Logout URL');
$strConfigServers_MaxTableUiprefs_desc = __('This configuration make sure that we only keep N (N = MaxTableUiprefs) newest record in "table_uiprefs" and automatically delete older records');
$strConfigServers_MaxTableUiprefs_name = __('Maximum number of records saved in "table_uiprefs" table');
$strConfigServers_nopassword_desc = __('Try to connect without password');
$strConfigServers_nopassword_name = __('Connect without password');
$strConfigServers_only_db_desc = __('You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use [kbd]\'my\_db\'[/kbd] and not [kbd]\'my_db\'[/kbd]. Using this option you can sort database list, just enter their names in order and use [kbd]*[/kbd] at the end to show the rest in alphabetical order.');

View File

@ -78,7 +78,8 @@ $forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'tracking' => 'pma_tracking',
'table_coords' => 'pma_table_coords',
'pdf_pages' => 'pma_pdf_pages',
'designer_coords' => 'pma_designer_coords')));
'designer_coords' => 'pma_designer_coords',
'MaxTableUiprefs' => 100)));
$forms['Servers']['Server_tracking'] = array('Servers' => array(1 => array(
'tracking_version_auto_create',
'tracking_default_statements',

View File

@ -91,7 +91,7 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine
*/
function resolveTypeSize($formatted_size)
{
if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)){
if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)) {
$value = PMA_extractValueFromFormattedSize($formatted_size);
} else {
$value = $formatted_size;

View File

@ -85,7 +85,8 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportFooter() {
function PMA_exportFooter()
{
$foot = '</pma_xml_export>';
return PMA_exportOutputHandler($foot);
@ -98,7 +99,8 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportHeader() {
function PMA_exportHeader()
{
global $crlf;
global $cfg;
global $db;
@ -268,7 +270,8 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportDBHeader($db) {
function PMA_exportDBHeader($db)
{
global $crlf;
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
@ -278,9 +281,7 @@ if (isset($plugin_list)) {
. ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
return PMA_exportOutputHandler($head);
}
else
{
} else {
return true;
}
}
@ -293,14 +294,13 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportDBFooter($db) {
function PMA_exportDBFooter($db)
{
global $crlf;
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
return PMA_exportOutputHandler(' </database>' . $crlf);
}
else
{
} else {
return true;
}
}
@ -313,7 +313,8 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportDBCreate($db) {
function PMA_exportDBCreate($db)
{
return true;
}
@ -329,7 +330,8 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);

View File

@ -811,9 +811,7 @@ function PMA_analyzeTable(&$table)
}
return array($types, $sizes);
}
else
{
} else {
/**
* TODO: Handle this better
*/
@ -1089,8 +1087,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
unset($params);
$num_tables = count($tables);
for ($i = 0; $i < $num_tables; ++$i)
{
for ($i = 0; $i < $num_tables; ++$i) {
$params = array('db' => (string)$db_name, 'table' => (string)$tables[$i][TBL_NAME]);
$tbl_url = 'sql.php' . PMA_generate_common_url($params);
$tbl_struct_url = 'tbl_structure.php' . PMA_generate_common_url($params);

View File

@ -200,8 +200,7 @@ if (@count($xml->children())) {
foreach ($v1 as $k2 => $v2) {
$row_attr = $v2->attributes();
if (! array_search((string)$row_attr['name'], $tempRow))
{
if (! array_search((string)$row_attr['name'], $tempRow)) {
$tempRow[] = (string)$row_attr['name'];
}
$tempCells[] = (string)$v2;

View File

@ -1388,7 +1388,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
// however, if we are on AS, we must keep the $previous_was_identifier
if (($arr[$i]['type'] == 'alpha_reservedWord')
&& ($upper_data == 'AS')) {
&& ($upper_data == 'AS')) {
$previous_was_identifier = true;
}

View File

@ -38,7 +38,7 @@ if (! defined('PHPMYADMIN')) {
* I'm not sure if PEAR was available before this point
* For now we actually use a configuration flag
*/
if ($cfg['SQLValidator']['use'] == true) {
if ($cfg['SQLValidator']['use'] == true) {
require_once './libraries/sqlvalidator.class.php';
} // if ($cfg['SQLValidator']['use'] == true)

4
po/.gitignore vendored
View File

@ -1 +1,5 @@
# pootle cache
.translation_index
*.pending
# generated file for advisory translations
advisory_rules.php

1088
po/af.po

File diff suppressed because it is too large Load Diff

1124
po/ar.po

File diff suppressed because it is too large Load Diff

1108
po/az.po

File diff suppressed because it is too large Load Diff

1133
po/be.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1136
po/bg.po

File diff suppressed because it is too large Load Diff

1137
po/bn.po

File diff suppressed because it is too large Load Diff

1099
po/br.po

File diff suppressed because it is too large Load Diff

1097
po/bs.po

File diff suppressed because it is too large Load Diff

1152
po/ca.po

File diff suppressed because it is too large Load Diff

1155
po/cs.po

File diff suppressed because it is too large Load Diff

1114
po/cy.po

File diff suppressed because it is too large Load Diff

1159
po/da.po

File diff suppressed because it is too large Load Diff

1151
po/de.po

File diff suppressed because it is too large Load Diff

1163
po/el.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1152
po/es.po

File diff suppressed because it is too large Load Diff

1125
po/et.po

File diff suppressed because it is too large Load Diff

1097
po/eu.po

File diff suppressed because it is too large Load Diff

1111
po/fa.po

File diff suppressed because it is too large Load Diff

1146
po/fi.po

File diff suppressed because it is too large Load Diff

1162
po/fr.po

File diff suppressed because it is too large Load Diff

1148
po/gl.po

File diff suppressed because it is too large Load Diff

1098
po/he.po

File diff suppressed because it is too large Load Diff

1140
po/hi.po

File diff suppressed because it is too large Load Diff

1137
po/hr.po

File diff suppressed because it is too large Load Diff

1162
po/hu.po

File diff suppressed because it is too large Load Diff

1127
po/id.po

File diff suppressed because it is too large Load Diff

1151
po/it.po

File diff suppressed because it is too large Load Diff

1225
po/ja.po

File diff suppressed because it is too large Load Diff

1524
po/ka.po

File diff suppressed because it is too large Load Diff

1110
po/ko.po

File diff suppressed because it is too large Load Diff

1145
po/lt.po

File diff suppressed because it is too large Load Diff

1102
po/lv.po

File diff suppressed because it is too large Load Diff

1110
po/mk.po

File diff suppressed because it is too large Load Diff

1038
po/ml.po

File diff suppressed because it is too large Load Diff

1133
po/mn.po

File diff suppressed because it is too large Load Diff

1092
po/ms.po

File diff suppressed because it is too large Load Diff

1146
po/nb.po

File diff suppressed because it is too large Load Diff

1148
po/nl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1163
po/pl.po

File diff suppressed because it is too large Load Diff

1113
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1137
po/ro.po

File diff suppressed because it is too large Load Diff

1144
po/ru.po

File diff suppressed because it is too large Load Diff

1144
po/si.po

File diff suppressed because it is too large Load Diff

1152
po/sk.po

File diff suppressed because it is too large Load Diff

1407
po/sl.po

File diff suppressed because it is too large Load Diff

1103
po/sq.po

File diff suppressed because it is too large Load Diff

1133
po/sr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1151
po/sv.po

File diff suppressed because it is too large Load Diff

1042
po/ta.po

File diff suppressed because it is too large Load Diff

1082
po/te.po

File diff suppressed because it is too large Load Diff

1109
po/th.po

File diff suppressed because it is too large Load Diff

1416
po/tr.po

File diff suppressed because it is too large Load Diff

1125
po/tt.po

File diff suppressed because it is too large Load Diff

1109
po/ug.po

File diff suppressed because it is too large Load Diff

1114
po/uk.po

File diff suppressed because it is too large Load Diff

1107
po/ur.po

File diff suppressed because it is too large Load Diff

1160
po/uz.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -128,6 +128,7 @@ CREATE TABLE IF NOT EXISTS `pma_table_uiprefs` (
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`prefs` text NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`username`,`db_name`,`table_name`)
)
ENGINE=MyISAM COMMENT='Tables'' UI preferences'

View File

@ -31,6 +31,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
// real-time charting data
if (isset($_REQUEST['chart_data'])) {
switch($_REQUEST['type']) {
// Process and Connections realtime chart
case 'proc':
$c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
$result = PMA_DBI_query('SHOW PROCESSLIST');
@ -44,6 +45,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
// Query realtime chart
case 'queries':
$queries = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
@ -64,6 +66,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
// Traffic realtime chart
case 'traffic':
$traffic = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
@ -78,63 +81,105 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
// Data for the monitor
case 'chartgrid':
$ret = json_decode($_REQUEST['requiredData'], true);
$statusVars = array();
$serverVars = array();
$sysinfo = $cpuload = $memory = 0;
$pName = '';
/* Accumulate all required variables and data */
// For each chart
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $node) {
switch ($node['dataType']) {
case 'statusvar':
// Some white list filtering
if (!preg_match('/[^a-zA-Z_]+/', $node['dataPoint']))
$statusVars[] = $node['dataPoint'];
break;
// For each data series
foreach ($chartNodes as $node_id => $nodeDataPoints) {
// For each data point in the series (usually just 1)
foreach ($nodeDataPoints as $point_id => $dataPoint) {
$pName = $dataPoint['name'];
switch ($dataPoint['type']) {
/* We only collect the status and server variables here to
* read them all in one query, and only afterwards assign them.
* Also do some white list filtering on the names
*/
case 'servervar':
if (!preg_match('/[^a-zA-Z_]+/', $pName))
$serverVars[] = $pName;
break;
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id]['y'] = PMA_DBI_num_rows($result);
break;
case 'statusvar':
if (!preg_match('/[^a-zA-Z_]+/', $pName))
$statusVars[] = $pName;
break;
case 'cpu':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$cpuload)
$cpuload = $sysinfo->loadavg();
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
break;
if (PHP_OS == 'Linux') {
$ret[$chart_id][$node_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id]['y'] = $cpuload['loadavg'];
case 'cpu':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$cpuload)
$cpuload = $sysinfo->loadavg();
break;
if (PHP_OS == 'Linux') {
$ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
case 'memory':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$memory)
$memory = $sysinfo->memory();
break;
$ret[$chart_id][$node_id]['y'] = $memory[$node['dataPoint']];
break;
case 'memory':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$memory)
$memory = $sysinfo->memory();
$ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
break;
}
}
}
}
$vars = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
// Retrieve all required status variables
if (count($statusVars)) {
$statusVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
} else {
$statusVarValues = array();
}
// Retrieve all required server variables
if (count($serverVars)) {
$serverVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL VARIABLES
WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1);
} else {
$serverVarValues = array();
}
// ...and now assign them
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $node) {
if ($node['dataType'] == 'statusvar')
$ret[$chart_id][$node_id]['y'] = $vars[$node['dataPoint']];
foreach ($chartNodes as $node_id => $nodeDataPoints) {
foreach ($nodeDataPoints as $point_id => $dataPoint) {
switch($dataPoint['type']) {
case 'statusvar':
$ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
break;
case 'servervar':
$ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
break;
}
}
}
}
@ -594,12 +639,9 @@ if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) {
}
}
$server = 1;
if (isset($_REQUEST['server']) && intval($_REQUEST['server'])) $server = intval($_REQUEST['server']);
$server_db_isLocal = strtolower($cfg['Servers'][$server]['host']) == 'localhost'
|| $cfg['Servers'][$server]['host'] == '127.0.0.1'
|| $cfg['Servers'][$server]['host'] == '::1';
$server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost'
|| $cfg['Server']['host'] == '127.0.0.1'
|| $cfg['Server']['host'] == '::1';
PMA_AddJSCode('pma_token = \'' . $_SESSION[' PMA_token '] . "';\n" .
'url_query = \'' . str_replace('&amp;', '&', PMA_generate_common_url($db)) . "';\n" .
@ -1466,16 +1508,11 @@ function printMonitor()
<div id="addChartDialog" title="Add chart" style="display:none;">
<div id="tabGridVariables">
<p><input type="text" name="chartTitle" value="<?php echo __('Chart Title'); ?>" /></p>
<?php if ($server_db_isLocal) { ?>
<input type="radio" name="chartType" value="cpu" id="chartCPU">
<label for="chartCPU"><?php echo __('CPU Usage'); ?></label><br/>
<input type="radio" name="chartType" value="preset" id="chartPreset">
<label for="chartPreset"><?php echo __('Preset chart'); ?></label>
<select name="presetCharts"></select><br/>
<input type="radio" name="chartType" value="memory" id="chartMemory">
<label for="chartMemory"><?php echo __('Memory Usage'); ?></label><br/>
<input type="radio" name="chartType" value="swap" id="chartSwap">
<label for="chartSwap"><?php echo __('Swap Usage'); ?></label><br/>
<?php } ?>
<input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked">
<label for="chartStatusVar"><?php echo __('Status variable(s)'); ?></label><br/>
<div id="chartVariableSettings">

17
sql.php
View File

@ -22,7 +22,7 @@ if (isset($_SESSION['profiling'])) {
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
/* < IE 9 doesn't support canvas natively */
if(PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
$GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
}
$GLOBALS['js_include'][] = 'canvg/canvg.js';
@ -96,8 +96,7 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value
$dropdown = '<span class="curr_value">' . htmlspecialchars($_REQUEST['curr_value']) . '</span> <a href="browse_foreigners.php' . PMA_generate_common_url($_url_params) . '"'
. ' target="_blank" class="browse_foreign" '
.'>' . __('Browse foreign values') . '</a>';
}
else {
} else {
$dropdown = PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $curr_value, $cfg['ForeignKeyMaxLimit']);
$dropdown = '<select>' . $dropdown . '</select>';
}
@ -175,12 +174,19 @@ if (isset($_REQUEST['set_col_prefs']) && $_REQUEST['set_col_prefs'] == true) {
if (isset($_REQUEST['col_order'])) {
$col_order = explode(',', $_REQUEST['col_order']);
$retval = $pmatable->setUiProp(PMA_Table::PROP_COLUMN_ORDER, $col_order, $_REQUEST['table_create_time']);
if ($retval !== true) {
PMA_ajaxResponse($retval->getString(), false);
}
}
// set column visibility
if (isset($_REQUEST['col_visib'])) {
$col_visib = explode(',', $_REQUEST['col_visib']);
$retval &= $pmatable->setUiProp(PMA_Table::PROP_COLUMN_VISIB, $col_visib, $_REQUEST['table_create_time']);
$retval = $pmatable->setUiProp(PMA_Table::PROP_COLUMN_VISIB, $col_visib, $_REQUEST['table_create_time']);
if ($retval !== true) {
PMA_ajaxResponse($retval->getString(), false);
}
}
PMA_ajaxResponse(NULL, ($retval == true));
@ -788,8 +794,7 @@ else {
require './libraries/server_common.inc.php';
require './libraries/server_links.inc.php';
}
}
else {
} else {
require_once './libraries/header.inc.php';
//we don't need to buffer the output in PMA_showMessage here.
//set a global variable and check against it in the function