Skip to content

Commit

Permalink
Set namespace on Advisor, Config, Console and Util classes.
Browse files Browse the repository at this point in the history
Set namespace on DbQbe.
Set namespace to 'DbSearch'.
Split Advisor.class.php file.
Change Advisor namespace.
Rename DbQbe class and file.
Set namespace on DisplayResults.
Set namespace on Error.
Use namespace for ErrorHandler.
Add class autoloader.
Change ErrorHandler filename.
Remove some require.
Update Config namespace path.
Update PMA_Util to PMA\libraries\Util.
Rename Font and File classes files.
Use namespace for Footer.
Set namespace in all libraries classes.
Namespace OutputBuffering.
Export SubPartition.
Rename Partition file.
Namespace PDF.
Namespace RecentFavoriteTable.
Replace PMA_Response by Response and PMA_Message by Message.
Update uses and calls.
Fix unit tests.
Fix SqlParser autoload.

Signed-off-by: Hugues Peccatte <[email protected]>
  • Loading branch information
Tithugues committed Sep 1, 2015
1 parent a4456bd commit f0ba28f
Show file tree
Hide file tree
Showing 546 changed files with 5,989 additions and 5,420 deletions.
4 changes: 2 additions & 2 deletions browse_foreigners.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
}
}

PMA_Util::checkParameters(array('db', 'table', 'field'));
PMA\libraries\Util::checkParameters(array('db', 'table', 'field'));

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->getFooter()->setMinimal();
$header = $response->getHeader();
$header->disableMenuAndConsole();
Expand Down
2 changes: 1 addition & 1 deletion changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
require 'libraries/common.inc.php';

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->disable();

