Skip to content

Commit

Permalink
Underscores are preferred to separate words in configuration storage …
Browse files Browse the repository at this point in the history
…table names/directives

Signed-off-by: Madhura Jayaratne <[email protected]>
  • Loading branch information
madhuracj committed Jul 9, 2015
1 parent e4b14c2 commit 8c6261c
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion config.sample.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['exporttemplates'] = 'pma__exporttemplates';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

Expand Down
8 changes: 4 additions & 4 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,8 @@ Server connection settings
* put the table name in :config:option:`$cfg['Servers'][$i]['savedsearches']` (e.g.
``pma__savedsearches``)

.. _exporttemplates:
.. config:option:: $cfg['Servers'][$i]['exporttemplates']
.. _export_templates:
.. config:option:: $cfg['Servers'][$i]['export_templates']
:type: string
:default: ``''``
Expand All @@ -823,8 +823,8 @@ Server connection settings
To allow the usage of this functionality:

* set up :config:option:`$cfg['Servers'][$i]['pmadb']` and the phpMyAdmin configuration storage
* put the table name in :config:option:`$cfg['Servers'][$i]['exporttemplates']` (e.g.
``pma__exporttemplates``)
* put the table name in :config:option:`$cfg['Servers'][$i]['export_templates']` (e.g.
``pma__export_templates``)

