patch #2727250 Optimizations for some PHP loops
This commit is contained in:
@@ -49,6 +49,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
||||
thanks to Pawel Smolinski - zipoking
|
||||
+ patch #2715142 [export] (rfe 2416960, escape new line in CSV export)
|
||||
thanks to Derek Schaefer - drummingds1
|
||||
- patch #2727250 Optimizations for PHP loops
|
||||
thanks to Haeber
|
||||
|
||||
3.1.4.0 (not yet released)
|
||||
+ patch #1808339 [doc] Apache SSLOptions and StdEnvVars FAQ,
|
||||
|
@@ -813,7 +813,8 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
|
||||
$group =& $table_groups;
|
||||
$i = 0;
|
||||
$group_name_full = '';
|
||||
while ($i < count($parts) - 1
|
||||
$parts_cnt = count($parts) - 1;
|
||||
while ($i < $parts_cnt
|
||||
&& $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
|
||||
$group_name = $parts[$i] . $sep;
|
||||
$group_name_full .= $group_name;
|
||||
@@ -1798,7 +1799,7 @@ function PMA_flipstring($string, $Separator = "<br />\n")
|
||||
$format_string = '';
|
||||
$charbuff = false;
|
||||
|
||||
for ($i = 0; $i < strlen($string); $i++) {
|
||||
for ($i = 0, $str_len = strlen($string); $i < $str_len; $i++) {
|
||||
$char = $string{$i};
|
||||
$append = false;
|
||||
|
||||
@@ -1817,7 +1818,7 @@ function PMA_flipstring($string, $Separator = "<br />\n")
|
||||
}
|
||||
|
||||
// do not add separator after the last character
|
||||
if ($append && ($i != strlen($string)-1)) {
|
||||
if ($append && ($i != $str_len - 1)) {
|
||||
$format_string .= $Separator;
|
||||
}
|
||||
}
|
||||
@@ -2536,7 +2537,7 @@ function PMA_cacheUnset($var, $server = 0)
|
||||
*/
|
||||
function PMA_printable_bit_value($value, $length) {
|
||||
$printable = '';
|
||||
for ($i = 0; $i < ceil($length / 8); $i++) {
|
||||
for ($i = 0, $len_ceiled = ceil($length / 8); $i < $len_ceiled; $i++) {
|
||||
$printable .= sprintf('%08d', decbin(ord(substr($value, $i, 1))));
|
||||
}
|
||||
$printable = substr($printable, -$length);
|
||||
|
@@ -94,7 +94,7 @@ function get_tab_info()
|
||||
{
|
||||
PMA_DBI_select_db($GLOBALS['db']);
|
||||
$tab_column = array();
|
||||
for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
|
||||
for ($i = 0, $cnt = count($GLOBALS['PMD']["TABLE_NAME"]); $i < $cnt; $i++) {
|
||||
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM '.PMA_backquote($GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]), NULL, PMA_DBI_QUERY_STORE);
|
||||
$j = 0;
|
||||
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
||||
@@ -163,7 +163,7 @@ function get_script_contr()
|
||||
'<script type="text/javascript">' . "\n" .
|
||||
'// <![CDATA[' . "\n" .
|
||||
'var contr = new Array();' . "\n";
|
||||
for ($i = 0; $i < count($con["C_NAME"]); $i++) {
|
||||
for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
|
||||
$js_var = ' contr[' . $ti . ']';
|
||||
$script_contr .= $js_var . " = new Array();\n";
|
||||
$js_var .= "['" . $con['C_NAME'][$i] . "']";
|
||||
@@ -241,7 +241,7 @@ function get_script_tabs()
|
||||
'<script type="text/javascript">' . "\n" .
|
||||
'// <![CDATA[' . "\n" .
|
||||
'var j_tabs = new Array();' . "\n";
|
||||
for ($i = 0; $i < count($GLOBALS['PMD']['TABLE_NAME']); $i++) {
|
||||
for ($i = 0, $cnt = count($GLOBALS['PMD']['TABLE_NAME']); $i < $cnt; $i++) {
|
||||
$script_tabs .= "j_tabs['" . $GLOBALS['PMD_URL']['TABLE_NAME'][$i] . "'] = '"
|
||||
. (PMA_foreignkey_supported($GLOBALS['PMD']['TABLE_TYPE'][$i]) ? '1' : '0') . "';\n";
|
||||
}
|
||||
|
@@ -137,7 +137,8 @@ echo $script_tabs . $script_contr . $script_display_field;
|
||||
<div id="id_scroll_tab" class="scroll_tab">
|
||||
<table width="100%" style="padding-left: 3px;">
|
||||
<?php
|
||||
for ($i = 0; $i < count($GLOBALS['PMD']['TABLE_NAME']); $i++) {
|
||||
$name_cnt = count($GLOBALS['PMD']['TABLE_NAME']);
|
||||
for ($i = 0; $i < $name_cnt; $i++) {
|
||||
?>
|
||||
<tr><td title="<?php echo $strStructure; ?>" width="1px"
|
||||
onmouseover="this.className='L_butt2_2'"
|
||||
@@ -169,7 +170,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']['TABLE_NAME']); $i++) {
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<?php echo $strNumberOfTables ?>: <?php echo count($GLOBALS['PMD']['TABLE_NAME']) ?>
|
||||
<?php echo $strNumberOfTables . ': ' . $name_cnt; ?>
|
||||
</div>
|
||||
<div align="right">
|
||||
<div id="layer_menu_sizer" onmousedown="layer_menu_cur_click=1">
|
||||
@@ -227,7 +228,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
|
||||
<?php if (! isset($tab_pos[$t_n])) echo 'style="display: none;"'; ?>>
|
||||
<?php
|
||||
$display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
|
||||
for ($j = 0; $j < count($tab_column[$t_n]["COLUMN_ID"]); $j++) {
|
||||
for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++) {
|
||||
?>
|
||||
<tr id="id_tr_<?php
|
||||
echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '.'
|
||||
|
@@ -255,7 +255,7 @@ function perform_config_checks()
|
||||
$blowfish_secret = $cf->get('blowfish_secret');
|
||||
$blowfish_secret_set = false;
|
||||
$cookie_auth_used = false;
|
||||
for ($i = 1; $i <= $cf->getServerCount(); $i++) {
|
||||
for ($i = 1, $server_cnt = $cf->getServerCount(); $i <= $server_cnt; $i++) {
|
||||
$cookie_auth_server = ($cf->getValue("Servers/$i/auth_type") == 'cookie');
|
||||
$cookie_auth_used |= $cookie_auth_server;
|
||||
$server_name = $cf->getServerName($i);
|
||||
|
Reference in New Issue
Block a user