Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
aae53d6007
@ -56,7 +56,7 @@ function PMA_getHtmlForRenameDatabase($db)
|
||||
$html_output = '<div class="operations_half_width">'
|
||||
. '<form id="rename_db_form" '
|
||||
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : '')
|
||||
. 'method="post" action="db_operations.php"'
|
||||
. 'method="post" action="db_operations.php" '
|
||||
. 'onsubmit="return emptyFormElements(this, \'newname\')">';
|
||||
if (isset($_REQUEST['db_collation'])) {
|
||||
$html_output .= '<input type="hidden" name="db_collation" '
|
||||
@ -1219,7 +1219,7 @@ function PMA_getMaintainActionlink($action, $params, $url_params, $link,
|
||||
. '<a class="maintain_action" '
|
||||
. 'href="tbl_operations.php'
|
||||
. PMA_generate_common_url(array_merge($url_params, $params)) .'">'
|
||||
. __($action)
|
||||
. $action
|
||||
. '</a>'
|
||||
. PMA_CommonFunctions::getInstance()->showMySQLDocu($chapter, $link)
|
||||
. '</li>';
|
||||
@ -1279,7 +1279,7 @@ function PMA_getDeleteDataOrTablelink($url_params, $syntax, $link, $id)
|
||||
return '<li><a '
|
||||
. 'href="sql.php' . PMA_generate_common_url($url_params) . '"'
|
||||
. ($GLOBALS['cfg']['AjaxEnable']
|
||||
? 'id="' . $id . '" class="ajax"'
|
||||
? ' id="' . $id . '" class="ajax"'
|
||||
: ''
|
||||
) . '>'
|
||||
. $link . '</a>'
|
||||
|
||||
@ -312,12 +312,12 @@ function PMA_getHtmlForDisplayColumnPrivileges($columns, $row, $name_for_select,
|
||||
foreach ($columns as $current_column => $current_column_privileges) {
|
||||
$html_output .= '<option '
|
||||
. 'value="' . htmlspecialchars($current_column) . '"';
|
||||
if ($row[$name_for_select] == 'Y'
|
||||
if ($row[$name_for_select] == 'Y'
|
||||
|| $current_column_privileges[$name_for_current]
|
||||
) {
|
||||
$html_output .= ' selected="selected"';
|
||||
}
|
||||
$html_output .= '>'
|
||||
$html_output .= '>'
|
||||
. htmlspecialchars($current_column) . '</option>' . "\n";
|
||||
}
|
||||
|
||||
@ -511,7 +511,7 @@ function PMA_getHtmlForDisplayResourceLimits($row)
|
||||
. 'value="' . $row['max_questions'] . '" '
|
||||
. 'size="11" maxlength="11" '
|
||||
. 'title="'
|
||||
. __('Limits the number of queries the user may send to the server per hour.')
|
||||
. __('Limits the number of queries the user may send to the server per hour.')
|
||||
. '" />' . "\n"
|
||||
. '</div>' . "\n";
|
||||
|
||||
@ -536,7 +536,7 @@ function PMA_getHtmlForDisplayResourceLimits($row)
|
||||
. '</dfn></code></label>' . "\n"
|
||||
. '<input type="text" name="max_connections" id="text_max_connections" '
|
||||
. 'value="' . $row['max_connections'] . '" size="11" maxlength="11" '
|
||||
. 'title="' . __('Limits the number of new connections the user may open per hour.')
|
||||
. 'title="' . __('Limits the number of new connections the user may open per hour.')
|
||||
. '" />' . "\n"
|
||||
. '</div>' . "\n";
|
||||
|
||||
@ -550,8 +550,8 @@ function PMA_getHtmlForDisplayResourceLimits($row)
|
||||
. '<input type="text" name="max_user_connections" '
|
||||
. 'id="text_max_user_connections" '
|
||||
. 'value="' . $row['max_user_connections'] . '" size="11" maxlength="11" '
|
||||
. 'title="'
|
||||
. __('Limits the number of simultaneous connections the user may have.')
|
||||
. 'title="'
|
||||
. __('Limits the number of simultaneous connections the user may have.')
|
||||
. '" />' . "\n"
|
||||
. '</div>' . "\n";
|
||||
|
||||
@ -983,7 +983,7 @@ function PMA_getAdministrationPrivilegeTable($db)
|
||||
* Get HTML snippet for global privileges table with check boxes
|
||||
*
|
||||
* @param array $privTable privileges table array
|
||||
* @param array $privTable_names names of the privilege tables
|
||||
* @param array $privTable_names names of the privilege tables
|
||||
* (Data, Structure, Administration)
|
||||
* @param array $row first row from result or boolean false
|
||||
*
|
||||
@ -995,7 +995,7 @@ function PMA_getHtmlForGlobalPrivTableWithCheckboxes(
|
||||
$html_output = '';
|
||||
foreach ($privTable as $i => $table) {
|
||||
$html_output .= '<fieldset>' . "\n"
|
||||
. '<legend>' . __($privTable_names[$i]) . '</legend>' . "\n";
|
||||
. '<legend>' . $privTable_names[$i] . '</legend>' . "\n";
|
||||
foreach ($table as $priv) {
|
||||
$html_output .= '<div class="item">' . "\n"
|
||||
. '<input type="checkbox"'
|
||||
@ -1143,7 +1143,7 @@ function PMA_getHtmlForDisplayLoginInformationFields($mode = 'new')
|
||||
}
|
||||
}
|
||||
$html_output .= '<option value="any"'
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
&& $GLOBALS['pred_hostname'] == 'any'
|
||||
)
|
||||
? ' selected="selected"'
|
||||
@ -1151,7 +1151,7 @@ function PMA_getHtmlForDisplayLoginInformationFields($mode = 'new')
|
||||
. __('Any host')
|
||||
. '</option>' . "\n"
|
||||
. '<option value="localhost"'
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
&& $GLOBALS['pred_hostname'] == 'localhost'
|
||||
)
|
||||
? ' selected="selected"'
|
||||
@ -1160,7 +1160,7 @@ function PMA_getHtmlForDisplayLoginInformationFields($mode = 'new')
|
||||
. '</option>' . "\n";
|
||||
if (! empty($thishost)) {
|
||||
$html_output .= '<option value="thishost"'
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
&& $GLOBALS['pred_hostname'] == 'thishost'
|
||||
)
|
||||
? ' selected="selected"'
|
||||
@ -1170,7 +1170,7 @@ function PMA_getHtmlForDisplayLoginInformationFields($mode = 'new')
|
||||
}
|
||||
unset($thishost);
|
||||
$html_output .= '<option value="hosttable"'
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
&& $GLOBALS['pred_hostname'] == 'hosttable'
|
||||
)
|
||||
? ' selected="selected"'
|
||||
@ -1179,7 +1179,7 @@ function PMA_getHtmlForDisplayLoginInformationFields($mode = 'new')
|
||||
. '</option>' . "\n";
|
||||
|
||||
$html_output .= '<option value="userdefined"'
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
. ((isset($GLOBALS['pred_hostname'])
|
||||
&& $GLOBALS['pred_hostname'] == 'userdefined'
|
||||
)
|
||||
? ' selected="selected"'
|
||||
@ -1311,8 +1311,8 @@ function PMA_getMessageForUpdatePassword($err_url, $username, $hostname)
|
||||
// similar logic in user_password.php
|
||||
$message = '';
|
||||
|
||||
if (empty($_REQUEST['nopass'])
|
||||
&& isset($_POST['pma_pw'])
|
||||
if (empty($_REQUEST['nopass'])
|
||||
&& isset($_POST['pma_pw'])
|
||||
&& isset($_POST['pma_pw2'])
|
||||
) {
|
||||
if ($_POST['pma_pw'] != $_POST['pma_pw2']) {
|
||||
@ -1339,7 +1339,7 @@ function PMA_getMessageForUpdatePassword($err_url, $username, $hostname)
|
||||
. '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\' = '
|
||||
. (($_POST['pma_pw'] == '')
|
||||
? '\'\''
|
||||
: $hashing_function . '(\''
|
||||
: $hashing_function . '(\''
|
||||
. preg_replace('@.@s', '*', $_POST['pma_pw']) . '\')');
|
||||
|
||||
$local_query = 'SET PASSWORD FOR \''
|
||||
@ -1377,7 +1377,7 @@ function PMA_getMessageAndSqlQueryForPrivilegesRevoke($db_and_table, $dbname,
|
||||
$tablename, $username, $hostname
|
||||
) {
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
$db_and_table = PMA_wildcardEscapeForGrant($dbname, $tablename);
|
||||
|
||||
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table
|
||||
@ -1679,7 +1679,7 @@ function PMA_getHtmlTableBodyForSpecificDbPrivs($found, $row, $odd_row,
|
||||
$row = PMA_DBI_fetch_assoc($res);
|
||||
}
|
||||
$html_output .= '<tr '
|
||||
. 'class="noclick ' . ($odd_row ? 'odd' : 'even')
|
||||
. 'class="noclick ' . ($odd_row ? 'odd' : 'even')
|
||||
. '">' . "\n"
|
||||
. '<td';
|
||||
if (count($current_privileges) > 1) {
|
||||
@ -1736,7 +1736,7 @@ function PMA_getHtmlTableBodyForSpecificDbPrivs($found, $row, $odd_row,
|
||||
urlencode($current_host),
|
||||
urlencode(
|
||||
! (isset($current['Db']) || $current['Db'] == '*')
|
||||
? ''
|
||||
? ''
|
||||
: $current['Db']
|
||||
),
|
||||
''
|
||||
@ -1844,7 +1844,7 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
|
||||
$new_user_string = '<tr>'."\n"
|
||||
. '<td> <input type="checkbox" name="selected_usr[]" '
|
||||
. 'id="checkbox_sel_users_"'
|
||||
. 'value="'
|
||||
. 'value="'
|
||||
. htmlspecialchars($username)
|
||||
. '&#27;' . htmlspecialchars($hostname) . '" />'
|
||||
. '</td>' . "\n"
|
||||
@ -1853,7 +1853,7 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
|
||||
? '<span style="color: #FF0000">' . __('Any') . '</span>'
|
||||
: htmlspecialchars($username) ) . '</label></td>' . "\n"
|
||||
. '<td>' . htmlspecialchars($hostname) . '</td>' . "\n";
|
||||
|
||||
|
||||
$new_user_string .= '<td>';
|
||||
|
||||
if (! empty($password) || isset($_POST['pma_pw'])) {
|
||||
@ -2165,7 +2165,7 @@ function PMA_getHtmlForDisplayUserRightsInRows($db_rights, $link_edit, $dbname,
|
||||
htmlspecialchars(urlencode($username)),
|
||||
urlencode(htmlspecialchars($hostname)),
|
||||
urlencode((! strlen($dbname))
|
||||
? $row['Db']
|
||||
? $row['Db']
|
||||
: htmlspecialchars($dbname)
|
||||
),
|
||||
urlencode((! strlen($dbname)) ? '' : $row['Table_name'])
|
||||
@ -2180,8 +2180,8 @@ function PMA_getHtmlForDisplayUserRightsInRows($db_rights, $link_edit, $dbname,
|
||||
$link_revoke,
|
||||
htmlspecialchars(urlencode($username)),
|
||||
urlencode(htmlspecialchars($hostname)),
|
||||
urlencode((! strlen($dbname))
|
||||
? $row['Db']
|
||||
urlencode((! strlen($dbname))
|
||||
? $row['Db']
|
||||
: htmlspecialchars($dbname)
|
||||
),
|
||||
urlencode((! strlen($dbname)) ? '' : $row['Table_name'])
|
||||
@ -2210,7 +2210,7 @@ function PMA_getTableForDisplayAllTableSpecificRights($username, $hostname
|
||||
, $link_edit, $link_revoke, $dbname
|
||||
) {
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
// table header
|
||||
$html_output = PMA_generate_common_hidden_inputs('', '')
|
||||
. '<input type="hidden" name="username" '
|
||||
@ -2283,14 +2283,14 @@ function PMA_getTableForDisplayAllTableSpecificRights($username, $hostname
|
||||
function PMA_getHTmlForDisplaySelectDbInEditPrivs($found_rows)
|
||||
{
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
$pred_db_array =PMA_DBI_fetch_result('SHOW DATABASES;');
|
||||
|
||||
$html_output = '<label for="text_dbname">'
|
||||
. __('Add privileges on the following database') . ':</label>' . "\n";
|
||||
if (! empty($pred_db_array)) {
|
||||
$html_output .= '<select name="pred_dbname" class="autosubmit">' . "\n"
|
||||
. '<option value="" selected="selected">'
|
||||
. '<option value="" selected="selected">'
|
||||
. __('Use text field') . ':</option>' . "\n";
|
||||
foreach ($pred_db_array as $current_db) {
|
||||
$current_db = $common_functions->escapeMysqlWildcards($current_db);
|
||||
@ -2485,7 +2485,7 @@ function PMA_getTableBodyForUserRightsTable($db_rights, $link_edit, $link_export
|
||||
$html_output .= __('Yes');
|
||||
break;
|
||||
case 'N':
|
||||
$html_output .= '<span style="color: #FF0000">' . __('No')
|
||||
$html_output .= '<span style="color: #FF0000">' . __('No')
|
||||
. '</span>';
|
||||
break;
|
||||
// this happens if this is a definition not coming from mysql.user
|
||||
@ -2532,7 +2532,7 @@ function PMA_getFieldsetForAddDeleteUser($conditional_class)
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
$html_output = '<fieldset id="fieldset_add_user">' . "\n";
|
||||
$html_output .= '<a href="server_privileges.php?'
|
||||
$html_output .= '<a href="server_privileges.php?'
|
||||
. $GLOBALS['url_query'] . '&adduser=1"'
|
||||
. 'class="' . $conditional_class . '">' . "\n"
|
||||
. $common_functions->getIcon('b_usradd.png')
|
||||
@ -2609,7 +2609,7 @@ function PMA_getHtmlForDisplayTheInitials($array_initials, $conditional_class)
|
||||
$html_output .= '<td>'
|
||||
. '<a href="server_privileges.php?'
|
||||
. $GLOBALS['url_query'] . '&'
|
||||
. 'initial=' . urlencode($tmp_initial) . '">' . $tmp_initial
|
||||
. 'initial=' . urlencode($tmp_initial) . '">' . $tmp_initial
|
||||
. '</a>'
|
||||
. '</td>' . "\n";
|
||||
} else {
|
||||
@ -2617,7 +2617,7 @@ function PMA_getHtmlForDisplayTheInitials($array_initials, $conditional_class)
|
||||
}
|
||||
}
|
||||
$html_output .= '<td>'
|
||||
. '<a href="server_privileges.php?' . $GLOBALS['url_query']
|
||||
. '<a href="server_privileges.php?' . $GLOBALS['url_query']
|
||||
. '&showall=1" '
|
||||
. 'class="nowrap">[' . __('Show all') . ']</a></td>' . "\n";
|
||||
$html_output .= '</tr></table>';
|
||||
@ -2775,7 +2775,7 @@ function PMA_updatePrivileges($username, $hostname, $tablename, $dbname)
|
||||
$sql_query = $sql_query0 . ' ' . $sql_query1 . ' ' . $sql_query2;
|
||||
$message = PMA_Message::success(__('You have updated the privileges for %s.'));
|
||||
$message->addParam(
|
||||
'\'' . htmlspecialchars($username)
|
||||
'\'' . htmlspecialchars($username)
|
||||
. '\'@\'' . htmlspecialchars($hostname) . '\''
|
||||
);
|
||||
|
||||
@ -2804,7 +2804,7 @@ function PMA_getHtmlForExportUserDefinition($username, $hostname)
|
||||
$export .= '# '
|
||||
. sprintf(
|
||||
__('Privileges for %s'),
|
||||
'`' . htmlspecialchars($export_username)
|
||||
'`' . htmlspecialchars($export_username)
|
||||
. '`@`' . htmlspecialchars($export_hostname) . '`'
|
||||
)
|
||||
. "\n\n";
|
||||
@ -2916,8 +2916,8 @@ function PMA_getHtmlForDisplayUserOverviewPage($link_edit, $pmaThemeImage,
|
||||
" IF(`Password` = _latin1 '', 'N', 'Y') AS 'Password'" .
|
||||
' FROM `mysql`.`user`';
|
||||
|
||||
$sql_query .= (isset($_REQUEST['initial'])
|
||||
? PMA_rangeOfUsers($_REQUEST['initial'])
|
||||
$sql_query .= (isset($_REQUEST['initial'])
|
||||
? PMA_rangeOfUsers($_REQUEST['initial'])
|
||||
: '');
|
||||
|
||||
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
|
||||
@ -3013,7 +3013,7 @@ function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname,
|
||||
$random_n, $username, $hostname, $link_edit, $link_revoke, $dbname, $tablename
|
||||
) {
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
$html_output = PMA_getHtmlHeaderForDisplayUserProperties(
|
||||
$dbname_is_wildcard, $url_dbname, $dbname, $username, $hostname, $tablename
|
||||
);
|
||||
@ -3063,7 +3063,7 @@ function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname,
|
||||
$html_output .= '<form action="server_privileges.php" '
|
||||
. 'id="db_or_table_specific_priv" method="post">' . "\n";
|
||||
|
||||
list($html_rightsTable, $found_rows)
|
||||
list($html_rightsTable, $found_rows)
|
||||
= PMA_getTableForDisplayAllTableSpecificRights(
|
||||
$username, $hostname, $link_edit, $link_revoke, $dbname
|
||||
);
|
||||
@ -3114,7 +3114,7 @@ function PMA_getTablePrivsQueriesForChangeOrCopyUser($user_host_condition,
|
||||
{
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$res = PMA_DBI_query(
|
||||
'SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`'
|
||||
'SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`'
|
||||
. $user_host_condition,
|
||||
$GLOBALS['userlink'],
|
||||
PMA_DBI_QUERY_STORE
|
||||
|
||||
@ -15,19 +15,47 @@ require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/CommonFunctions.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
|
||||
class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Set up global environment.
|
||||
*/
|
||||
public function setup() {
|
||||
$GLOBALS['table'] = 'table';
|
||||
$GLOBALS['db'] = 'db';
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
$GLOBALS['cfg'] = array(
|
||||
'MySQLManualType' => 'none',
|
||||
'AjaxEnable' => true,
|
||||
'ServerDefault' => 1,
|
||||
'PropertiesIconic' => true,
|
||||
);
|
||||
$GLOBALS['server'] = 1;
|
||||
|
||||
if (! function_exists('PMA_generateCharsetDropdownBox')) {
|
||||
function PMA_generateCharsetDropdownBox()
|
||||
{
|
||||
}
|
||||
}
|
||||
if (! defined('PMA_CSDROPDOWN_CHARSET')) {
|
||||
define('PMA_CSDROPDOWN_CHARSET', '');
|
||||
}
|
||||
if (! defined('PMA_CSDROPDOWN_COLLATION')) {
|
||||
define('PMA_CSDROPDOWN_COLLATION', '');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getHtmlForDatabaseComment
|
||||
*/
|
||||
public function testPMA_getHtmlForDatabaseComment(){
|
||||
|
||||
$_SESSION[' PMA_token '] = 'token';
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForDatabaseComment("pma"),
|
||||
'<div class="operations_half_width"><form method="post" action="db_operations.php"><input type="hidden" name="db" value="pma" /><input type="hidden" name="server" value="x" /><input type="hidden" name="lang" value="x" /><input type="hidden" name="collation_connection" value="x" /><input type="hidden" name="token" value="token" /><fieldset><legend><img class="icon ic_b_comment" src="themes/dot.gif" alt="" />Database comment: </legend><input type="text" name="comment" class="textfield" size="30"value="" /></fieldset><fieldset class="tblFooters"><input type="submit" value="Go" /></fieldset></form></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*db_operations.php(.|[\n])*Database comment.*name="comment"([\n]|.)*/m',
|
||||
PMA_getHtmlForDatabaseComment("pma")
|
||||
);
|
||||
}
|
||||
|
||||
@ -37,11 +65,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
public function testPMA_getHtmlForRenameDatabase(){
|
||||
|
||||
$_REQUEST['db_collation'] = 'db1';
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForRenameDatabase("pma"),
|
||||
'<div class="operations_half_width"><form id="rename_db_form" class="ajax" method="post" action="db_operations.php"onsubmit="return emptyFormElements(this, \'newname\')"><input type="hidden" name="db_collation" value="db1" />
|
||||
<input type="hidden" name="what" value="data" /><input type="hidden" name="db_rename" value="true" /><input type="hidden" name="db" value="pma" /><input type="hidden" name="server" value="x" /><input type="hidden" name="lang" value="x" /><input type="hidden" name="collation_connection" value="x" /><input type="hidden" name="token" value="token" /><fieldset><legend><img src="b_edit.png" title="" alt="" />Rename database to:</legend><input id="new_db_name" type="text" name="newname" size="30" class="textfield" value="" /></fieldset><fieldset class="tblFooters"><input id="rename_db_input" type="submit" value="Go" /></fieldset></form></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*db_operations.php(.|[\n])*db_rename([\n]|.)*Rename database to.*/m',
|
||||
PMA_getHtmlForRenameDatabase("pma")
|
||||
);
|
||||
}
|
||||
|
||||
@ -50,10 +76,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getHtmlForDropDatabaseLink(){
|
||||
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForDropDatabaseLink("pma"),
|
||||
'<div class="operations_half_width"><fieldset class="caution"><legend><img src="b_deltbl.png" title="" alt="" />Remove database</legend><ul><li><a href="sql.php?sql_query=DROP+DATABASE+%60pma%60&back=db_operations.php&goto=main.php&reload=1&purge=1&message_to_show=Database+%60pma%60+has+been+dropped.&server=x&lang=x&collation_connection=x&token=token"id="drop_db_anchor" class="ajax">Drop the database (DROP)</a><a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fdrop-database.html&server=x&lang=x&collation_connection=x&token=token" target="mysql_doc"><img src="b_help.png" title="Documentation" alt="Documentation" /></a></li></ul></fieldset></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*DROP.DATABASE.*db_operations.php.*Drop the database.*/',
|
||||
PMA_getHtmlForDropDatabaseLink("pma")
|
||||
);
|
||||
}
|
||||
|
||||
@ -63,18 +88,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
public function testPMA_getHtmlForCopyDatabase(){
|
||||
|
||||
$_REQUEST['db_collation'] = 'db1';
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForCopyDatabase("pma"),
|
||||
'<div class="operations_half_width clearfloat"><form id="copy_db_form" class="ajax" method="post" action="db_operations.php"onsubmit="return emptyFormElements(this\'newname\')"><input type="hidden" name="db_collation" value="db1" />
|
||||
<input type="hidden" name="db_copy" value="true" />
|
||||
<input type="hidden" name="db" value="pma" /><input type="hidden" name="server" value="x" /><input type="hidden" name="lang" value="x" /><input type="hidden" name="collation_connection" value="x" /><input type="hidden" name="token" value="token" /><fieldset><legend><img src="b_edit.png" title="" alt="" />Copy database to:</legend><input type="text" name="newname" size="30" class="textfield" value="" /><br /><input type="radio" name="what" id="what_structure" value="structure" />
|
||||
<label for="what_structure">Structure only</label><br />
|
||||
<input type="radio" name="what" id="what_data" value="data" checked="checked" />
|
||||
<label for="what_data">Structure and data</label><br />
|
||||
<input type="radio" name="what" id="what_dataonly" value="dataonly" />
|
||||
<label for="what_dataonly">Data only</label><br />
|
||||
<input type="checkbox" name="create_database_before_copying" value="1" id="checkbox_create_database_before_copying"checked="checked" /><label for="checkbox_create_database_before_copying">CREATE DATABASE before copying</label><br /><input type="checkbox" name="drop_if_exists" value="true"id="checkbox_drop" /><label for="checkbox_drop">Add DROP TABLE / DROP VIEW</label><br /><input type="checkbox" name="sql_auto_increment" value="1" checked="checked" id="checkbox_auto_increment" /><label for="checkbox_auto_increment">Add AUTO_INCREMENT value</label><br /><input type="checkbox" name="add_constraints" value="1"id="checkbox_constraints" /><label for="checkbox_constraints">Add constraints</label><br /><input type="checkbox" name="switch_to_new" value="true"id="checkbox_switch"/><label for="checkbox_switch">Switch to copied database</label></fieldset><fieldset class="tblFooters"><input type="submit" name="submit_copy" value="Go" /></fieldset></form></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*db_operations.php(.|[\n])*db_copy([\n]|.)*Copy database to.*/m',
|
||||
PMA_getHtmlForCopyDatabase("pma")
|
||||
);
|
||||
}
|
||||
|
||||
@ -84,16 +100,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
public function testPMA_getHtmlForChangeDatabaseCharset(){
|
||||
|
||||
$_REQUEST['db_collation'] = 'db1';
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForChangeDatabaseCharset("pma", "bookmark"),
|
||||
'<div class="operations_half_width"><form id="change_db_charset_form" class="ajax" method="post" action="db_operations.php"><input type="hidden" name="db" value="pma" /><input type="hidden" name="table" value="bookmark" /><input type="hidden" name="server" value="x" /><input type="hidden" name="lang" value="x" /><input type="hidden" name="collation_connection" value="x" /><input type="hidden" name="token" value="token" /><fieldset>
|
||||
<legend><img src="s_asci.png" title="" alt="" /><label for="select_db_collation">Collation:</label>
|
||||
</legend>
|
||||
</fieldset><fieldset class="tblFooters"><input type="submit" name="submitcollation" value="Go" />
|
||||
</fieldset>
|
||||
</form></div>
|
||||
'
|
||||
$this->assertRegExp(
|
||||
'/.*db_operations.php(.|[\n])*select_db_collation([\n]|.)*Collation.*/m',
|
||||
PMA_getHtmlForChangeDatabaseCharset("pma", "bookmark")
|
||||
);
|
||||
}
|
||||
|
||||
@ -102,10 +111,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getHtmlForExportRelationalSchemaView(){
|
||||
|
||||
$GLOBALS['cfg']['PropertiesIconic'] = true;
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForExportRelationalSchemaView("id=001&name=pma"),
|
||||
'<div class="operations_full_width"><fieldset><a href="schema_edit.php?id=001&name=pma"><img src="b_edit.png" title="" alt="" />Edit or export relational schema</a></fieldset></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*schema_edit.php.*Edit or export relational schema<.*/',
|
||||
PMA_getHtmlForExportRelationalSchemaView("id=001&name=pma")
|
||||
);
|
||||
}
|
||||
|
||||
@ -114,11 +122,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getHtmlForOrderTheTable(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForOrderTheTable(array("column1", "column2")),
|
||||
'<div class="operations_half_width"><form method="post" id="alterTableOrderby" action="tbl_operations.php" class="ajax"><input type="hidden" name="db" value="test_db" /><input type="hidden" name="table" value="table" /><input type="hidden" name="server" value="x" /><input type="hidden" name="lang" value="x" /><input type="hidden" name="collation_connection" value="x" /><input type="hidden" name="token" value="token" /><fieldset id="fieldset_table_order"><legend>Alter table order by</legend><select name="order_field"><option value="c">c</option>
|
||||
<option value="c">c</option>
|
||||
</select> (singly)<select name="order_order"><option value="asc">Ascending</option><option value="desc">Descending</option></select></fieldset><fieldset class="tblFooters"><input type="submit" name="submitorderby" value="Go" /></fieldset></form></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*tbl_operations.php(.|[\n])*Alter table order by([\n]|.)*order_order.*/m',
|
||||
PMA_getHtmlForOrderTheTable(array(array('Field' => "column1"), array('Field' => "column2")))
|
||||
);
|
||||
}
|
||||
|
||||
@ -128,8 +134,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
public function testPMA_getHtmlForTableRow(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForTableRow("name", "lable", "value"),
|
||||
'<tr><td><label for="name">lable</label></td><td><input type="checkbox" name="name" id="name"value="1"/></td></tr>'
|
||||
'<tr><td><label for="name">lable</label></td><td><input type="checkbox" name="name" id="name" value="1"/></td></tr>',
|
||||
PMA_getHtmlForTableRow("name", "lable", "value")
|
||||
);
|
||||
}
|
||||
|
||||
@ -139,8 +145,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
public function testPMA_getMaintainActionlink(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getMaintainActionlink("post", array("name", "value"), "lable", "value"),
|
||||
'<li><a class="maintain_action" href="tbl_operations.phpserver=x&lang=x&collation_connection=x&token=token">post</a><a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fvalue.html&server=x&lang=x&collation_connection=x&token=token" target="mysql_doc"><img src="b_help.png" title="Documentation" alt="Documentation" /></a></li>'
|
||||
'<li><a class="maintain_action" href="tbl_operations.php?name=foo&value=bar&token=token">post</a></li>',
|
||||
PMA_getMaintainActionlink("post", array("name" => 'foo', "value" => 'bar'), array(), 'doclink')
|
||||
);
|
||||
}
|
||||
|
||||
@ -149,9 +155,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getHtmlForDeleteDataOrTable(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForDeleteDataOrTable(array("truncate"), array("drop")),
|
||||
'<div class="operations_half_width"><fieldset class="caution"><legend>Delete data or table</legend><ul><li><a href="sql.php?0=truncate&server=x&lang=x&collation_connection=x&token=token"id="truncate_tbl_anchor" class="ajax">Empty the table (TRUNCATE)</a><a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Ftruncate-table.html&server=x&lang=x&collation_connection=x&token=token" target="mysql_doc"><img src="b_help.png" title="Documentation" alt="Documentation" /></a></li><li><a href="sql.php?0=drop&server=x&lang=x&collation_connection=x&token=token"id="drop_tbl_anchor" class="ajax">Delete the table (DROP)</a><a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fdrop-table.html&server=x&lang=x&collation_connection=x&token=token" target="mysql_doc"><img src="b_help.png" title="Documentation" alt="Documentation" /></a></li></ul></fieldset></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*Delete data or table.*Empty the table.*Delete the table.*/m',
|
||||
PMA_getHtmlForDeleteDataOrTable(array("truncate" => 'foo'), array("drop" => 'bar'))
|
||||
);
|
||||
}
|
||||
|
||||
@ -160,9 +166,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getDeleteDataOrTablelink(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getDeleteDataOrTablelink(array("param"), "TRUNCATE_TABLE", "/phpmyadmin", 001),
|
||||
'<li><a href="sql.php?0=param&server=x&lang=x&collation_connection=x&token=token"id="1" class="ajax">/phpmyadmin</a><a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Ftruncate-table.html&server=x&lang=x&collation_connection=x&token=token" target="mysql_doc"><img src="b_help.png" title="Documentation" alt="Documentation" /></a></li>'
|
||||
$this->assertRegExp(
|
||||
'/.*TRUNCATE.TABLE.foo.*id_truncate.*Truncate table.*/m',
|
||||
PMA_getDeleteDataOrTablelink(array("sql" => 'TRUNCATE TABLE foo'), "TRUNCATE_TABLE", "Truncate table", "id_truncate")
|
||||
);
|
||||
}
|
||||
|
||||
@ -171,23 +177,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getHtmlForPartitionMaintenance(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForPartitionMaintenance(array("partition1", "partion2"), array("param1", "param2")),
|
||||
'<div class="operations_half_width"><form method="post" action="tbl_operations.php"><input type="hidden" name="db" value="test_db" /><input type="hidden" name="table" value="table" /><input type="hidden" name="server" value="x" /><input type="hidden" name="lang" value="x" /><input type="hidden" name="collation_connection" value="x" /><input type="hidden" name="token" value="token" /><fieldset><legend>Partition maintenance</legend>Partition <select name="partition_name">
|
||||
<option value="partition1">partition1</option>
|
||||
<option value="partion2">partion2</option>
|
||||
</select>
|
||||
<input type="radio" name="partition_operation" id="partition_operation_ANALYZE" value="ANALYZE" />
|
||||
<label for="partition_operation_ANALYZE">Analyze</label>
|
||||
<input type="radio" name="partition_operation" id="partition_operation_CHECK" value="CHECK" />
|
||||
<label for="partition_operation_CHECK">Check</label>
|
||||
<input type="radio" name="partition_operation" id="partition_operation_OPTIMIZE" value="OPTIMIZE" />
|
||||
<label for="partition_operation_OPTIMIZE">Optimize</label>
|
||||
<input type="radio" name="partition_operation" id="partition_operation_REBUILD" value="REBUILD" />
|
||||
<label for="partition_operation_REBUILD">Rebuild</label>
|
||||
<input type="radio" name="partition_operation" id="partition_operation_REPAIR" value="REPAIR" />
|
||||
<label for="partition_operation_REPAIR">Repair</label>
|
||||
<a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fpartitioning-maintenance.html&server=x&lang=x&collation_connection=x&token=token" target="mysql_doc"><img src="b_help.png" title="Documentation" alt="Documentation" /></a><br /><a href="sql.php?0=param1&1=param2&sql_query=ALTER+TABLE+%60table%60+REMOVE+PARTITIONING%3B&server=x&lang=x&collation_connection=x&token=token">Remove partitioning</a></fieldset><fieldset class="tblFooters"><input type="submit" name="submit_partition" value="Go" /></fieldset></form></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*action="tbl_operations.php"(.|[\n])*ANALYZE([\n]|.)*REBUILD([\n]|.)*/m',
|
||||
PMA_getHtmlForPartitionMaintenance(array("partition1", "partion2"), array("param1" => 'foo', "param2" => 'bar'))
|
||||
);
|
||||
}
|
||||
|
||||
@ -196,11 +188,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getHtmlForReferentialIntegrityCheck(){
|
||||
|
||||
$this->assertEquals(
|
||||
PMA_getHtmlForReferentialIntegrityCheck(array("foreign1", "foreign2"), array("param1", "param2")),
|
||||
'<div class="operations_half_width"><fieldset><legend>Check referential integrity:</legend><ul>"\n"<li><a href="sql.php?0=param1&1=param2&sql_query=SELECT+%60table%60.%2A+FROM+%60table%60+LEFT+JOIN+%60f%60+ON+%60table%60.%600%60+%3D+%60f%60.%60f%60+WHERE+%60f%60.%60f%60+IS+NULL+AND+%60table%60.%600%60+IS+NOT+NULL&server=x&lang=x&collation_connection=x&token=token">0 -> f.f</a></li>
|
||||
<li><a href="sql.php?0=param1&1=param2&sql_query=SELECT+%60table%60.%2A+FROM+%60table%60+LEFT+JOIN+%60f%60+ON+%60table%60.%601%60+%3D+%60f%60.%60f%60+WHERE+%60f%60.%60f%60+IS+NULL+AND+%60table%60.%601%60+IS+NOT+NULL&server=x&lang=x&collation_connection=x&token=token">1 -> f.f</a></li>
|
||||
</ul></fieldset></div>'
|
||||
$this->assertRegExp(
|
||||
'/.*Check referential integrity.*href="sql.php(.|[\n])*/m',
|
||||
PMA_getHtmlForReferentialIntegrityCheck(array(array('foreign_table' => "foreign1", 'foreign_field' => "foreign2")), array("param1" => 'a', "param2" => 'b'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user