Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-11-05 18:29:54 +01:00
commit e44226beac
4 changed files with 83 additions and 27 deletions

View File

@ -49,6 +49,7 @@ phpMyAdmin - ChangeLog
+ Javascript files are no longer uglified
- bug #4145 Config screen fails to validate MemoryLimit = -1 (new default)
- bug #4123 Double config including
- bug #4134 After deleting all rows on a page, it returns to a blank page
4.0.10.0 (not yet released)
- bug #4150 Clicking database name in query window opens a new tab

View File

@ -98,10 +98,12 @@ function PMA_getQueryStrFromSelected(
}
$selected_cnt = count($selected);
$deletes = false;
for ($i = 0; $i < $selected_cnt; $i++) {
switch ($query_type) {
case 'row_delete':
$deletes = true;
$a_query = $selected[$i];
$run_parts = true;
break;
@ -153,6 +155,7 @@ function PMA_getQueryStrFromSelected(
break;
case 'empty_tbl':
$deletes = true;
$a_query = 'TRUNCATE ';
$a_query .= PMA_Util::backquote($selected[$i]);
$run_parts = true;
@ -271,6 +274,10 @@ function PMA_getQueryStrFromSelected(
} // end if
} // end for
if ($deletes) {
$_REQUEST['pos'] = PMA_calculatePosForLastPage($db, $table, $_REQUEST['pos']);
}
return array(
$result, $rebuild_database_list, $reload,
$run_parts, $use_sql, $sql_query, $sql_query_views

View File

@ -1050,9 +1050,7 @@ function PMA_addBookmark($pmaAbsoluteUri, $goto)
function PMA_findRealEndOfRows($db, $table)
{
$unlim_num_rows = PMA_Table::countRecords($db, $table, true);
$_SESSION['tmpval']['pos'] = @((ceil(
$unlim_num_rows / $_SESSION['tmpval']['max_rows']
) - 1) * $_SESSION['tmpval']['max_rows']);
$_SESSION['tmpval']['pos'] = PMA_getStartPosToDisplayRow($unlim_num_rows);
return $unlim_num_rows;
}
@ -1222,7 +1220,7 @@ function PMA_handleQueryExecuteError($is_gotofile, $error, $full_sql_query)
*
* @param String $db the current database
* @param String $bkm_user the bookmarking user
* @param String $sql_query_for_bookmark the query to be stored in bookmark
* @param String $sql_query_for_bookmark the query to be stored in bookmark
* @param String $bkm_label bookmark label
* @param boolean $bkm_replace whether to replace existing bookmarks
*
@ -2227,29 +2225,29 @@ function PMA_sendQueryResponse($num_rows, $unlim_num_rows, $is_affected,
/**
* Function to execute the query and send the response
*
* @param array $analyzed_sql_results analysed sql results
* @param bool $is_gotofile whether goto file or not
* @param string $db current database
* @param string $table current table
* @param bool $find_real_end whether to find real end or not
* @param string $sql_query_for_bookmark the sql query to be stored as bookmark
* @param array $extra_data extra data
* @param bool $is_affected whether affected or not
* @param string $message_to_show message to show
* @param string $disp_mode display mode
* @param string $message message
* @param array $sql_data sql data
* @param string $goto goto page url
* @param string $pmaThemeImage uri of the PMA theme image
* @param string $disp_query display query
* @param string $disp_message display message
* @param string $query_type query type
* @param string $sql_query sql query
* @param bool $selected whether check table, optimize table, analyze
* table or repair table has been selected with
* respect to the selected tables from the
* database structure page.
* @param string $complete_query complete query
* @param array $analyzed_sql_results analysed sql results
* @param bool $is_gotofile whether goto file or not
* @param string $db current database
* @param string $table current table
* @param bool $find_real_end whether to find real end or not
* @param string $sql_query_for_bookmark the sql query to be stored as bookmark
* @param array $extra_data extra data
* @param bool $is_affected whether affected or not
* @param string $message_to_show message to show
* @param string $disp_mode display mode
* @param string $message message
* @param array $sql_data sql data
* @param string $goto goto page url
* @param string $pmaThemeImage uri of the PMA theme image
* @param string $disp_query display query
* @param string $disp_message display message
* @param string $query_type query type
* @param string $sql_query sql query
* @param bool $selected whether check table, optimize table,
* analyze table or repair table has been
* selected with respect to the selected
* tables from the database structure page
* @param string $complete_query complete query
*
* @return void
*/
@ -2335,4 +2333,47 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
isset($complete_query) ? $complete_query : null
);
}
/**
* Function to define pos to display a row
*
* @param Int $number_of_line Number of the line to display
* @param Int $max_rows Number of rows by page
*
* @return Int Start position to display the line
*/
function PMA_getStartPosToDisplayRow($number_of_line, $max_rows = null)
{
if (null === $max_rows) {
$max_rows = $_SESSION['tmpval']['max_rows'];
}
return @((ceil($number_of_line / $max_rows) - 1) * $max_rows);
}
/**
* Function to calculate new pos if pos is higher than number of rows
* of displayed table
*
* @param String $db Database name
* @param String $table Table name
* @param Int $pos Initial position
*
* @return Int Number of pos to display last page
*/
function PMA_calculatePosForLastPage($db, $table, $pos)
{
if (null === $pos) {
$pos = $_SESSION['tmpval']['pos'];
}
$unlim_num_rows = PMA_Table::countRecords($db, $table, true);
//If position is higher than number of rows
if ($unlim_num_rows <= $pos && 0 != $pos) {
$pos = PMA_getStartPosToDisplayRow($unlim_num_rows);
}
return $pos;
}
?>

View File

@ -22,6 +22,8 @@ require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/js_escape.lib.php';
require_once 'libraries/relation_cleanup.lib.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/sql.lib.php';
require_once 'libraries/Table.class.php';
/**
* class PMA_MultSubmits_Test
@ -48,6 +50,7 @@ class PMA_MultSubmits_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['ShowSQL'] = true;
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
$GLOBALS['cfg']['LimitChars'] = 100;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['server'] = 0;
$GLOBALS['cfg']['ActionLinksMode'] = "both";
$GLOBALS['pmaThemeImage'] = 'image';
@ -278,6 +281,10 @@ class PMA_MultSubmits_Test extends PHPUnit_Framework_TestCase
$from_prefix = "from_prefix";
$to_prefix = "to_prefix";
$_REQUEST['pos'] = 1000;
$_SESSION['tmpval']['pos'] = 1000;
$_SESSION['tmpval']['max_rows'] = 25;
list(
$result, $rebuild_database_list, $reload_ret,
$run_parts, $use_sql, $sql_query, $sql_query_views