$filename = CHANGELOG_FILE;
Expand Down
2 changes: 1 addition & 1 deletion chk_rel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
PMA_fixPMATables($cfgRelation['db']);
}

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->addHTML(
PMA_getRelationsParamDiagnostic($cfgRelation)
);
4 changes: 2 additions & 2 deletions db_central_columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
$selected_col[] = $_POST['column-select'];
$tmp_msg = PMA_syncUniqueColumns($selected_col, false, $selected_tbl);
}
$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('jquery/jquery.uitablefilter.js');
Expand Down Expand Up @@ -145,7 +145,7 @@
$tablefooter = PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir);
$response->addHTML($tablefooter);
$response->addHTML('</form></div>');
$message = PMA_Message::success(
$message = PMA\libraries\Message::success(
sprintf(__('Showing rows %1$s - %2$s.'), ($pos + 1), ($pos + count($result)))
);
if (isset($tmp_msg) && $tmp_msg !== true) {
Expand Down
16 changes: 8 additions & 8 deletions db_create.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Builds and executes the db creation sql query
*/
$sql_query = 'CREATE DATABASE ' . PMA_Util::backquote($_POST['new_db']);
$sql_query = 'CREATE DATABASE ' . PMA\libraries\Util::backquote($_POST['new_db']);
if (! empty($_POST['db_collation'])) {
list($db_charset) = explode('_', $_POST['db_collation']);
if (in_array($db_charset, $mysql_charsets)
Expand All @@ -42,23 +42,23 @@
$result = $GLOBALS['dbi']->tryQuery($sql_query);

if (! $result) {
$message = PMA_Message::rawError($GLOBALS['dbi']->getError());
$message = PMA\libraries\Message::rawError($GLOBALS['dbi']->getError());
// avoid displaying the not-created db name in header or navi panel
$GLOBALS['db'] = '';
$GLOBALS['table'] = '';

/**
* If in an Ajax request, just display the message with {@link PMA_Response}
* If in an Ajax request, just display the message with {@link PMA\libraries\Response}
*/
if ($GLOBALS['is_ajax_request'] == true) {
$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->isSuccess(false);
$response->addJSON('message', $message);
} else {
include_once 'index.php';
}
} else {
$message = PMA_Message::success(__('Database %1$s has been created.'));
$message = PMA\libraries\Message::success(__('Database %1$s has been created.'));
$message->addParam($_POST['new_db']);
$GLOBALS['db'] = $_POST['new_db'];

Expand Down Expand Up @@ -120,18 +120,18 @@

$new_db_string .= '</tr>';

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->addJSON('message', $message);
$response->addJSON('new_db_string', $new_db_string);
$response->addJSON(
'sql_query',
PMA_Util::getMessage(
PMA\libraries\Util::getMessage(
null, $sql_query, 'success'
)
);
$response->addJSON(
'url_query',
PMA_Util::getScriptNameForOption(
PMA\libraries\Util::getScriptNameForOption(
$GLOBALS['cfg']['DefaultTabDatabase'], 'database'
)
. $url_query . '&amp;db='
Expand Down
20 changes: 10 additions & 10 deletions db_datadict.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
$tooltip_truename,
$tooltip_aliasname,
$pos
) = PMA_Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
}

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$header = $response->getHeader();
$header->enablePrintView();

Expand All @@ -36,12 +36,12 @@
$cfgRelation = PMA_getRelationsParam();

require_once 'libraries/transformations.lib.php';
require_once 'libraries/Index.class.php';
require_once 'libraries/Index.php';

/**
* Check parameters
*/
PMA_Util::checkParameters(array('db'));
PMA\libraries\Util::checkParameters(array('db'));

/**
* Defines the url to return to in case of error in a sql statement
Expand Down Expand Up @@ -86,7 +86,7 @@
$GLOBALS['dbi']->selectDb($db);
$indexes = $GLOBALS['dbi']->getTableIndexes($db, $table);
list($primary, $pk_array, $indexes_info, $indexes_data)
= PMA_Util::processIndexData($indexes);
= PMA\libraries\Util::processIndexData($indexes);

/**
* Gets columns properties
Expand Down Expand Up @@ -130,7 +130,7 @@
$row['Null'] = 'NO';
}
$extracted_columnspec
= PMA_Util::extractColumnSpec($row['Type']);
= PMA\libraries\Util::extractColumnSpec($row['Type']);

// reformat mysql query output
// set or enum types: slashes single quotes inside options
Expand All @@ -157,7 +157,7 @@
}
echo '</td>';
echo '<td'
. PMA_Util::getClassForType(
. PMA\libraries\Util::getClassForType(
$extracted_columnspec['type']
)
. ' lang="en" dir="ltr">' . $type . '</td>';
Expand Down Expand Up @@ -203,13 +203,13 @@
$count++;
echo '</table>';
// display indexes information
if (count(PMA_Index::getFromTable($table, $db)) > 0) {
echo PMA_Index::getHtmlForIndexes($table, $db, true);
if (count(PMA\libraries\Index::getFromTable($table, $db)) > 0) {
echo PMA\libraries\Index::getHtmlForIndexes($table, $db, true);
}
echo '</div>';
} //ends main while

/**
* Displays the footer
*/
echo PMA_Util::getButton();
echo PMA\libraries\Util::getButton();
6 changes: 3 additions & 3 deletions db_designer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require_once 'libraries/pmd_common.php';
require_once 'libraries/db_designer.lib.php';

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();

if (isset($_REQUEST['dialog'])) {

Expand Down Expand Up @@ -111,7 +111,7 @@
$params['db'] = $_GET['db'];
}

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->getFooter()->setMinimal();
$header = $response->getHeader();
$header->setBodyId('pmd_body');
Expand All @@ -138,7 +138,7 @@
$tooltip_truename,
$tooltip_aliasname,
$pos
) = PMA_Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');

// Embed some data into HTML, later it will be read
// by pmd/init.js and converted to JS variables.
Expand Down
2 changes: 1 addition & 1 deletion db_events.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Include required files
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Util.php';

/**
* Include all other files
Expand Down
8 changes: 4 additions & 4 deletions db_export.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

PMA_PageSettings::showGroup('Export');

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('export.js');

// $sub_part is used in PMA_Util::getDbInfo() to see if we are coming from
// $sub_part is used in PMA\libraries\Util::getDbInfo() to see if we are coming from
// db_export.php, in which case we don't obey $cfg['MaxTableList']
$sub_part = '_export';
require_once 'libraries/db_common.inc.php';
Expand All @@ -36,7 +36,7 @@
$tooltip_truename,
$tooltip_aliasname,
$pos
) = PMA_Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');

/**
* Displays the form
Expand All @@ -45,7 +45,7 @@

// exit if no tables in db found
if ($num_tables < 1) {
PMA_Message::error(__('No tables found in database.'))->display();
PMA\libraries\Message::error(__('No tables found in database.'))->display();
exit;
} // end if

Expand Down
6 changes: 3 additions & 3 deletions db_import.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

PMA_PageSettings::showGroup('Import');

$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('import.js');
Expand All @@ -31,10 +31,10 @@
$tooltip_truename,
$tooltip_aliasname,
$pos
) = PMA_Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');

require 'libraries/display_import.lib.php';
$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->addHTML(
PMA_getImportDisplay(
'database', $db, $table, $max_upload_size
Expand Down
33 changes: 17 additions & 16 deletions db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\PMA_String;

/**
* requirements
Expand All @@ -26,7 +27,7 @@
require_once 'libraries/operations.lib.php';

// add a javascript file for jQuery functions to handle Ajax actions
$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('db_operations.js');
Expand All @@ -50,7 +51,7 @@
if (! isset($_REQUEST['newname'])
|| ! /*overload*/mb_strlen($_REQUEST['newname'])
) {
$message = PMA_Message::error(__('The database name is empty!'));
$message = PMA\libraries\Message::error(__('The database name is empty!'));
} else {
$_error = false;
if ($move || ! empty($_REQUEST['create_database_before_copying'])) {
Expand Down Expand Up @@ -133,11 +134,11 @@

// if someday the RENAME DATABASE reappears, do not DROP
$local_query = 'DROP DATABASE '
. PMA_Util::backquote($GLOBALS['db']) . ';';
. PMA\libraries\Util::backquote($GLOBALS['db']) . ';';
$sql_query .= "\n" . $local_query;
$GLOBALS['dbi']->query($local_query);

$message = PMA_Message::success(
$message = PMA\libraries\Message::success(
__('Database %1$s has been renamed to %2$s.')
);
$message->addParam($GLOBALS['db']);
Expand All @@ -149,13 +150,13 @@
PMA_AdjustPrivileges_copyDB($GLOBALS['db'], $_REQUEST['newname']);
}

$message = PMA_Message::success(
$message = PMA\libraries\Message::success(
__('Database %1$s has been copied to %2$s.')
);
$message->addParam($GLOBALS['db']);
$message->addParam($_REQUEST['newname']);
} else {
$message = PMA_Message::error();
$message = PMA\libraries\Message::error();
}
$reload = true;

Expand All @@ -176,16 +177,16 @@

/**
* Database has been successfully renamed/moved. If in an Ajax request,
* generate the output with {@link PMA_Response} and exit
* generate the output with {@link PMA\libraries\Response} and exit
*/
if ($GLOBALS['is_ajax_request'] == true) {
$response = PMA_Response::getInstance();
$response = PMA\libraries\Response::getInstance();
$response->isSuccess($message->isSuccess());
$response->addJSON('message', $message);
$response->addJSON('newname', $_REQUEST['newname']);
$response->addJSON(
'sql_query',
PMA_Util::getMessage(null, $sql_query)
PMA\libraries\Util::getMessage(null, $sql_query)
);
$response->addJSON('db', $GLOBALS['db']);
exit;
Expand Down Expand Up @@ -222,12 +223,12 @@
$tooltip_truename,
$tooltip_aliasname,
$pos
) = PMA_Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');

echo "\n";

if (isset($message)) {
echo PMA_Util::getMessage($message, $sql_query);
echo PMA\libraries\Util::getMessage($message, $sql_query);
unset($message);
}

Expand Down Expand Up @@ -278,7 +279,7 @@
if (! $cfgRelation['allworks']
&& $cfg['PmaNoRelation_DisableWarning'] == false
) {
$message = PMA_Message::notice(
$message = PMA\libraries\Message::notice(
__(
'The phpMyAdmin configuration storage has been deactivated. ' .
'%sFind out why%s.'
Expand All @@ -304,12 +305,12 @@
// We only show this if we find something in the new pdf_pages table
$test_query = '
SELECT *
FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_Util::backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\'';
FROM ' . PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA\libraries\Util::backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($GLOBALS['db']) . '\'';
$test_rs = PMA_queryAsControlUser(
$test_query,
false,
PMA_DatabaseInterface::QUERY_STORE
PMA\libraries\DatabaseInterface::QUERY_STORE
);
} // end if
Loading

0 comments on commit f0ba28f

Please sign in to comment.