.. _tracking:
.. config:option:: $cfg['Servers'][$i]['tracking']
Expand Down
2 changes: 1 addition & 1 deletion examples/config.manyhosts.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['exporttemplates'] = 'pma__exporttemplates';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
4 changes: 2 additions & 2 deletions libraries/DisplayResults.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ private function _setDefaultTransformations()
'config_data' => $json_highlighting_data
);
}
if (! empty($cfgRelation['exporttemplates'])) {
$relDb[$cfgRelation['exporttemplates']] = array(
if (! empty($cfgRelation['export_templates'])) {
$relDb[$cfgRelation['export_templates']] = array(
'template_data' => $json_highlighting_data
);
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,11 @@
/**
* table to store export templates
* - leave blank to disable saved searches feature
* SUGGESTED: 'pma__exporttemplates'
* SUGGESTED: 'pma__export_templates'
*
* @global string $cfg['Servers'][$i]['exporttemplates']
* @global string $cfg['Servers'][$i]['export_templates']
*/
$cfg['Servers'][$i]['exporttemplates'] = '';
$cfg['Servers'][$i]['export_templates'] = '';

/**
* Maximum number of records saved in $cfg['Servers'][$i]['table_uiprefs'] table.
Expand Down
2 changes: 1 addition & 1 deletion libraries/config/messages.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@
$strConfigServers_savedsearches_name = __('Export templates table');
$strConfigServers_savedsearches_desc = __(
'Leave blank for no export template support, suggested: '
. '[kbd]pma__exporttemplates[/kbd].'
. '[kbd]pma__export_templates[/kbd].'
);
$strConfigServers_central_columns_name = __('Central columns table');
$strConfigServers_central_columns_desc = __(
Expand Down
2 changes: 1 addition & 1 deletion libraries/config/setup.forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
'savedsearches' => 'pma__savedsearches',
'central_columns' => 'pma__central_columns',
'designer_settings' => 'pma__designer_settings',
'exporttemplates' => 'pma__exporttemplates',
'export_templates' => 'pma__export_templates',
'MaxTableUiprefs' => 100)));
$forms['Servers']['Server_tracking'] = array('Servers' => array(1 => array(
'tracking_version_auto_create',
Expand Down
2 changes: 1 addition & 1 deletion libraries/display_export.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
$html = PMA_getHtmlForExportOptionHeader($export_type, $db, $table);

$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['exporttemplateswork']) {
if ($cfgRelation['export_templateswork']) {
$html .= PMA_getHtmlForExportTemplateLoading($export_type);
}

Expand Down
8 changes: 4 additions & 4 deletions libraries/display_export.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function PMA_getHtmlForExportOptionHeader($export_type, $db, $table)
*/
function PMA_getHtmlForExportTemplateLoading($export_type)
{
$html = '<div class="exportoptions" id="exporttemplates">';
$html = '<div class="exportoptions" id="export_templates">';
$html .= '<h3>' . __('Export templates:') . '</h3>';

$html .= '<div class="floatleft">';
Expand All @@ -220,7 +220,7 @@ function PMA_getHtmlForExportTemplateLoading($export_type)
$html .= '<h4>' . __('Existing templates:') . '</h4>';
$html .= '<label for="template">' . __('Template:') . '</label>';
$html .= '<select required="required" name="template" id="template">';
$html .= PMA_getOptionsForExportTemplates($export_type);
$html .= PMA_getOptionsForexport_templates($export_type);
$html .= '</select>';
$html .= '<input type="submit" name="updateTemplate" '
. 'id="updateTemplate" value="' . __('Update') . '" />';
Expand All @@ -243,7 +243,7 @@ function PMA_getHtmlForExportTemplateLoading($export_type)
*
* @return string HTML for the options in teplate dropdown
*/
function PMA_getOptionsForExportTemplates($export_type)
function PMA_getOptionsForexport_templates($export_type)
{
$ret = '<option value="">-- ' . __('Select a template') . ' --</option>';

Expand All @@ -252,7 +252,7 @@ function PMA_getOptionsForExportTemplates($export_type)

$query = "SELECT `id`, `template_name` FROM "
. PMA_Util::backquote($cfgRelation['db']) . '.'
. PMA_Util::backquote($cfgRelation['exporttemplates'])
. PMA_Util::backquote($cfgRelation['export_templates'])
. " WHERE `username` = "
. "'" . PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'"
. " AND `export_type` = '" . $export_type . "'"
Expand Down
2 changes: 1 addition & 1 deletion libraries/export.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ function PMA_getMetadataTypesToExport()
'pdf_pages',
'savedsearches',
'central_columns',
'exporttemplates',
'export_templates',
);
}
?>
22 changes: 11 additions & 11 deletions libraries/relation.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,14 @@ function PMA_getRelationsParamDiagnostic($cfgRelation)
$messages
);
$retval .= PMA_getDiagMessageForParameter(
'exporttemplates',
isset($cfgRelation['exporttemplates']),
'export_templates',
isset($cfgRelation['export_templates']),
$messages,
'exporttemplates'
'export_templates'
);
$retval .= PMA_getDiagMessageForFeature(
__('Saving export templates'),
'exporttemplateswork',
'export_templateswork',
$messages
);
$retval .= '</table>' . "\n";
Expand Down Expand Up @@ -463,7 +463,7 @@ function PMA_checkRelationsParam()
$cfgRelation['savedsearcheswork'] = false;
$cfgRelation['central_columnswork'] = false;
$cfgRelation['designer_settingswork'] = false;
$cfgRelation['exporttemplateswork'] = false;
$cfgRelation['export_templateswork'] = false;
$cfgRelation['user'] = null;
$cfgRelation['db'] = null;

Expand Down Expand Up @@ -539,8 +539,8 @@ function PMA_checkRelationsParam()
$cfgRelation['central_columns'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['designer_settings']) {
$cfgRelation['designer_settings'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['exporttemplates']) {
$cfgRelation['exporttemplates'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['export_templates']) {
$cfgRelation['export_templates'] = $curr_table[0];
}
} // end while
$GLOBALS['dbi']->freeResult($tab_rs);
Expand Down Expand Up @@ -611,8 +611,8 @@ function PMA_checkRelationsParam()
$cfgRelation['designer_settingswork'] = true;
}

if (isset($cfgRelation['exporttemplates'])) {
$cfgRelation['exporttemplateswork'] = true;
if (isset($cfgRelation['export_templates'])) {
$cfgRelation['export_templateswork'] = true;
}

if ($cfgRelation['relwork'] && $cfgRelation['displaywork']
Expand All @@ -624,7 +624,7 @@ function PMA_checkRelationsParam()
&& $cfgRelation['menuswork'] && $cfgRelation['navwork']
&& $cfgRelation['savedsearcheswork'] && $cfgRelation['favoritework']
&& $cfgRelation['designer_settingswork']
&& $cfgRelation['exporttemplateswork']
&& $cfgRelation['export_templateswork']
) {
$cfgRelation['allworks'] = true;
}
Expand Down Expand Up @@ -1841,7 +1841,7 @@ function PMA_fixPMATables($db, $create = true)
'pma__savedsearches' => 'savedsearches',
'pma__central_columns' => 'central_columns',
'pma__designer_settings' => 'designer_settings',
'pma__exporttemplates' => 'exporttemplates',
'pma__export_templates' => 'export_templates',
);

$existingTables = $GLOBALS['dbi']->getTables($db, $GLOBALS['controllink']);
Expand Down
4 changes: 2 additions & 2 deletions sql/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ CREATE TABLE IF NOT EXISTS `pma__designer_settings` (
-- --------------------------------------------------------

--
-- Table structure for table `pma__exporttemplates`
-- Table structure for table `pma__export_templates`
--

CREATE TABLE IF NOT EXISTS `pma__exporttemplates` (
CREATE TABLE IF NOT EXISTS `pma__export_templates` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL,
`export_type` varchar(10) NOT NULL,
Expand Down
4 changes: 2 additions & 2 deletions sql/create_tables_drizzle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ CREATE TABLE IF NOT EXISTS `pma__designer_settings` (
-- --------------------------------------------------------

--
-- Table structure for table `pma__exporttemplates`
-- Table structure for table `pma__export_templates`
--

CREATE TABLE IF NOT EXISTS `pma__exporttemplates` (
CREATE TABLE IF NOT EXISTS `pma__export_templates` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL,
`export_type` varchar(10) NOT NULL,
Expand Down
6 changes: 3 additions & 3 deletions tbl_export.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
$cfgRelation = PMA_getRelationsParam();

// handling export template actions
if (isset($_REQUEST['templateAction']) && $cfgRelation['exporttemplateswork']) {
if (isset($_REQUEST['templateAction']) && $cfgRelation['export_templateswork']) {

if (isset($_REQUEST['templateId'])) {
$templateId = $_REQUEST['templateId'];
$id = PMA_Util::sqlAddSlashes($templateId);
}

$templateTable = PMA_Util::backquote($cfgRelation['db']) . '.'
. PMA_Util::backquote($cfgRelation['exporttemplates']);
. PMA_Util::backquote($cfgRelation['export_templates']);
$user = PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']);

switch ($_REQUEST['templateAction']) {
Expand Down Expand Up @@ -77,7 +77,7 @@
if ('create' == $_REQUEST['templateAction']) {
$response->addJSON(
'data',
PMA_getOptionsForExportTemplates($_REQUEST['exportType'])
PMA_getOptionsForexport_templates($_REQUEST['exportType'])
);
} elseif ('load' == $_REQUEST['templateAction']) {
$data = null;
Expand Down
2 changes: 1 addition & 1 deletion test/libraries/PMA_relation_cleanup_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function setUp()
$GLOBALS['cfg']['Server']['savedsearches'] = 'savedsearches';
$GLOBALS['cfg']['Server']['central_columns'] = 'central_columns';
$GLOBALS['cfg']['Server']['designer_settings'] = 'designer_settings';
$GLOBALS['cfg']['Server']['exporttemplates'] = 'pma__exporttemplates';
$GLOBALS['cfg']['Server']['export_templates'] = 'pma__export_templates';

$this->redefineRelation();
}
Expand Down

0 comments on commit 8c6261c

Please sign in to comment.